Skip to content

Commit fb217ad

Browse files
committed
chore(search): fix htmx loading state
1 parent 71971a8 commit fb217ad

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

views/components/search/search.templ

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ templ Search() {
99
hx-swap="innerHTML"
1010
hx-target="#main-contents"
1111
hx-trigger="submit"
12+
data-loading-target="#loading"
13+
data-loading-class-remove="hidden"
14+
data-loading-path="/search?no_reload=true"
1215
>
1316
<div class={ "flex", "bg-white", "rounded-[8px]", "border", "border-b-[3px]", "border-black" }>
1417
<input
@@ -30,6 +33,9 @@ templ Search() {
3033
hx-swap="innerHTML"
3134
hx-target="#main-contents"
3235
hx-trigger="submit"
36+
data-loading-target="#loading"
37+
data-loading-class-remove="hidden"
38+
data-loading-path="/search?no_reload=true"
3339
id="search-icon"
3440
>
3541
<img

views/components/search/search_suggestions.templ

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ templ SearchSuggestions(suggestions []string, originalQuery string) {
1616
hx-swap="innerHTML"
1717
hx-target="#main-contents"
1818
hx-trigger="click,submit"
19+
data-loading-target="#loading"
20+
data-loading-class-remove="hidden"
21+
data-loading-path={ fmt.Sprintf("/search?no_reload=true&query=%s", suggestion) }
1922
class={ "w-full", "p-[10px]" }
2023
id={ fmt.Sprintf("search-suggestion-%d", i) }
2124
onClick={ searchNoRealod(suggestion) }

0 commit comments

Comments
 (0)