-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
226 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
resources/views/segments/posts/PostsSlider/PostsSlider.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
10
resources/views/segments/posts/PostsSlider/PostsSlider.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
55
resources/views/segments/posts/PostsSlider/PostsSlider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
67
resources/views/segments/posts/PostsSlider/PostsSlider.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.