@@ -3,52 +3,90 @@
|
||||
$compareCount = count((array) session('compare', []));
|
||||
$cartCount = collect((array) session('cart', []))->sum(fn ($quantity) => (int) $quantity);
|
||||
$companyName = config('shop.company_name', config('app.name'));
|
||||
$supportedLocales = (array) config('app.supported_locales', []);
|
||||
$currentLocale = app()->getLocale();
|
||||
$currentLocaleData = $supportedLocales[$currentLocale] ?? $supportedLocales[config('app.locale', 'ru')] ?? [
|
||||
'native' => 'Русский',
|
||||
'short' => 'Рус',
|
||||
'flag' => '🇷🇺',
|
||||
];
|
||||
$navItems = [
|
||||
['label' => 'Главная', 'route' => route('home'), 'active' => request()->routeIs('home')],
|
||||
['label' => __('Главная'), 'route' => route('home'), 'active' => request()->routeIs('home')],
|
||||
[
|
||||
'label' => 'Каталог',
|
||||
'label' => __('Каталог'),
|
||||
'route' => route('catalog.index'),
|
||||
'active' => request()->routeIs('catalog.*') || request()->routeIs('products.show') || request()->routeIs('search.index'),
|
||||
],
|
||||
['label' => 'О нас', 'route' => route('pages.about'), 'active' => request()->routeIs('pages.about')],
|
||||
['label' => __('О нас'), 'route' => route('pages.about'), 'active' => request()->routeIs('pages.about')],
|
||||
[
|
||||
'label' => 'Доставка и оплата',
|
||||
'label' => __('Доставка и оплата'),
|
||||
'route' => route('pages.shipping-payment'),
|
||||
'active' => request()->routeIs('pages.shipping-payment'),
|
||||
],
|
||||
['label' => 'Контакты', 'route' => route('pages.contacts'), 'active' => request()->routeIs('pages.contacts')],
|
||||
['label' => __('Контакты'), 'route' => route('pages.contacts'), 'active' => request()->routeIs('pages.contacts')],
|
||||
];
|
||||
@endphp
|
||||
|
||||
<header class="pc-header pc-animate" style="--delay: 0s">
|
||||
<input type="checkbox" id="pc-mobile-menu-toggle" class="pc-mobile-menu-toggle">
|
||||
<label for="pc-mobile-menu-toggle" class="pc-hamburger" aria-label="Меню">
|
||||
<label for="pc-mobile-menu-toggle" class="pc-hamburger" aria-label="{{ __('Меню') }}">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</label>
|
||||
<div class="pc-mobile-menu-head">
|
||||
<label for="pc-mobile-menu-toggle" class="pc-mobile-menu-close" aria-label="Закрыть меню">×</label>
|
||||
<label for="pc-mobile-menu-toggle" class="pc-mobile-menu-close" aria-label="{{ __('Закрыть меню') }}">×</label>
|
||||
</div>
|
||||
<div class="pc-header-left">
|
||||
<a class="pc-logo" href="{{ route('home') }}">
|
||||
<span class="pc-logo-mark"></span>
|
||||
{{ $companyName }}
|
||||
</a>
|
||||
<a class="pc-btn pc-catalog-btn" href="{{ route('catalog.index') }}">Каталог</a>
|
||||
<a class="pc-btn pc-catalog-btn" href="{{ route('catalog.index') }}">{{ __('Каталог') }}</a>
|
||||
</div>
|
||||
<div class="pc-header-center">
|
||||
<form class="pc-search" action="{{ route('search.index') }}" method="get">
|
||||
<input type="text" name="q" placeholder="Поиск товаров по наименованию" value="{{ request('q') }}" />
|
||||
<button class="pc-search-submit" type="submit" aria-label="Искать">
|
||||
<input type="text" name="q" placeholder="{{ __('Поиск товаров по наименованию') }}" value="{{ request('q') }}" />
|
||||
<button class="pc-search-submit" type="submit" aria-label="{{ __('Искать') }}">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M15.5 14h-.79l-.28-.27a6 6 0 1 0-.71.71l.27.28v.79L20 20.5 21.5 19 15.5 14zm-5.5 0A4.5 4.5 0 1 1 10 5a4.5 4.5 0 0 1 0 9z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="pc-header-tools">
|
||||
<details class="pc-lang-switcher" data-locale-switcher>
|
||||
<summary class="pc-lang-switcher-trigger" aria-label="{{ __('Выбор языка') }}">
|
||||
<span class="pc-lang-switcher-current">
|
||||
<span class="pc-lang-switcher-flag" aria-hidden="true">{{ $currentLocaleData['flag'] ?? '🌐' }}</span>
|
||||
<span class="pc-lang-switcher-label">{{ $currentLocaleData['short'] ?? strtoupper($currentLocale) }}</span>
|
||||
</span>
|
||||
<span class="pc-lang-switcher-chevron" aria-hidden="true">
|
||||
<svg viewBox="0 0 20 20">
|
||||
<path d="M5.3 7.8a1 1 0 0 1 1.4 0L10 11l3.3-3.2a1 1 0 1 1 1.4 1.4l-4 3.9a1 1 0 0 1-1.4 0l-4-3.9a1 1 0 0 1 0-1.4z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="pc-lang-switcher-menu">
|
||||
@foreach ($supportedLocales as $locale => $localeData)
|
||||
<form method="post" action="{{ route('locale.switch', $locale) }}" data-preserve-scroll="true">
|
||||
@csrf
|
||||
<button class="pc-lang-switcher-option {{ $locale === $currentLocale ? 'is-active' : '' }}" type="submit" @disabled($locale === $currentLocale)>
|
||||
<span class="pc-lang-switcher-option-main">
|
||||
<span class="pc-lang-switcher-flag" aria-hidden="true">{{ $localeData['flag'] ?? '🌐' }}</span>
|
||||
<span>{{ $localeData['native'] ?? strtoupper($locale) }}</span>
|
||||
</span>
|
||||
@if ($locale === $currentLocale)
|
||||
<span class="pc-lang-switcher-check" aria-hidden="true">•</span>
|
||||
@endif
|
||||
</button>
|
||||
</form>
|
||||
@endforeach
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div class="pc-header-icons">
|
||||
<a class="pc-icon-link" href="{{ route('favorites.index') }}" aria-label="Избранное">
|
||||
<a class="pc-icon-link" href="{{ route('favorites.index') }}" aria-label="{{ __('Избранное') }}">
|
||||
<span class="pc-icon">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M12 20s-7-4.5-9-9c-1.2-2.7.7-6 4.2-6 2 0 3.2 1 3.8 2 0.6-1 1.8-2 3.8-2 3.5 0 5.4 3.3 4.2 6-2 4.5-9 9-9 9z"></path>
|
||||
@@ -57,9 +95,9 @@
|
||||
<span class="pc-icon-count">{{ $favoritesCount }}</span>
|
||||
@endif
|
||||
</span>
|
||||
<span class="pc-icon-label">Избранное</span>
|
||||
<span class="pc-icon-label">{{ __('Избранное') }}</span>
|
||||
</a>
|
||||
<a class="pc-icon-link" href="{{ route('compare.index') }}" aria-label="Сравнение">
|
||||
<a class="pc-icon-link" href="{{ route('compare.index') }}" aria-label="{{ __('Сравнение') }}">
|
||||
<span class="pc-icon">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M5 4h3v16H5zM16 4h3v16h-3zM10.5 8h3v12h-3z"></path>
|
||||
@@ -68,9 +106,9 @@
|
||||
<span class="pc-icon-count">{{ $compareCount }}</span>
|
||||
@endif
|
||||
</span>
|
||||
<span class="pc-icon-label">Сравнение</span>
|
||||
<span class="pc-icon-label">{{ __('Сравнение') }}</span>
|
||||
</a>
|
||||
<a class="pc-icon-link" href="{{ route('cart.index') }}" aria-label="Корзина">
|
||||
<a class="pc-icon-link" href="{{ route('cart.index') }}" aria-label="{{ __('Корзина') }}">
|
||||
<span class="pc-icon">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M6 6h14l-2 9H8L6 6zm-2-2h3l1 2h-4zM9 20a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm8 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"></path>
|
||||
@@ -79,18 +117,18 @@
|
||||
<span class="pc-icon-count">{{ $cartCount }}</span>
|
||||
@endif
|
||||
</span>
|
||||
<span class="pc-icon-label">Корзина</span>
|
||||
<span class="pc-icon-label">{{ __('Корзина') }}</span>
|
||||
</a>
|
||||
<a class="pc-icon-link" href="{{ auth()->check() ? route('account') : route('login') }}" aria-label="Личный кабинет">
|
||||
<a class="pc-icon-link" href="{{ auth()->check() ? route('account') : route('login') }}" aria-label="{{ __('Личный кабинет') }}">
|
||||
<span class="pc-icon">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true">
|
||||
<path d="M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4.4 0-8 2.2-8 5v1h16v-1c0-2.8-3.6-5-8-5z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="pc-icon-label">{{ auth()->check() ? 'Кабинет' : 'Войти' }}</span>
|
||||
<span class="pc-icon-label">{{ auth()->check() ? __('Кабинет') : __('Войти') }}</span>
|
||||
</a>
|
||||
</div>
|
||||
<nav class="pc-header-nav" aria-label="Разделы сайта">
|
||||
<nav class="pc-header-nav" aria-label="{{ __('Разделы сайта') }}">
|
||||
@foreach ($navItems as $item)
|
||||
<a class="pc-header-nav-link {{ $item['active'] ? 'is-active' : '' }}" href="{{ $item['route'] }}">
|
||||
{{ $item['label'] }}
|
||||
|
||||
Reference in New Issue
Block a user