added author slider theme part

pull/49/head
A1Gard 3 months ago
parent 7f8f5f14aa
commit 6f0779b769

@ -0,0 +1,36 @@
<section class='AuthorSlider'>
<div class="{{gfx()['container']}}">
<h1>
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
</h1>
<div id="slider-author-container">
<div id="auth-nxt" class="sld-btn">
<i class="ri-arrow-right-line"></i>
</div>
<div id="auth-prv" class="sld-btn">
<i class="ri-arrow-left-line"></i>
</div>
<div id="author-slider">
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',10) as $post )
<div class="item slider-content">
<div class="author-slide">
<a href="{{$post->webUrl()}}">
<img src="{{$post->orgUrl()}}" class="float-end" alt=" {{$post->title}}">
<div class="contents">
<h3>
{{$post->title}}
</h3>
<p>
{{$post->subtitle}}
</p>
</div>
</a>
</div>
</div>
@endforeach
</div>
</div>
</div>
</section>

@ -0,0 +1,39 @@
import {tns} from "tiny-slider/src/tiny-slider";
var author ;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#author-slider')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
author = tns({
container: el,
autoplay: true,
autoplayButton: false,
// nextButton: false,
controls: false,
mouseDrag: true,
autoplayTimeout: 8000,
gutter: 10,
items: 1,
// speed:10000,
});
});
document.querySelector('#auth-nxt')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') === 'rtl'){
author.goTo('prev');
}else{
author.goTo('next');
}
});
document.querySelector('#auth-prv')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') !== 'rtl'){
author.goTo('prev');
}else{
author.goTo('next');
}
});
});

@ -0,0 +1,10 @@
{
"name": "AuthorSlider",
"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,63 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Group;
use App\Models\Part;
use App\Models\Setting;
class AuthorSlider
{
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()['secondary'];
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'author-slider-color']);
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part .' background color';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_color2';
$setting->value = gfx()['primary'];
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'author-slider-color2']);
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part .'content 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,55 @@
.AuthorSlider {
padding: 3rem 0;
background: var(--author-slider-color);
color: var(--xshop-diff);
#slider-author-container{
position: relative;
.item{
position: relative;
}
.sld-btn{
position: absolute;
top: 47%;
cursor: pointer;
i{
font-size: 35px;
}
}
#auth-nxt{
right: -45px;
}
#auth-prv{
left: -45px;
}
}
.author-slide{
img{
width: 400px;
height: 600px;
object-fit: cover;
border-radius: var(--xshop-border-radius);
}
.contents{
background: var(--author-slider-color2);
width: 65%;
inset-inline-end: 350px;
padding: 2rem;
position: absolute;
top: 35%;
border-radius: var(--xshop-border-radius);
h3,p{
color: var(--xshop-diff) !important;
margin-bottom: 1rem;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Loading…
Cancel
Save