responsive design
This commit is contained in:
1 parent
9217960de0
commit
0ae5f49bcf
23 files changed
+380
-157
No files matched your search
@@ -12,11 +12,25 @@
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-[1fr_230px] gap-14">
|
||||
|
||||
<div class="flex items-center justify-between gap-6 flex-wrap mb-7">
|
||||
<div class="flex items-center justify-between gap-x-6 gap-y-4 flex-wrap mb-7">
|
||||
<x-shop.result-count :paginator="$products" />
|
||||
<x-shop.sort :options="$sortOptions" id="shop-sort" />
|
||||
|
||||
<div class="flex items-center gap-6">
|
||||
{{-- Opens the filters drawer below `lg`; at `lg` the sidebar is always shown. --}}
|
||||
<button
|
||||
type="button"
|
||||
popovertarget="shop-filters"
|
||||
aria-controls="shop-filters"
|
||||
class="inline-flex items-center gap-2 font-display font-bold uppercase italic lg:hidden"
|
||||
>
|
||||
<x-ui.icon name="filter" :size="20" />
|
||||
<span class="underline-slide [--slide-h:1px]">{{ __('storefront.shop.filters') }}</span>
|
||||
</button>
|
||||
|
||||
<x-shop.sort :options="$sortOptions" id="shop-sort" />
|
||||
</div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div class="hidden lg:block"></div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-[1fr_230px] gap-14">
|
||||
@@ -35,62 +49,86 @@
|
||||
</div>
|
||||
|
||||
{{-- Sidebar — sort, price and in-stock are wired to the back-end; product
|
||||
search lives in the nav overlay, not here. --}}
|
||||
<aside class="flex flex-col gap-10">
|
||||
search lives in the nav overlay, not here.
|
||||
|
||||
{{-- Filter form: a plain GET form whose fields ARE the state. Changing
|
||||
any control auto-submits (auto-submit controller); Turbo captures
|
||||
the GET, navigates the frame, and advances the URL. `sort` rides
|
||||
along as a hidden field so it survives a filter change; `page` is
|
||||
deliberately absent, so filtering drops back to page 1. Without JS
|
||||
the sr-only submit button applies the range inputs. --}}
|
||||
<form
|
||||
method="get"
|
||||
action="{{ $listingAction }}"
|
||||
data-controller="auto-submit"
|
||||
data-action="change->auto-submit#submit range-slider:change->auto-submit#submit"
|
||||
class="contents"
|
||||
>
|
||||
@if ($listing->sort)
|
||||
<input type="hidden" name="sort" value="{{ $listing->sort->value }}" />
|
||||
@endif
|
||||
Below `lg` it's a [popover] drawer (.drawer slide-in from the left),
|
||||
opened by the Filters button above; the lg: utilities undo the
|
||||
popover's fixed positioning so at `lg` it's a plain, always-visible
|
||||
sidebar. Changes only auto-submit at `lg` — in the drawer they wait for
|
||||
Apply, and the frame reload that follows closes the drawer. --}}
|
||||
<aside
|
||||
id="shop-filters"
|
||||
popover
|
||||
aria-label="{{ __('storefront.shop.filters') }}"
|
||||
class="drawer fixed inset-y-0 left-0 right-auto m-0 h-dvh max-h-dvh w-full max-w-sm overflow-y-auto border-0 border-r border-black bg-neutral-200 p-0 text-black lg:static lg:block lg:h-auto lg:max-h-none lg:w-auto lg:max-w-none lg:overflow-visible lg:border-r-0 lg:bg-transparent lg:transform-none"
|
||||
>
|
||||
<div class="flex flex-col gap-10 px-4 py-6 sm:px-8 lg:p-0">
|
||||
|
||||
@if ($priceFloor !== null && $priceCeil !== null && $priceCeil > $priceFloor)
|
||||
<div class="flex flex-col gap-4 -mt-2">
|
||||
<p class="font-extrabold text-h4">{{ __('storefront.shop.filter_price') }}</p>
|
||||
<button
|
||||
type="button"
|
||||
popovertarget="shop-filters"
|
||||
popovertargetaction="hide"
|
||||
class="flex items-center justify-center w-10 h-10 -ml-2 hover:opacity-70 transition-opacity lg:hidden"
|
||||
aria-label="{{ __('storefront.nav.close') }}"
|
||||
>
|
||||
<x-ui.icon name="close" :size="32" />
|
||||
</button>
|
||||
|
||||
<x-ui.range-slider
|
||||
name="price"
|
||||
:min="$priceFloor"
|
||||
:max="$priceCeil"
|
||||
:min-value="max($priceFloor, $listing->minPrice ?? $priceFloor)"
|
||||
:max-value="min($priceCeil, $listing->maxPrice ?? $priceCeil)"
|
||||
prefix="€"
|
||||
separator=" - "
|
||||
:legend="__('storefront.shop.filter_price')"
|
||||
:min-label="__('storefront.shop.price_min')"
|
||||
:max-label="__('storefront.shop.price_max')"
|
||||
>
|
||||
@if ($clearPriceUrl)
|
||||
<a
|
||||
href="{{ $clearPriceUrl }}"
|
||||
class="underline-slide [--slide-h:1px] font-display text-sm font-bold uppercase italic"
|
||||
>{{ __('storefront.shop.reset') }}</a>
|
||||
@endif
|
||||
</x-ui.range-slider>
|
||||
{{-- Filter form: a plain GET form whose fields ARE the state. Changing
|
||||
any control auto-submits (auto-submit controller); Turbo captures
|
||||
the GET, navigates the frame, and advances the URL. `sort` rides
|
||||
along as a hidden field so it survives a filter change; `page` is
|
||||
deliberately absent, so filtering drops back to page 1. Without JS
|
||||
(or in the drawer) the submit button applies the range inputs. --}}
|
||||
<form
|
||||
method="get"
|
||||
action="{{ $listingAction }}"
|
||||
data-controller="auto-submit"
|
||||
data-auto-submit-media-value="(min-width: 64rem)"
|
||||
data-action="change->auto-submit#submit range-slider:change->auto-submit#submit"
|
||||
class="contents"
|
||||
>
|
||||
@if ($listing->sort)
|
||||
<input type="hidden" name="sort" value="{{ $listing->sort->value }}" />
|
||||
@endif
|
||||
|
||||
@if ($priceFloor !== null && $priceCeil !== null && $priceCeil > $priceFloor)
|
||||
<div class="flex flex-col gap-4 -mt-2">
|
||||
<p class="font-extrabold text-h4">{{ __('storefront.shop.filter_price') }}</p>
|
||||
|
||||
<x-ui.range-slider
|
||||
name="price"
|
||||
:min="$priceFloor"
|
||||
:max="$priceCeil"
|
||||
:min-value="max($priceFloor, $listing->minPrice ?? $priceFloor)"
|
||||
:max-value="min($priceCeil, $listing->maxPrice ?? $priceCeil)"
|
||||
prefix="€"
|
||||
separator=" - "
|
||||
:legend="__('storefront.shop.filter_price')"
|
||||
:min-label="__('storefront.shop.price_min')"
|
||||
:max-label="__('storefront.shop.price_max')"
|
||||
>
|
||||
@if ($clearPriceUrl)
|
||||
<a
|
||||
href="{{ $clearPriceUrl }}"
|
||||
class="underline-slide [--slide-h:1px] font-display text-sm font-bold uppercase italic"
|
||||
>{{ __('storefront.shop.reset') }}</a>
|
||||
@endif
|
||||
</x-ui.range-slider>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex flex-col gap-4 [&_label]:text-base">
|
||||
<p class="font-extrabold text-h4">{{ __('storefront.shop.availability') }}</p>
|
||||
<x-ui.checkbox id="shop-in-stock" name="in_stock" :checked="$listing->inStockOnly">
|
||||
{{ __('storefront.shop.in_stock_only') }}
|
||||
</x-ui.checkbox>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex flex-col gap-4 [&_label]:text-base">
|
||||
<p class="font-extrabold text-h4">{{ __('storefront.shop.availability') }}</p>
|
||||
<x-ui.checkbox id="shop-in-stock" name="in_stock" :checked="$listing->inStockOnly">
|
||||
{{ __('storefront.shop.in_stock_only') }}
|
||||
</x-ui.checkbox>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="sr-only">{{ __('storefront.shop.apply') }}</button>
|
||||
</form>
|
||||
<x-ui.button type="submit" size="md" class="self-start lg:sr-only">{{ __('storefront.shop.apply') }}</x-ui.button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
Reference in new issue
Block a user