added parallel categories grid theme part

pull/49/head
A1Gard 1 month ago
parent cd294fc596
commit 7bd3fae3f5

@ -108,4 +108,8 @@ class Category extends Model
->where('evaluationable_id',$this->id); ->where('evaluationable_id',$this->id);
})->get(); })->get();
} }
public function parallelCategories($limit = 10){
return Category::where('parent_id' , $this->parent_id)->where('id','<>',$this->id)->limit($limit)->get();
}
} }

@ -0,0 +1,23 @@
<section class='ParallelCategoriesGrid'>
<div class="{{gfx()['container']}}">
@if(count($category->parallelCategories()) > 0)
<div>
<h3>
{{getSetting($data->area_name.'_'.$data->part.'_title')}}
</h3>
<div class="row">
@foreach($category->parallelCategories() as $subCat)
<div class="col-md">
<div class="parallel-category">
<img src="{{$subCat->imgUrl()}}" alt="{{$subCat->name}}" class="img-fluid" loading="lazy">
<h4>
{{$subCat->name}}
</h4>
</div>
</div>
@endforeach
</div>
</div>
@endif
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "ParallelCategoriesGrid",
"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,31 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
class ParallelCategoriesGrid
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_title';
$setting->value = 'Main categories';
$setting->type = 'TEXT';
$setting->size = 4;
$setting->title = $part->area_name . ' ' . $part->part .' parallel categories title';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area_name . '_' . $part->part.'_title')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,50 @@
.ParallelCategoriesGrid {
padding-top: 1rem;
padding-bottom: 1rem;
.row{
[class^="col-md"]{
padding: 2px;
}
}
.parallel-category{
height: 300px;
width: 100%;
position: relative;
overflow: hidden;
border-radius: var(--xshop-border-radius);
img{
position: absolute;
height: 300px;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
object-fit: cover;
transition: 400ms;
}
h4{
z-index: 3;
position: absolute;
left: 0;
right: 0;
bottom: 0;
text-align: center;
background: #ffffff33;
backdrop-filter: blur(4px);
margin: 0;
padding: 1rem;
transition: 400ms;
}
&:hover{
h4{
background: #ffffff88;
}
img{
transform: scale(1.3) rotateZ(15deg);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Loading…
Cancel
Save