Feat: Adding Search prefixes to homepage search

This commit is contained in:
arvanitakis committed 2026-10-19 17:32:35 +03:00
1 parent 623851bd70
commit 4f56edc4fc
6 files changed
+222 -5

No files matched your search

@@ -4,18 +4,25 @@
close come for free). The header's search button opens it via popovertarget.
The `nav-search` controller measures the header on open (→ --search-overlay-h,
since the header isn't a fixed height below `lg`) and focuses the field.
Fade transition lives in app.css (#search-overlay).
Fade transition and the dimmed page behind live in app.css (#search-overlay).
Live search: from 3 characters, the `nav-search` controller points the
<turbo-frame id="search-suggestions"> under the bar at the same /search
endpoint, which answers that frame with the first few matches
(search/suggestions.blade.php). Enter still goes to the full results page.
--}}
<div
id="search-overlay"
popover
data-controller="nav-search"
class="fixed w-full inset-x-0 top-0 bottom-auto m-0 h-[var(--search-overlay-h)] border-0 bg-brand p-0"
data-nav-search-min-chars-value="{{ \App\Http\Controllers\SearchController::LIVE_MIN_CHARS }}"
class="fixed w-full inset-x-0 top-0 bottom-auto m-0 border-0 bg-transparent p-0"
>
<form
method="get"
action="{{ route('search') }}"
class="flex h-full items-center gap-6 px-10"
data-nav-search-target="form"
class="flex h-[var(--search-overlay-h)] items-center gap-6 bg-brand px-10"
>
<label for="search-overlay-input" class="sr-only">{{ __('storefront.shop.search_label') }}</label>
<input
@@ -25,6 +32,7 @@ class="flex h-full items-center gap-6 px-10"
required
autocomplete="off"
data-nav-search-target="input"
data-action="input->nav-search#suggest"
placeholder="{{ __('storefront.search.placeholder') }}"
class="min-w-0 flex-1 appearance-none border-0 border-b border-black bg-transparent pb-2 placeholder:text-black/60 focus:outline-none [&::-webkit-search-cancel-button]:appearance-none"
>
@@ -38,4 +46,6 @@ class="shrink-0 text-black transition-opacity hover:opacity-70"
<x-ui.icon name="close" :size="44" />
</button>
</form>
<turbo-frame id="search-suggestions" data-nav-search-target="results"></turbo-frame>
</div>