Added grid post list sidebar

pull/49/head
farazdy 5 months ago
parent 7e521942e3
commit 55a6b0e62e

@ -0,0 +1,75 @@
<section class='GridPostListSidebar'>
<div class="{{gfx()['container']}}">
<div class="row pinned-posts">
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
<div class="col-md-6 p-1">
<div class="post-item">
<div class="corner">
{{$post->mainGroup->name}}
</div>
<a href="{{$post->webUrl()}}">
<img src="{{$post->orgUrl()}}" alt="{{$post->title}}"
title="{{implode(',',$post->tags->pluck('name')->toArray()??'')}}">
</a>
<div class="detail">
<h4>
{{$post->title}}
</h4>
<span>
{{$post->created_at->ldate('Y/m/d l')}}
</span>
</div>
</div>
</div>
@endforeach
</div>
<hr>
<div class="row">
@if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-0">
@include('segments.posts_page.GridPostListSidebar.inc.sidebar')
</div>
@endif
<div class="col-lg-9">
<div class="row">
@foreach($posts as $post)
<div class="col-md-4">
<div class="grid-post-item">
<div class="corner">
{{$post->mainGroup->name}}
</div>
<img src="{{$post->imgUrl()}}" alt="{{$post->title}}">
<h4>
{{$post->title}}
</h4>
<div class="text-muted py-2">
<span>
<i class="ri-calendar-line"></i>
{{$post->created_at->ldate('Y/m/d l')}}
</span>
<span class="float-end">
<i class="ri-eye-line"></i>
{{$post->view}}
</span>
</div>
<p>
{{$post->subtitle}}
<br>
</p>
<a href="{{$post->webUrl()}}" class="btn btn-outline-primary my-2 btn-sm">
{{__("Read more")}}
</a>
</div>
</div>
@endforeach
</div>
{{$posts->links()}}
</div>
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-0">
@include('segments.posts_page.GridPostListSidebar.inc.sidebar')
</div>
@endif
</div>
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "GridPostListSidebar",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -0,0 +1,30 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
class GridPostListSidebar
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_invert';
$setting->value = 0;
$setting->size = 12;
$setting->type = 'CHECKBOX';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' invert sidebar position';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_invert')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,144 @@
.GridPostListSidebar {
.pinned-posts{
padding: 2rem 0;
//column-gap: 2px;
//row-gap: 2px;
.post-item{
position: relative;
height: 350px;
border-radius: var(--xshop-border-radius) ;
overflow: hidden;
background: #333;
img{
border-radius: var(--xshop-border-radius) ;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
height: 100%;
object-fit: cover;
transition: 400ms;
opacity: .7;
}
.detail{
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
padding: 1rem;
color: white;
span{
opacity: .5;
}
}
.corner{
border-radius: var(--xshop-border-radius) ;
position: absolute;
inset-inline-start: 0;
top: 0;
background: var(--xshop-primary);
color: var(--xshop-diff);
z-index: 2;
padding: 4px 1rem;
font-size: 17px;
}
&:hover{
img{
transform: scale(1.6);
}
}
}
}
.grid-post-item{
position: relative;
margin-bottom: 1rem;
overflow: hidden;
img{
width: 100%;
height: 300px;
object-fit: cover;
margin-bottom: 1rem;
border-radius: var(--xshop-border-radius) ;
transition: 500ms;
}
p{
text-align: justify;
height: 4em;
overflow: hidden;
}
.corner{
border-radius: var(--xshop-border-radius) ;
position: absolute;
inset-inline-start: 0;
top: 0;
background: var(--xshop-primary);
color: var(--xshop-diff);
z-index: 2;
padding: 4px 1rem;
font-size: 17px;
}
&:hover{
img{
filter: contrast(1.2) grayscale(.5);
}
}
}
aside{
h4{
padding: .5rem;
position: relative;
text-align: center;
font-weight: 300;
font-size: 20px;
&:after{
position: absolute;
content: ' ';
height: 1px;
width: 70%;
bottom: 0;
left: 15%;
right: 15%;
background: linear-gradient(90deg,#ffffff00 0%, var(--xshop-primary) 50%, #ffffff00 100%);
}
}
}
.recent{
padding: 0;
list-style: none;
margin-top: 1rem;
li{
min-height: 60px;
margin-bottom: 1rem;
}
img{
width: 48px;
height: 48px;
object-fit: cover;
}
p{
height: 1.2em;
overflow: hidden;
}
h6{
max-height: 2.2em;
overflow: hidden;
}
}
}

@ -0,0 +1,44 @@
<aside class="p-4">
<h4>
{{__("Search")}}
</h4>
<form action="">
<div class="input-group mb-3">
<input type="search" class="form-control" placeholder="{{__('Search')}}...">
<button class="btn btn-outline-secondary" type="submit" id="button-addon2">
<i class="ri-search-2-line"></i>
</button>
</div>
</form>
<h4>
{{__("Recent posts")}}
</h4>
<ul class="recent">
@foreach(\App\Models\Post::where('status',1)->orderByDesc('id')->limit(5)->get() as $pst)
<li>
<a href="{{$pst->webUrl()}}">
<img src="{{$pst->imgUrl()}}" alt="{{$pst->title}}" class="float-start me-2">
<h6>
{{$pst->title}}
</h6>
<p class="text-muted">
{{$pst->subtitle}}
</p>
</a>
</li>
@endforeach
</ul>
<h4>
{{__("Groups")}}
</h4>
<ul class="list-group">
@foreach(\App\Models\Group::whereNull('parent_id')->get() as $grp)
<li class="list-group-item">
<a href="{{$grp->webUrl()}}">
{{$grp->name}}
</a>
</li>
@endforeach
</ul>
</aside>
Loading…
Cancel
Save