Skip to content

Commit

Permalink
added theme part post slider
Browse files Browse the repository at this point in the history
  • Loading branch information
A1Gard committed Sep 9, 2024
1 parent 63c0216 commit 7f8f5f1
Show file tree
Hide file tree
Showing 9 changed files with 226 additions and 10 deletions.
22 changes: 14 additions & 8 deletions resources/sass/client-custom/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ body {
}


section {
max-width: 100%;
}

#website-preloader {
transition: 500ms;
}
Expand Down Expand Up @@ -129,26 +133,29 @@ body {
}


.tag-page{
.tag-page {

min-height: 60vh;
.tab-control{

.tab-control {
padding-left: 12px;
padding-right: 12px;
}
.tab-control a.active{

.tab-control a.active {
background: var(--xshop-primary);
color: var(--xshop-diff);
}
.tab-content{

.tab-content {
background: transparent;
}
}

.tab-content {
display: none;
padding: 1rem;
background: var(--karen-tab-bg-color,#ffffff);
background: var(--karen-tab-bg-color, #ffffff);

&.active {
display: block;
Expand All @@ -157,16 +164,15 @@ body {
}


.x64-img{
.x64-img {
width: 64px;
height: 64px;
object-fit: cover;
}



@media print {
.no-print{
.no-print {
display: none;
}
}
8 changes: 8 additions & 0 deletions resources/sass/client-custom/_zfix.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
}
}





.tns-inner{
overflow: hidden;
}

a, a:visited {
text-decoration: none;
color: var(--xshop-primary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public static function onAdd(Part $part = null)
$setting->key = $part->area->name . '_' . $part->part.'_jpg';
$setting->value = null;
$setting->type = 'FILE';
$setting->size = 6;
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part.' default image';
$setting->save();

File::copy(__DIR__.'/../../default-assets/bg.jpg',public_path('upload/images/').$part->area->name . '_' . $part->part.'.jpg');
File::copy(__DIR__.'/../../default-assets/bg.jpg',public_path('upload/images/').$part->area->name . '.' . $part->part.'.jpg');
}
public static function onRemove(Part $part = null)
{
Expand Down
27 changes: 27 additions & 0 deletions resources/views/segments/posts/PostsSlider/PostsSlider.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<section class='PostsSlider'>
<div class="{{gfx()['container']}}">
<h1>
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
</h1>

</div>
<div id="posts-slider-container">

<div id="posts-slider">

@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',10) as $post )
<div class="item slider-content">
<div class="post-slider">

<a href="{{$post->webUrl()}}">
<img src="{{$post->orgUrl()}}" alt=" {{$post->title}}">
<h3>
{{$post->title}}
</h3>
</a>
</div>
</div>
@endforeach
</div>
</div>
</section>
43 changes: 43 additions & 0 deletions resources/views/segments/posts/PostsSlider/PostsSlider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {tns} from "tiny-slider/src/tiny-slider";

var postsSlider ;

document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#posts-slider')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
postsSlider = tns({
container: el,
autoplay: true,
autoplayButton: false,
// nextButton: false,
controls: false,
mouseDrag: true,
autoplayTimeout: 5000,
gutter: 10,
responsive:{
560:{
items: 2,
edgePadding: 30,
},
768:{
items: 4,
edgePadding: 40,
},
1000:{
items: 5,
edgePadding: 50,
},
1400:{
items: 6,
edgePadding: 60,
},

},
// speed:10000,
});
});

});
10 changes: 10 additions & 0 deletions resources/views/segments/posts/PostsSlider/PostsSlider.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "PostsSlider",
"version": "1.0",
"author": "xStack",
"email": "[email protected]",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}
55 changes: 55 additions & 0 deletions resources/views/segments/posts/PostsSlider/PostsSlider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Resources\Views\Segments;

use App\Models\Group;
use App\Models\Part;
use App\Models\Setting;

class PostsSlider
{
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 = 12;
$setting->title = $part->area->name . ' ' . $part->part .' title';
$setting->save();

$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_group';
$setting->value = Group::first()->id;
$setting->size = 6;
$setting->type = 'GROUP';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' group';
$setting->save();



$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_color';
$setting->value = gfx()['primary'];
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'post-slider-color']);
$setting->size = 6;
$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.'_group')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_color')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}
67 changes: 67 additions & 0 deletions resources/views/segments/posts/PostsSlider/PostsSlider.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.PostsSlider {
// scss
padding: 3rem 0;
background: var(--post-slider-color);
color: var(--xshop-diff);

h1{
font-size: 30px;
font-weight: 300;
margin-bottom: 2rem;
}

#posts-slider-container{
position: relative;
&:before,&:after{
content: ' ';
top: 0;
bottom: 0;
width: 20%;
position: absolute;
z-index: 9;
}

&:before{
left: 0;
background: linear-gradient(90deg, var(--post-slider-color) 20%, rgba(0,0,0,0) 100%);

}
&:after{
right: 0;
background: linear-gradient(-90deg, var(--post-slider-color) 20%, rgba(0,0,0,0) 100%);

}
}
.post-slider{
border-radius: var(--xshop-border-radius);
position: relative;
img{
width: 100%;
height: 35vh;
border-radius: var(--xshop-border-radius);
object-fit: cover;
}

h3{
position: absolute;
bottom: 0;
right: 0;
left: 0;
font-size: 17px;
text-align: center;
color: transparent;
padding: 1rem 0;
transition: 400ms;
margin-bottom: 0;
font-weight: 400;
}

&:hover{
h3{
color: white;
background: #00000077;
}
}

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7f8f5f1

Please sign in to comment.