Added simple post list sidebar

pull/49/head
farazdy 4 months ago
parent 14a8ae5100
commit db451376ca

@ -9,4 +9,4 @@ import "./client-custom/confirm.js";
import "./client-custom/safeForm.js";
import "./client-custom/windowLoader.js";
import "../views/segments/preloader/PreloaderCircle/PreloaderCircle.js";
import "../views/segments/posts_page/SimplePostList/SimplePostList.js";
import "../views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.js";

@ -21,4 +21,4 @@ $xshop-shadow:2px 2px 4px #777777;
@import "client-custom/general";
@import "client-custom/zfix";
@import "../views/segments/preloader/PreloaderCircle/PreloaderCircle";
@import "../views/segments/posts_page/SimplePostList/SimplePostList";
@import "../views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar";

@ -2,11 +2,11 @@
<div class="{{gfx()['container']}}">
<dov class="row">
@if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-md-3 p-0">
<div class="col-lg-3 p-0">
@include('segments.post.PostSidebar.inc.sidebar')
</div>
@endif
<div class="col-md-9 p-0">
<div class="col-lg-9 p-0">
<div class="py-2 px-4">
<h1>
{{$post->title}}
@ -48,11 +48,11 @@
</div>
</div>
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-md-3 p-0">
@include('segments.post.PostSidebar.inc.sidebar')
</div>
@endif
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-0">
@include('segments.post.PostSidebar.inc.sidebar')
</div>
@endif
</dov>
</div>
</section>

@ -64,5 +64,10 @@
height: 1.2em;
overflow: hidden;
}
h6{
max-height: 2.2em;
overflow: hidden;
}
}
}

@ -0,0 +1,61 @@
<section class='SimplePostListSideBar'>
<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.SimplePostListSideBar.inc.sidebar')
</div>
@endif
<div class="col-lg-9">
@foreach($posts as $post)
<div class="post-list-item">
<img src="{{$post->imgUrl()}}" class="float-start me-4" alt="{{$post->title}}">
<h4>
{{$post->title}}
</h4>
<div class="text-muted py-2">
{{$post->created_at->ldate('Y/m/d l')}}
</div>
<p>
{{$post->subtitle}}
<br>
<a href="{{$post->webUrl()}}" class="btn btn-outline-primary my-2 btn-sm">
{{__("Read more")}}
</a>
</p>
</div>
@endforeach
{{$posts->links()}}
</div>
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-0">
@include('segments.posts_page.SimplePostListSideBar.inc.sidebar')
</div>
@endif
</div>
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "SimplePostListSideBar",
"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 SimplePostListSideBar
{
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,116 @@
.SimplePostListSideBar {
// scss
.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);
}
}
}
}
.post-list-item{
border-bottom: #44444433 1px solid;
margin-bottom: 1rem;
min-height: 200px;
img{
height: 175px;
border-radius: var(--xshop-border-radius);
}
}
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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Loading…
Cancel
Save