Skip to content

Commit 7cda22d

Browse files
authored
Crash when custom size has been passed fix (#1032)
1 parent b1f147e commit 7cda22d

File tree

3 files changed

+38
-36
lines changed

3 files changed

+38
-36
lines changed

resources/views/layouts/partials/header/autocomplete.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class="contents"
2121
v-on:input="refine($event.currentTarget.value)"
2222
list="search-history"
2323
/>
24-
<div v-bind:class="{hidden: !currentRefinement}" class="absolute inset-x-0 top-full mt-1 bg-white rounded-md z-header-autocomplete group-has-[:focus]/autocomplete:block hover:block">
25-
@include('rapidez::layouts.partials.header.autocomplete.results')
26-
</div>
27-
<div v-bind:class="{hidden: !currentRefinement}" v-on:click="refine('')" class="fixed inset-0 bg-backdrop z-header-autocomplete-overlay group-has-[:focus]/autocomplete:block"></div>
24+
<div v-on:click="refine('')" class="fixed inset-0 bg-backdrop z-header-autocomplete-overlay hidden group-has-[input:not(:placeholder-shown)]/autocomplete:block group-has-[:focus]/autocomplete:block"></div>
2825
</template>
2926
</ais-autocomplete>
27+
<div class="absolute inset-x-0 top-full mt-1 bg-white rounded-md z-header-autocomplete hidden group-has-[input:not(:placeholder-shown)]/autocomplete:block group-has-[:focus]/autocomplete:block hover:block">
28+
@include('rapidez::layouts.partials.header.autocomplete.results')
29+
</div>
3030
<ais-stats-analytics></ais-stats-analytics>
3131
</div>
3232
</div>

resources/views/layouts/partials/header/autocomplete/no-results.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<ais-state-results v-slot="{ status }">
1+
<ais-state-results v-slot="{ status, query }">
22
<div v-if="status === 'stalled'" class="flex items-center mx-auto px-5 py-2.5">
33
<x-rapidez-loading class="size-5 text-gray-200 animate-spin fill-primary" />
44
<span class="ml-2">@lang('Searching...')</span>
55
</div>
66
<ais-hits>
77
<template v-slot="{ items }">
8-
<div v-if="items.length === 0 && currentRefinement !== '' && status === 'idle'" class="p-5">
8+
<div v-if="items.length === 0 && query !== '' && status === 'idle'" class="p-5">
99
<div class="font-bold text text-lg break-all">
1010
@lang('No results found for :searchterm', [
11-
'searchterm' => '<span class="text-primary">"@{{ currentRefinement }}"</span>'
11+
'searchterm' => '<span class="text-primary">"@{{ query }}"</span>'
1212
])
1313
</div>
1414
<div class="flex flex-col text-sm pt-7">
Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
<search-suggestions v-slot="searchSuggestions" :force-results="false">
2-
<ais-instant-search
3-
v-if="searchSuggestions.searchClient"
4-
:index-name="config.index.search_query"
5-
:search-client="searchSuggestions.searchClient"
6-
>
7-
<ais-configure
8-
:query="currentRefinement || ' '"
9-
:hits-per-page.camel="{{ Arr::get($fields, 'size', config('rapidez.frontend.autocomplete.size', 3)) }}"
10-
filters="display_in_terms:1"
11-
/>
12-
<ais-hits v-slot="{ items }">
13-
<div v-if="items && items.length" v-bind:class="{ 'border-b': currentRefinement }" class="py-2.5">
14-
<x-rapidez::autocomplete.title>
15-
@lang('Suggestions')
16-
</x-rapidez::autocomplete.title>
17-
<ul class="flex flex-col font-sans">
18-
<li v-for="(item, count) in items" class="flex flex-1 items-center w-full">
19-
<a
20-
v-bind:href="window.url(item.redirect || '{{ route('search', ['q' => 'searchPlaceholder']) }}'.replace('searchPlaceholder', encodeURIComponent(item.query_text)))"
21-
class="relative flex items-center group w-full px-5 py-2 text-sm gap-x-4"
22-
data-turbo="false"
23-
>
24-
<x-rapidez::highlight attribute="query_text" class="line-clamp-2"/>
25-
</a>
26-
</li>
27-
</ul>
28-
</div>
29-
</ais-hits>
30-
</ais-instant-search>
2+
<ais-state-results v-slot="{ query }">
3+
<ais-instant-search
4+
v-if="searchSuggestions.searchClient"
5+
:index-name="config.index.search_query"
6+
:search-client="searchSuggestions.searchClient"
7+
>
8+
<ais-configure
9+
:query="query || ' '"
10+
:hits-per-page.camel="{{ Arr::get($fields, 'size', config('rapidez.frontend.autocomplete.size', 3)) }}"
11+
filters="display_in_terms:1"
12+
/>
13+
<ais-hits v-slot="{ items }">
14+
<div v-if="items && items.length" v-bind:class="{ 'border-b': query }" class="py-2.5">
15+
<x-rapidez::autocomplete.title>
16+
@lang('Suggestions')
17+
</x-rapidez::autocomplete.title>
18+
<ul class="flex flex-col font-sans">
19+
<li v-for="(item, count) in items" class="flex flex-1 items-center w-full">
20+
<a
21+
v-bind:href="window.url(item.redirect || '{{ route('search', ['q' => 'searchPlaceholder']) }}'.replace('searchPlaceholder', encodeURIComponent(item.query_text)))"
22+
class="relative flex items-center group w-full px-5 py-2 text-sm gap-x-4"
23+
data-turbo="false"
24+
>
25+
<x-rapidez::highlight attribute="query_text" class="line-clamp-2"/>
26+
</a>
27+
</li>
28+
</ul>
29+
</div>
30+
</ais-hits>
31+
</ais-instant-search>
32+
</ais-state-results>
3133
</search-suggestions>

0 commit comments

Comments
 (0)