Files
tehnobox/resources/views/partials/home-slider.blade.php
ssww23 93a655235a
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit
2026-03-10 00:55:37 +03:00

50 lines
2.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@php
$slides = $slides ?? collect();
$isSingle = $slides->count() <= 1;
@endphp
<div class="pc-home-slider {{ $sliderClass ?? '' }}" data-home-slider>
<div class="pc-home-slider-track">
@forelse ($slides as $slide)
@php
$hasTitle = $slide->show_title && !empty($slide->title);
$hasSubtitle = $slide->show_subtitle && !empty($slide->subtitle);
$hasButton = $slide->show_button && !empty($slide->button_text) && !empty($slide->button_url);
$hasContent = $hasTitle || $hasSubtitle || $hasButton;
$altText = $hasTitle ? $slide->title : 'Слайд на главной странице';
@endphp
<article class="pc-home-slide {{ $loop->first ? 'is-active' : '' }}" data-home-slide>
<img src="{{ $slide->image_url }}" alt="{{ $altText }}" loading="{{ $loop->first ? 'eager' : 'lazy' }}">
<div class="pc-home-slide-overlay"></div>
@if ($hasContent)
<div class="pc-home-slide-content">
@if ($hasTitle)
<h2>{{ $slide->title }}</h2>
@endif
@if ($hasSubtitle)
<p>{{ $slide->subtitle }}</p>
@endif
@if ($hasButton)
<a class="pc-btn primary" href="{{ $slide->button_url }}">{{ $slide->button_text }}</a>
@endif
</div>
@endif
</article>
@empty
<article class="pc-home-slide is-active is-fallback" data-home-slide>
<div class="pc-home-slide-overlay"></div>
<div class="pc-home-slide-content">
<h2>{{ $fallbackTitle ?? 'Собирайте ПК быстрее' }}</h2>
<p>{{ $fallbackText ?? 'Загрузите баннеры в админке, чтобы вывести акции и подборки товаров на главной странице.' }}</p>
@if (!empty($fallbackUrl))
<a class="pc-btn primary" href="{{ $fallbackUrl }}">{{ $fallbackButton ?? 'Открыть каталог' }}</a>
@endif
</div>
</article>
@endforelse
</div>
<button class="pc-home-slider-btn is-prev" type="button" data-home-slider-prev aria-label="Предыдущий слайд" @disabled($isSingle)></button>
<button class="pc-home-slider-btn is-next" type="button" data-home-slider-next aria-label="Следующий слайд" @disabled($isSingle)></button>
</div>