-
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
6 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
resources/views/segments/index/AuthorSlider/AuthorSlider.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,36 @@ | ||
<section class='AuthorSlider'> | ||
<div class="{{gfx()['container']}}"> | ||
<h1> | ||
{{getSetting($data->area->name.'_'.$data->part.'_title')}} | ||
</h1> | ||
<div id="slider-author-container"> | ||
<div id="auth-nxt" class="sld-btn"> | ||
<i class="ri-arrow-right-line"></i> | ||
</div> | ||
<div id="auth-prv" class="sld-btn"> | ||
<i class="ri-arrow-left-line"></i> | ||
</div> | ||
<div id="author-slider"> | ||
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',10) as $post ) | ||
<div class="item slider-content"> | ||
<div class="author-slide"> | ||
|
||
<a href="{{$post->webUrl()}}"> | ||
<img src="{{$post->orgUrl()}}" class="float-end" alt=" {{$post->title}}"> | ||
<div class="contents"> | ||
|
||
<h3> | ||
{{$post->title}} | ||
</h3> | ||
<p> | ||
{{$post->subtitle}} | ||
</p> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
@endforeach | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
39 changes: 39 additions & 0 deletions
39
resources/views/segments/index/AuthorSlider/AuthorSlider.js
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,39 @@ | ||
import {tns} from "tiny-slider/src/tiny-slider"; | ||
|
||
var author ; | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
document.querySelectorAll('#author-slider')?.forEach(function (el) { | ||
if (el.classList.contains('.tns-slider')){ | ||
console.log('ignore'); | ||
return 'ignore'; | ||
} | ||
author = tns({ | ||
container: el, | ||
autoplay: true, | ||
autoplayButton: false, | ||
// nextButton: false, | ||
controls: false, | ||
mouseDrag: true, | ||
autoplayTimeout: 8000, | ||
gutter: 10, | ||
items: 1, | ||
// speed:10000, | ||
}); | ||
}); | ||
|
||
document.querySelector('#auth-nxt')?.addEventListener('click',function () { | ||
if (document.documentElement.getAttribute('dir') === 'rtl'){ | ||
author.goTo('prev'); | ||
}else{ | ||
author.goTo('next'); | ||
} | ||
}); | ||
document.querySelector('#auth-prv')?.addEventListener('click',function () { | ||
if (document.documentElement.getAttribute('dir') !== 'rtl'){ | ||
author.goTo('prev'); | ||
}else{ | ||
author.goTo('next'); | ||
} | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
resources/views/segments/index/AuthorSlider/AuthorSlider.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": "AuthorSlider", | ||
"version": "1.0", | ||
"author": "xStack", | ||
"email": "[email protected]", | ||
"license": "GPL-3.0-or-later", | ||
"url": "https:\/\/xstack.ir", | ||
"author_url": "https:\/\/4xmen.ir", | ||
"packages": [] | ||
} |
63 changes: 63 additions & 0 deletions
63
resources/views/segments/index/AuthorSlider/AuthorSlider.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,63 @@ | ||
<?php | ||
|
||
namespace Resources\Views\Segments; | ||
|
||
use App\Models\Group; | ||
use App\Models\Part; | ||
use App\Models\Setting; | ||
|
||
class AuthorSlider | ||
{ | ||
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()['secondary']; | ||
$setting->type = 'COLOR'; | ||
$setting->data = json_encode(['name' => 'author-slider-color']); | ||
$setting->size = 6; | ||
$setting->title = $part->area->name . ' ' . $part->part .' background color'; | ||
$setting->save(); | ||
$setting = new Setting(); | ||
$setting->section = 'theme'; | ||
$setting->key = $part->area->name . '_' . $part->part.'_color2'; | ||
$setting->value = gfx()['primary']; | ||
$setting->type = 'COLOR'; | ||
$setting->data = json_encode(['name' => 'author-slider-color2']); | ||
$setting->size = 6; | ||
$setting->title = $part->area->name . ' ' . $part->part .'content 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; | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
resources/views/segments/index/AuthorSlider/AuthorSlider.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,55 @@ | ||
.AuthorSlider { | ||
padding: 3rem 0; | ||
background: var(--author-slider-color); | ||
color: var(--xshop-diff); | ||
|
||
#slider-author-container{ | ||
position: relative; | ||
.item{ | ||
position: relative; | ||
} | ||
|
||
.sld-btn{ | ||
position: absolute; | ||
top: 47%; | ||
cursor: pointer; | ||
i{ | ||
font-size: 35px; | ||
} | ||
} | ||
|
||
#auth-nxt{ | ||
right: -45px; | ||
} | ||
#auth-prv{ | ||
left: -45px; | ||
} | ||
|
||
} | ||
.author-slide{ | ||
|
||
img{ | ||
width: 400px; | ||
height: 600px; | ||
object-fit: cover; | ||
border-radius: var(--xshop-border-radius); | ||
} | ||
|
||
.contents{ | ||
background: var(--author-slider-color2); | ||
width: 65%; | ||
inset-inline-end: 350px; | ||
padding: 2rem; | ||
|
||
|
||
|
||
position: absolute; | ||
top: 35%; | ||
border-radius: var(--xshop-border-radius); | ||
h3,p{ | ||
color: var(--xshop-diff) !important; | ||
margin-bottom: 1rem; | ||
} | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.