2026-10-19 17:32:35 +03:00
|
|
|
{{--
|
|
|
|
|
Live search results under the search overlay — the answer to its
|
|
|
|
|
<turbo-frame id="search-suggestions"> (SearchController::suggestions()).
|
|
|
|
|
Up to six products (thumbnail, name with the matched words underlined,
|
|
|
|
|
price), then a link to the full results page. Empty below 3 characters.
|
|
|
|
|
|
2026-10-23 20:59:23 +03:00
|
|
|
ARIA: the overlay's input is a combobox controlling the listbox below. The
|
|
|
|
|
options stay out of the tab order (focus remains in the input); the
|
|
|
|
|
`nav-search` controller moves aria-selected / aria-activedescendant with
|
|
|
|
|
the arrow keys. The hidden summary is copied into the overlay's persistent
|
|
|
|
|
role="status" region, since a live region swapped in with the frame isn't
|
|
|
|
|
reliably announced.
|
|
|
|
|
|
2026-10-19 17:32:35 +03:00
|
|
|
Vars: $query (string), $products (Collection of ProductCard arrays),
|
|
|
|
|
$total (int), $searched (bool)
|
|
|
|
|
--}}
|
|
|
|
|
<turbo-frame id="search-suggestions">
|
|
|
|
|
@if ($searched)
|
2026-10-23 20:59:23 +03:00
|
|
|
<p hidden data-nav-search-target="summary">{{ trans_choice('storefront.search.results_count', $total, ['count' => $total]) }}</p>
|
|
|
|
|
|
2026-10-19 17:32:35 +03:00
|
|
|
<div class="max-h-[calc(100dvh-var(--search-overlay-h))] overflow-y-auto bg-white border-b border-black">
|
2026-10-23 20:59:23 +03:00
|
|
|
@if ($products->isNotEmpty())
|
|
|
|
|
<div
|
|
|
|
|
id="search-suggestions-list"
|
|
|
|
|
role="listbox"
|
|
|
|
|
aria-labelledby="search-overlay-label"
|
|
|
|
|
data-nav-search-target="listbox"
|
2026-10-19 17:32:35 +03:00
|
|
|
>
|
2026-10-23 20:59:23 +03:00
|
|
|
@foreach ($products as $product)
|
|
|
|
|
<a
|
|
|
|
|
id="search-option-{{ $loop->index }}"
|
|
|
|
|
href="{{ $product['href'] }}"
|
|
|
|
|
role="option"
|
|
|
|
|
aria-selected="false"
|
|
|
|
|
tabindex="-1"
|
|
|
|
|
data-turbo-frame="_top"
|
|
|
|
|
data-nav-search-target="option"
|
|
|
|
|
class="flex items-center gap-5 border-b border-neutral-300 px-10 py-2 transition-colors hover:bg-neutral-100 aria-selected:bg-neutral-100"
|
|
|
|
|
>
|
|
|
|
|
<span class="flex aspect-[251/335] w-14 shrink-0 items-center justify-center overflow-hidden border border-black bg-white">
|
|
|
|
|
@if ($product['image'])
|
|
|
|
|
<img src="{{ $product['image'] }}" alt="" loading="lazy" class="block h-auto w-full">
|
|
|
|
|
@endif
|
|
|
|
|
</span>
|
|
|
|
|
<span class="min-w-0 flex-1">{{ \App\Support\SearchHighlight::name((string) $product['name'], $query) }}</span>
|
|
|
|
|
@if ($product['price'] !== null)
|
|
|
|
|
<span class="shrink-0"><x-ui.price :amount="$product['price']" /></span>
|
|
|
|
|
@endif
|
|
|
|
|
</a>
|
|
|
|
|
@endforeach
|
2026-10-19 17:32:35 +03:00
|
|
|
|
2026-10-23 20:59:23 +03:00
|
|
|
<a
|
|
|
|
|
id="search-option-all"
|
|
|
|
|
href="{{ route('search', ['q' => $query]) }}"
|
|
|
|
|
role="option"
|
|
|
|
|
aria-selected="false"
|
|
|
|
|
tabindex="-1"
|
|
|
|
|
data-turbo-frame="_top"
|
|
|
|
|
data-nav-search-target="option"
|
|
|
|
|
class="flex items-center gap-3 bg-black px-10 py-4 text-[19px] font-bold italic uppercase text-white transition-colors hover:bg-neutral-800 aria-selected:bg-neutral-800"
|
|
|
|
|
>
|
|
|
|
|
{{ trans_choice('storefront.search.view_all', $total, ['count' => $total]) }}
|
|
|
|
|
<x-ui.icon name="arrow-right" :size="20" />
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
@else
|
|
|
|
|
<p class="px-10 py-6 text-neutral-500">{{ __('storefront.search.no_results', ['query' => $query]) }}</p>
|
2026-10-19 17:32:35 +03:00
|
|
|
@endif
|
|
|
|
|
</div>
|
|
|
|
|
@endif
|
|
|
|
|
</turbo-frame>
|