Skip to content

Commit

Permalink
chore(search): update search suggestions for desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Apr 22, 2024
1 parent 97fac5f commit 2cb33d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
9 changes: 5 additions & 4 deletions components/ui/search/search.templ
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
package search

templ Search() {
<div class="">
<div class={ "!text-accent", "!font-MyriadPro", "md:w-[300px]", "xl:w-[500px]" }>
<form
class="form-control"
class={ "w-full" }
hx-get="/api/search-suggession"
hx-swap="innerHTML"
hx-target="#search-results"
hx-trigger="keyup"
>
<input
id="search-input"
class="input input-bordered"
class={ "w-full", "p-[10px]", "ps-[15px]", "rounded-3xl" }
type="search"
name="query"
autofocus
autocomplete="off"
placeholder="Search for some tunes"
/>
</form>
<div id="search-results"></div>
<div class={ "absolute", "md:top-[80px]", "z-10", "md:w-[300px]", "xl:w-[500px]" } id="search-results"></div>
</div>
//
<script lang="javascript">
Expand Down
11 changes: 0 additions & 11 deletions components/ui/search/search_suggestion.templ

This file was deleted.

6 changes: 3 additions & 3 deletions components/ui/search/search_suggestions.templ
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package search
import "fmt"

templ SearchSuggestions(suggestions []string, originalQuery string) {
<ul id="search-suggestions" class="grid grid-cols-1 w-full">
<ul id="search-suggestions" class={ "grid", "grid-cols-1", "w-full", "bg-[#FFFFFFBB]", "rounded-lg", "p-[10px]" }>
for i, suggestion := range suggestions {
<li class="focus-within:bg-base-300">
<a href="https://google.com" class="w-full" id={ fmt.Sprintf("search-suggestion-%d", i) }>
<li class={ "focus-within:bg-primary", "focus-within:text-white", "text-lg", "p-1", "rounded" }>
<a href="https://google.com" class={ "w-full" } id={ fmt.Sprintf("search-suggestion-%d", i) }>
if len(suggestion) <= len(originalQuery) {
<span><b>{ suggestion }</b></span>
} else {
Expand Down

0 comments on commit 2cb33d9

Please sign in to comment.