added parallax short theme part

pull/44/head
A1Gard 6 months ago
parent 8c544652fe
commit feb51a2781

@ -0,0 +1,10 @@
<section class='ParallaxShort' style="background-image: url('{{asset('upload/images/'.$data->area->name.'.'.$data->part.'.jpg')}}')">
<div class="{{gfx()['container']}} pt-5">
<h1 class="pt-5">
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
</h1>
<h2>
{{getSetting($data->area->name.'_'.$data->part.'_subtitle')}}
</h2>
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "ParallaxShort",
"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,54 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
use Illuminate\Support\Facades\File;
class ParallaxShort
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_jpg';
$setting->value = null;
$setting->type = 'FILE';
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part.' Image';
$setting->save();
File::copy(__DIR__.'/assets/bg.jpg',public_path('upload/images/').$part->area->name . '.' . $part->part.'.jpg');
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_title';
$setting->value = 'Title of the parallax';
$setting->type = 'TEXT';
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part .' title';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_subtitle';
$setting->value = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis dolor enim reprehenderit.';
$setting->type = 'TEXT';
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part .' subtitle';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_jpg')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_title')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_subtitle')->first()?->delete();
File::delete(public_path('upload/images/').$part->area->name . '.' . $part->part.'.jpg');
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,7 @@
.ParallaxShort {
// scss
background-size: cover;
background-attachment: fixed;
height: 350px;
color: invert($xshop-text);
}
Loading…
Cancel
Save