added go to top theme part

added background color to compare
pull/49/head
A1Gard 4 months ago
parent 7051a0e40b
commit c6ade855d2

@ -19,7 +19,11 @@
}
*{
font-family: 'Vazirmatn' , Sans-Serif;
font-family: 'Vazirmatn' , sans-serif;
}
html {
scroll-behavior: smooth;
}
body{

@ -3,15 +3,26 @@
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
class CompareProducts
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_color';
$setting->value = '#ffffff';
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'compare-bg']);
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part .' main color';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_color')->first()?->delete();
}
public static function onMount(Part $part = null)

@ -7,7 +7,7 @@
}
.compare{
background: #ffffff;
background: var(--compare-bg);
border-radius: var(--xshop-border-radius);
h2{
font-weight: 300;

@ -0,0 +1,3 @@
<a id='SimpleGoTop' href="#">
<i class="{{getSetting($data->area->name.'_'.$data->part.'_icon')}}"></i>
</a>

@ -0,0 +1,8 @@
const scrollBreakpoint = window.innerHeight * 0.2;
window.addEventListener('scroll',function () {
if (window.scrollY > scrollBreakpoint){
document.querySelector('#SimpleGoTop').classList.add('show')
}else{
document.querySelector('#SimpleGoTop').classList.remove('show')
}
});

@ -0,0 +1,10 @@
{
"name": "SimpleGoTop",
"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 SimpleGoTop
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_icon';
$setting->value = 'ri-arrow-up-line';
$setting->size = 12;
$setting->type = 'ICON';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 6]);
$setting->title = $part->area->name . ' ' . $part->part. ' icon ';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_icon')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,24 @@
#SimpleGoTop {
position: fixed;
bottom: 1rem;
inset-inline-start: -100px;
z-index: 999;
background: var(--xshop-primary);
width: 50px;
border-radius: var(--xshop-border-radius);
text-align: center;
opacity: .5;
transition: 400ms;
i{
color: var(--xshop-diff);
font-size: 35px;
}
&:hover{
opacity: 1;
}
&.show{
inset-inline-start: 1rem;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -30,4 +30,7 @@
@endif
</div>
<div id="app">
@foreach(getParts('floats') as $part)
@php($p = $part->getBladeWithData())
@include($p['blade'],['data' => $p['data']])
@endforeach

Loading…
Cancel
Save