-
Notifications
You must be signed in to change notification settings - Fork 1
/
form_live.sface
52 lines (50 loc) · 1.96 KB
/
form_live.sface
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!-- -->
<div class="relative">
<form
class="w-full"
role="search"
phx-submit={if @__context__[:current_view] != Bonfire.Search.Web.SearchLive,
do: "Bonfire.Search:go_search",
else: "Bonfire.Search:search"}
action="/search"
method="GET"
>
<!-- phx-change={if @__context__[:current_view] == Bonfire.Search.Web.SearchLive,
do: "Bonfire.Search:search"} -->
<span class="sr-only">{e(@search_placeholder, l("Search"))}</span>
<div class="relative w-full rounded">
<input type="hidden" name="search_limit" value={e(@search_limit, "")}>
<input
type="search"
name="s"
autocomplete="off"
value={@search || e(@__context__, :current_params, "s", nil)}
placeholder={e(@search_placeholder, l("Search..."))}
phx-debounce="300"
class="w-[inherit] pr-8 text-sm rounded h-[42px] input bg-base-content/5 rounded-full text-base-content placeholder-base-content placeholder-opacity-80"
/>
<button
type="submit"
class="absolute top-[8px] right-[8px] z-30 flex items-center cursor-pointer btn btn-sm w-[26px] h-[26px] min-h-[26px] btn-ghost btn-circle"
>
<#Icon solid="Search" class="w-4 h-4 text-base-content text-opacity-80" />
</button>
</div>
</form>
<div
:if={!@search_more && @num_hits}
class="absolute left-0 right-0 z-50 w-full rounded-lg top-[3.75rem] search_results menu bg-base-100"
>
<div class="p-3 text-sm border-b border-base-content/20 text-base-content">{e(@num_hits, "no")} {l("total results")}</div>
{#if e(@num_hits, 0) > 0}
<ResultsLive search_more={@search_more} hits={e(@hits, [])} />
{/if}
<LiveRedirect
class="w-full p-3 mx-auto text-center border-t link link-hover border-base-content/20"
to={~p"/search?s=" <> e(@search, "")}
:if={@show_more_link && @num_hits > e(@search_limit, 5)}
>
{l("Filter or show more results")}
</LiveRedirect>
</div>
</div>