mirror of https://github.com/4xmen/xshop.git
added grid category
parent
eb4147a65e
commit
4d5398e880
@ -0,0 +1,22 @@
|
||||
<section class='CategoriesGrid'>
|
||||
<div class="{{gfx()['container']}}">
|
||||
<h1>
|
||||
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
|
||||
</h1>
|
||||
<div class="row cat-grid-list">
|
||||
@foreach( getCategorySubCatsBySetting($data->area->name.'_'.$data->part.'_category',getSetting($data->area->name.'_'.$data->part.'_limit')) as $category )
|
||||
<div class="col-md p-0">
|
||||
<div class="cat-grid-item">
|
||||
<a href="{{$category->webUrl()}}">
|
||||
<img src="{{$category->imgUrl()}}" alt="{{$category->name}}"
|
||||
title="{{$category->name}}">
|
||||
<h3 class="py-3">
|
||||
{{$category->name}}
|
||||
</h3>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "CategoriesGrid",
|
||||
"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\Part;
|
||||
use App\Models\Setting;
|
||||
|
||||
class CategoriesGrid
|
||||
{
|
||||
public static function onAdd(Part $part = null)
|
||||
{
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_title';
|
||||
$setting->value = Category::first()->name;
|
||||
$setting->size = 4;
|
||||
$setting->type = 'TEXT';
|
||||
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
|
||||
$setting->title = $part->area->name . ' ' . $part->part. ' title';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_limit';
|
||||
$setting->value = '4';
|
||||
$setting->size = 4;
|
||||
$setting->type = 'NUMBER';
|
||||
$setting->data = json_encode(['xmin' => 2, 'xmax' => 6]);
|
||||
$setting->title = $part->area->name . ' ' . $part->part. ' count';
|
||||
$setting->save();
|
||||
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_category';
|
||||
$setting->value = Category::first()->id;
|
||||
$setting->size = 4;
|
||||
$setting->type = 'CATEGORY';
|
||||
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
|
||||
$setting->title = $part->area->name . ' ' . $part->part. ' category';
|
||||
$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.'_limit')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_category')->first()?->delete();
|
||||
}
|
||||
public static function onMount(Part $part = null)
|
||||
{
|
||||
return $part;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
.CategoriesGrid {
|
||||
padding: 3rem 0;
|
||||
h1{
|
||||
margin-bottom: 2rem;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.row{
|
||||
column-gap: 7px;
|
||||
}
|
||||
// scss
|
||||
.cat-grid-list{
|
||||
.cat-grid-item{
|
||||
border-radius: var(--xshop-border-radius);
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
box-shadow: var(--xshop-shadow);
|
||||
|
||||
h3{
|
||||
font-size: 22px;
|
||||
font-weight: 200;
|
||||
background: var(--xshop-primary);
|
||||
color: var(--xshop-diff);
|
||||
margin-bottom: 0;
|
||||
}
|
||||
img{
|
||||
height: 25vh;
|
||||
object-fit: cover;
|
||||
transition: 400ms;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&:hover{
|
||||
img{
|
||||
transform: scale(1.7);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 370 KiB |
Loading…
Reference in New Issue