responsive design

This commit is contained in:
elvira committed 2026-10-24 00:20:57 +03:00
1 parent 9217960de0
commit 0ae5f49bcf
23 files changed
+380 -157

No files matched your search

+103 -11
View File
@@ -1,13 +1,13 @@
<header class="sticky top-0 z-50 bg-neutral-200 border-b border-black lg:h-26">
<div class="flex items-center gap-14 px-10">
<header class="sticky top-0 z-50 h-20 bg-neutral-200 border-b border-black lg:h-26">
<div class="flex items-center gap-4 px-4 max-lg:h-full sm:px-8 lg:gap-14 lg:px-10">
{{-- Logo --}}
<a href="{{ url('/'.app()->getLocale()) }}" class="shrink-0 lg:py-4">
<img src="/images/logo.png" alt="{{ config('app.name') }}" class="h-18 w-auto">
<img src="/images/logo.png" alt="{{ config('app.name') }}" class="h-14 w-auto lg:h-18">
</a>
{{-- Primary nav --}}
<nav class="flex items-center gap-6 h-full">
<nav class="hidden lg:flex items-center gap-6 h-full">
{{-- Products (CSS-only hover dropdown) --}}
<div class="group relative h-full flex items-center">
@@ -31,12 +31,12 @@
</nav>
{{-- Right side actions --}}
<div class="ml-auto flex items-center gap-8">
{{-- Right side actions — language, wishlist and account move into the mobile menu below `lg` --}}
<div class="ml-auto flex items-center gap-3 lg:gap-8">
{{-- Language switcher --}}
@foreach ($altLocales ?? [] as $altLocale)
<a href="{{ $altLocale['url'] }}" class="uppercase font-display font-extrabold text-sm hover:opacity-70 transition-opacity" hreflang="{{ $altLocale['code'] }}" aria-label="{{ $altLocale['name'] }}">
<a href="{{ $altLocale['url'] }}" class="hidden lg:block uppercase font-display font-extrabold text-sm hover:opacity-70 transition-opacity" hreflang="{{ $altLocale['code'] }}" aria-label="{{ $altLocale['name'] }}">
{{ $altLocale['code'] }}
</a>
@endforeach
@@ -44,7 +44,7 @@
{{-- Wishlist — the account page, or the cookie-based guest page --}}
<a
href="{{ auth()->check() ? route('account.wishlist') : route('wishlist') }}"
class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="{{ __('storefront.account.nav_wishlist') }}"
@if (request()->routeIs('account.wishlist', 'wishlist')) aria-current="page" @endif
>
@@ -54,7 +54,7 @@ class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-op
{{-- Account — the account page, or login for guests --}}
<a
href="{{ auth()->check() ? route('account') : route('login') }}"
class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
class="hidden lg:flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="{{ auth()->check() ? __('storefront.nav.account') : __('storefront.auth.login') }}"
>
<x-ui.icon name="user" :size="40" />
@@ -64,7 +64,7 @@ class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-op
<button
type="button"
class="relative flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="Cart"
aria-label="{{ __('storefront.nav.cart') }}"
aria-haspopup="dialog"
data-controller="cart-count"
data-action="cart-count#open"
@@ -72,7 +72,7 @@ class="relative flex items-center justify-center w-10 h-10 hover:opacity-70 tran
<x-ui.icon name="bag" :size="40" />
<span
data-cart-count-target="badge"
class="absolute -top-1 -right-1 min-w-5 h-5 px-1 rounded-full bg-black text-neutral-200 text-xs font-bold flex items-center justify-center"
class="absolute -top-1 -right-2 text-sm font-bold leading-none"
hidden
>0</span>
</button>
@@ -89,7 +89,99 @@ class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-op
</button>
</div>
{{-- Burger — toggles the #mobile-nav menu below `lg`; its three lines
morph into an X while the menu is open (.burger in app.css). --}}
<button
type="button"
popovertarget="mobile-nav"
class="burger flex h-10 w-10.5 shrink-0 flex-col items-center justify-center gap-1.75 lg:hidden"
aria-label="{{ __('storefront.nav.menu') }}"
aria-controls="mobile-nav"
>
<span class="block h-1 w-10.5 bg-black" aria-hidden="true"></span>
<span class="block h-1 w-10.5 bg-black" aria-hidden="true"></span>
<span class="block h-1 w-10.5 bg-black" aria-hidden="true"></span>
</button>
</div>
<x-search-overlay />
{{--
Mobile menu — a [popover] (top layer, Escape and click-away close for
free) that drops down from under the header, opened and closed by the
burger above. The header is a fixed h-20 below `lg` so the menu can sit
at top-20. The top-to-bottom wipe and the burger → X morph live in
app.css (.mobile-menu, .burger). Display stays on the inner wrapper,
never on the popover itself, so the UA's closed-state display:none holds.
--}}
<nav
id="mobile-nav"
popover
aria-label="{{ __('storefront.nav.menu') }}"
class="mobile-menu fixed inset-x-0 top-20 bottom-auto m-0 max-h-[calc(100dvh-5rem)] w-full max-w-none overflow-y-auto border-0 border-b border-black bg-neutral-200 p-0 text-black"
>
<div class="flex flex-col gap-8 px-4 py-6 sm:px-8">
<ul class="flex flex-col gap-5 font-display font-extrabold italic">
<li class="flex flex-col gap-4">
<a
href="{{ route('products') }}"
@class(['nav-link uppercase flex items-center justify-between gap-4', 'is-active' => request()->routeIs('products')])
@if (request()->routeIs('products')) aria-current="page" @endif
>
<span>{{ __('storefront.nav.products') }}</span>
<x-ui.icon name="arrow-right" :size="22" />
</a>
@if (count($categories ?? []))
<ul class="flex flex-col gap-3 border-l border-black pl-4 font-sans font-normal not-italic">
@foreach ($categories as $category)
<li>
<a href="{{ route('category.show', ['id' => $category['id']]) }}" class="underline-slide">{{ $category['name'] }}</a>
</li>
@endforeach
</ul>
@endif
</li>
<li>
<a
href="{{ route('contact') }}"
@class(['nav-link uppercase flex items-center justify-between gap-4', 'is-active' => request()->routeIs('contact')])
@if (request()->routeIs('contact')) aria-current="page" @endif
>
<span>{{ __('storefront.nav.contact') }}</span>
<x-ui.icon name="arrow-right" :size="22" />
</a>
</li>
</ul>
<ul class="flex flex-col gap-4 border-t border-black pt-6">
<li>
<a
href="{{ auth()->check() ? route('account.wishlist') : route('wishlist') }}"
class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
@if (request()->routeIs('account.wishlist', 'wishlist')) aria-current="page" @endif
>
<x-ui.icon name="heart" :size="28" />
<span>{{ __('storefront.account.nav_wishlist') }}</span>
</a>
</li>
<li>
<a
href="{{ auth()->check() ? route('account') : route('login') }}"
class="inline-flex items-center gap-3 hover:opacity-70 transition-opacity"
>
<x-ui.icon name="user" :size="28" />
<span>{{ auth()->check() ? __('storefront.nav.account') : __('storefront.auth.login') }}</span>
</a>
</li>
@foreach ($altLocales ?? [] as $altLocale)
<li>
<a href="{{ $altLocale['url'] }}" hreflang="{{ $altLocale['code'] }}" lang="{{ $altLocale['code'] }}" class="underline-slide">{{ $altLocale['name'] }}</a>
</li>
@endforeach
</ul>
</div>
</nav>
</header>