add curve posts slider theme part

fixed bug curve cat theme part
master
A1Gard 2 weeks ago
parent c29eaec1c9
commit b30901a9bc

@ -100,11 +100,11 @@
} }
#crc-nxt{ #crc-nxt{
right:calc(50% - 100px); right:calc(50% - 120px);
transform: translateX(-50%); transform: translateX(-50%);
} }
#crc-prv{ #crc-prv{
left:calc(50% - 100px); left:calc(50% - 120px);
transform: translateX(50%); transform: translateX(50%);
} }

@ -0,0 +1,47 @@
<section id='CurvePosts' class=' live-setting' data-live="{{$data->area_name.'_'.$data->part}}">
<div id="curve-post-top">
</div>
<div>
<h1 class="text-center">
{{getSetting($part->area_name . '_' . $part->part.'_title')}}
</h1>
<div id="curve-slider-post-container">
<a href="{{getGroupBySetting($part->area_name . '_' . $part->part.'_group')->webUrl()}}" id="curve-all-posts" data-bs-custom-class="custom-tooltip"
data-bs-toggle="tooltip" data-bs-placement="auto"
title="{{__("Find more")}}">
<i class="ri-folder-open-line"></i>
</a>
<div id="crp-nxt" class="sld-btn">
<i class="ri-arrow-right-line"></i>
</div>
<div id="crp-prv" class="sld-btn">
<i class="ri-arrow-left-line"></i>
</div>
<div id="curve-slider-post">
@foreach(getGroupPostsBySetting($part->area_name . '_' . $part->part.'_group',12) as $post)
<div class="item slider-content">
<div class="curve-post-item">
<a href="{{$post->webUrl()}}">
<img src="{{$post->imgUrl()}}" alt="{{$post->title}}">
<h4>
{{$post->title}}
</h4>
</a>
</div>
</div>
@endforeach
</div>
</div>
</div>
<div id="curve-post-bottom">
</div>
</section>

@ -0,0 +1,52 @@
import {tns} from "tiny-slider/src/tiny-slider";
var curvePostSlider ;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#curve-slider-post')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
curvePostSlider = tns({
container: el,
responsive:{
560:{
items: 1.5,
},
1000:{
items: 3.5,
},
1400:{
items: 5.5,
},
},
// edgePadding: 50,
autoplay: true,
autoplayButton: false,
mouseDrag: true,
prevButton: false,
nextButton: false,
autoplayTimeout: 8000,
center: true,
nav: true,
loop:true,
});
});
//
document.querySelector('#crp-nxt')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') === 'rtl'){
curvePostSlider.goTo('prev');
}else{
curvePostSlider.goTo('next');
}
});
document.querySelector('#crp-prv')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') !== 'rtl'){
curvePostSlider.goTo('prev');
}else{
curvePostSlider.goTo('next');
}
});
});

@ -0,0 +1,10 @@
{
"name": "CurvePosts",
"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\Category;
use App\Models\Group;
use App\Models\Part;
use App\Models\Setting;
class CurvePosts
{
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 = 4;
$setting->title = $part->area_name . ' ' . $part->part .' titles';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_group';
$setting->value = Group::first()->id;
$setting->type = 'GROUP';
$setting->size = 4;
$setting->title = $part->area_name . ' ' . $part->part .' group';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_bg';
$setting->value = gfx()['secondary'];
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'curve-posts-slider-bg']);
$setting->size = 4;
$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.'bg')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,193 @@
#CurvePosts {
position: relative;
background: var(--curve-posts-slider-bg);
h1{
position: relative;
z-index: 33;
margin-bottom: 1rem;
font-size: 30px;
font-weight: 300;
}
#curve-post-top, #curve-post-bottom {
height: 10rem;
position: relative;
background: transparent;
overflow: hidden;
}
#curve-post-top {
margin-bottom: -4.5rem;
z-index: 15;
&:before {
content: " ";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 700%;
background: var(--xshop-background);
border-radius: 50%;
transform: scaleX(1.75);
}
}
#curve-post-bottom {
margin-top: -2.5rem;
z-index: 10;
&:before {
content: " ";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 700%;
background: var(--xshop-background);
border-radius: 50%;
transform: scaleX(1.75);
}
}
#curve-slider-post-container {
height: 35vh;
#curve-slider-post{
//width: 100vw;
//left: 0;
//right: 0;
}
.slider-content {
transform: translateX(25%);
}
&:before, &:after {
content: ' ';
position: absolute;
top: 0;
bottom: 0;
width: 45%;
z-index: 9;
pointer-events: none;
}
&:before {
background: linear-gradient(90deg, var(--curve-posts-slider-bg) 20%, rgba(0, 0, 0, 0) 100%);
left: 0;
}
&:after {
background: linear-gradient(-90deg, var(--curve-posts-slider-bg) 20%, rgba(0, 0, 0, 0) 100%);
right: 0;
}
.sld-btn,.tns-nav{
z-index: 90;
position: absolute;
top: 75%;
cursor: pointer;
i{
font-size: 35px;
}
}
#crp-nxt{
right:calc(50% - 120px);
transform: translateX(-50%);
}
#crp-prv{
left:calc(50% - 120px);
transform: translateX(50%);
}
.tns-nav{
display: flex !important;
width: 150px;
left:calc(50% - 75px);
height: 50px;
align-items: center;
justify-content: space-evenly;
button{
display: inline-block;
margin: 3px;
width: 10px;
height: 10px;
border-radius: var(--xshop-border-radius);
background: #00000044;
border: 0;
}
.tns-nav-active{
background: var(--xshop-primary);
}
}
}
.curve-post-item {
height: 35vh;
position: relative;
img {
height: 100%;
width: 100%;
object-fit: cover;
}
h4{
position: absolute;
bottom: 45%;
left: 0;
right: 0;
width: 100%;
text-align: center;
z-index: 33;
background: var(--xshop-background);
padding: .5rem;
transition: 300ms;
font-weight: 400;
opacity: 0;
}
&:hover{
h4{
opacity: 1;
}
}
}
#curve-all-posts{
background: #ffffff;
color: black;
position: absolute;
right: 30%;
top: 175px;
z-index: 98;
width: 45px;
height: 45px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
opacity: .35;
&:hover{
opacity: 1;
}
i{
font-size: 30px;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Loading…
Cancel
Save