added theme part post slider

pull/49/head
A1Gard 2 months ago
parent 63c021658e
commit 7f8f5f14aa

@ -33,6 +33,10 @@ body {
}
section {
max-width: 100%;
}
#website-preloader {
transition: 500ms;
}
@ -129,18 +133,21 @@ body {
}
.tag-page{
.tag-page {
min-height: 60vh;
.tab-control{
.tab-control {
padding-left: 12px;
padding-right: 12px;
}
.tab-control a.active{
.tab-control a.active {
background: var(--xshop-primary);
color: var(--xshop-diff);
}
.tab-content{
.tab-content {
background: transparent;
}
}
@ -148,7 +155,7 @@ body {
.tab-content {
display: none;
padding: 1rem;
background: var(--karen-tab-bg-color,#ffffff);
background: var(--karen-tab-bg-color, #ffffff);
&.active {
display: block;
@ -157,16 +164,15 @@ body {
}
.x64-img{
.x64-img {
width: 64px;
height: 64px;
object-fit: cover;
}
@media print {
.no-print{
.no-print {
display: none;
}
}

@ -14,6 +14,14 @@
}
}
.tns-inner{
overflow: hidden;
}
a, a:visited {
text-decoration: none;
color: var(--xshop-primary);

@ -16,11 +16,11 @@ class ParallaxHeader
$setting->key = $part->area->name . '_' . $part->part.'_jpg';
$setting->value = null;
$setting->type = 'FILE';
$setting->size = 6;
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part.' default image';
$setting->save();
File::copy(__DIR__.'/../../default-assets/bg.jpg',public_path('upload/images/').$part->area->name . '_' . $part->part.'.jpg');
File::copy(__DIR__.'/../../default-assets/bg.jpg',public_path('upload/images/').$part->area->name . '.' . $part->part.'.jpg');
}
public static function onRemove(Part $part = null)
{

@ -0,0 +1,27 @@
<section class='PostsSlider'>
<div class="{{gfx()['container']}}">
<h1>
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
</h1>
</div>
<div id="posts-slider-container">
<div id="posts-slider">
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',10) as $post )
<div class="item slider-content">
<div class="post-slider">
<a href="{{$post->webUrl()}}">
<img src="{{$post->orgUrl()}}" alt=" {{$post->title}}">
<h3>
{{$post->title}}
</h3>
</a>
</div>
</div>
@endforeach
</div>
</div>
</section>

@ -0,0 +1,43 @@
import {tns} from "tiny-slider/src/tiny-slider";
var postsSlider ;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#posts-slider')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
postsSlider = tns({
container: el,
autoplay: true,
autoplayButton: false,
// nextButton: false,
controls: false,
mouseDrag: true,
autoplayTimeout: 5000,
gutter: 10,
responsive:{
560:{
items: 2,
edgePadding: 30,
},
768:{
items: 4,
edgePadding: 40,
},
1000:{
items: 5,
edgePadding: 50,
},
1400:{
items: 6,
edgePadding: 60,
},
},
// speed:10000,
});
});
});

@ -0,0 +1,10 @@
{
"name": "PostsSlider",
"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,55 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Group;
use App\Models\Part;
use App\Models\Setting;
class PostsSlider
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_title';
$setting->value = 'Lorem ipsum dolor sit amet';
$setting->type = 'TEXT';
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part .' title';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_group';
$setting->value = Group::first()->id;
$setting->size = 6;
$setting->type = 'GROUP';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' group';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_color';
$setting->value = gfx()['primary'];
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'post-slider-color']);
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part .' background color';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_title')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_group')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_color')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,67 @@
.PostsSlider {
// scss
padding: 3rem 0;
background: var(--post-slider-color);
color: var(--xshop-diff);
h1{
font-size: 30px;
font-weight: 300;
margin-bottom: 2rem;
}
#posts-slider-container{
position: relative;
&:before,&:after{
content: ' ';
top: 0;
bottom: 0;
width: 20%;
position: absolute;
z-index: 9;
}
&:before{
left: 0;
background: linear-gradient(90deg, var(--post-slider-color) 20%, rgba(0,0,0,0) 100%);
}
&:after{
right: 0;
background: linear-gradient(-90deg, var(--post-slider-color) 20%, rgba(0,0,0,0) 100%);
}
}
.post-slider{
border-radius: var(--xshop-border-radius);
position: relative;
img{
width: 100%;
height: 35vh;
border-radius: var(--xshop-border-radius);
object-fit: cover;
}
h3{
position: absolute;
bottom: 0;
right: 0;
left: 0;
font-size: 17px;
text-align: center;
color: transparent;
padding: 1rem 0;
transition: 400ms;
margin-bottom: 0;
font-weight: 400;
}
&:hover{
h3{
color: white;
background: #00000077;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

Loading…
Cancel
Save