added curve category theme part

master
A1Gard 7 days ago
parent 5cd729f4ce
commit 095d187bb2

@ -146,3 +146,7 @@ ul.pagination {
.accordion-button:not(.collapsed){ .accordion-button:not(.collapsed){
background: transparent; background: transparent;
} }
.btn-outline-light:hover{
color: black !important;
}

@ -0,0 +1,42 @@
<section id='CurveCategories'>
<div id="curve-cat-top">
</div>
<div>
{{-- class="{{gfx()['container']}}"--}}
<h1 class="text-center">
{{getSetting($part->area_name . '_' . $part->part.'_title')}}
</h1>
<div id="curve-slider-cat-container">
<div id="crc-nxt" class="sld-btn">
<i class="ri-arrow-right-line"></i>
</div>
<div id="crc-prv" class="sld-btn">
<i class="ri-arrow-left-line"></i>
</div>
<div id="curve-slider-cat">
@foreach(getCategorySubCatsBySetting($part->area_name . '_' . $part->part.'_category') as $cat)
<div class="item slider-content">
<div class="curve-cat-item">
<a href="{{$cat->webUrl()}}">
<img src="{{$cat->imgUrl()}}" alt="{{$cat->name}}">
<h4>
{{$cat->name}}
</h4>
</a>
</div>
</div>
@endforeach
</div>
</div>
</div>
<div id="curve-cat-bottom">
</div>
</section>

@ -0,0 +1,52 @@
import {tns} from "tiny-slider/src/tiny-slider";
var curveCatSlider ;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#curve-slider-cat')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
curveCatSlider = 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('#crc-nxt')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') === 'rtl'){
curveCatSlider.goTo('prev');
}else{
curveCatSlider.goTo('next');
}
});
document.querySelector('#crc-prv')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') !== 'rtl'){
curveCatSlider.goTo('prev');
}else{
curveCatSlider.goTo('next');
}
});
});

@ -0,0 +1,10 @@
{
"name": "CurveCategories",
"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,56 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Category;
use App\Models\Part;
use App\Models\Setting;
class CurveCategories
{
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.'_category';
$setting->value = Category::first()->id;
$setting->type = 'CATEGORY';
$setting->size = 4;
$setting->title = $part->area_name . ' ' . $part->part .' category';
$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-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.'_category')->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,171 @@
#CurveCategories {
position: relative;
background: var(--curve-slider-bg);
h1{
position: relative;
z-index: 33;
margin-bottom: 1rem;
font-size: 30px;
font-weight: 300;
}
#curve-cat-top, #curve-cat-bottom {
height: 10rem;
position: relative;
background: transparent;
overflow: hidden;
}
#curve-cat-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-cat-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-cat-container {
height: 35vh;
#curve-slider-cat{
//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-slider-bg) 20%, rgba(0, 0, 0, 0) 100%);
left: 0;
}
&:after {
background: linear-gradient(-90deg, var(--curve-slider-bg) 20%, rgba(0, 0, 0, 0) 100%);
right: 0;
}
.sld-btn,.tns-nav{
z-index: 70;
position: absolute;
top: 75%;
cursor: pointer;
i{
font-size: 35px;
}
}
#crc-nxt{
right:calc(50% - 100px);
transform: translateX(-50%);
}
#crc-prv{
left:calc(50% - 100px);
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-cat-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;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

@ -28,6 +28,7 @@
<a href="{{$product->webUrl()}}" class="btn btn-outline-light"> <a href="{{$product->webUrl()}}" class="btn btn-outline-light">
{{__("View product")}} {{__("View product")}}
&nbsp;
<i class="ri-arrow-right-circle-fill float-end"></i> <i class="ri-arrow-right-circle-fill float-end"></i>
</a> </a>
</div> </div>

@ -1,6 +1,6 @@
import {tns} from "tiny-slider/src/tiny-slider"; import {tns} from "tiny-slider/src/tiny-slider";
var author ; var samSlider ;
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#samira-slider')?.forEach(function (el) { document.querySelectorAll('#samira-slider')?.forEach(function (el) {
@ -8,7 +8,7 @@ document.addEventListener('DOMContentLoaded', () => {
console.log('ignore'); console.log('ignore');
return 'ignore'; return 'ignore';
} }
author = tns({ samSlider = tns({
container: el, container: el,
items: 1.5, items: 1.5,
// edgePadding: 50, // edgePadding: 50,
@ -26,16 +26,16 @@ document.addEventListener('DOMContentLoaded', () => {
document.querySelector('#sam-nxt')?.addEventListener('click',function () { document.querySelector('#sam-nxt')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') === 'rtl'){ if (document.documentElement.getAttribute('dir') === 'rtl'){
author.goTo('prev'); samSlider.goTo('prev');
}else{ }else{
author.goTo('next'); samSlider.goTo('next');
} }
}); });
document.querySelector('#sam-prv')?.addEventListener('click',function () { document.querySelector('#sam-prv')?.addEventListener('click',function () {
if (document.documentElement.getAttribute('dir') !== 'rtl'){ if (document.documentElement.getAttribute('dir') !== 'rtl'){
author.goTo('prev'); samSlider.goTo('prev');
}else{ }else{
author.goTo('next'); samSlider.goTo('next');
} }
}); });
}); });

Loading…
Cancel
Save