|
10 | 10 | x-ref="searchBarInput" |
11 | 11 | type="search" |
12 | 12 | id="search-bar-input" |
| 13 | + placeholder="Search" |
13 | 14 | @focus="open = true;" |
14 | 15 | @keyup.enter.prevent="window.location.href = '/search/?q=' + $event.target.value;" |
15 | 16 | @keyup.escape.prevent="open = false;" |
|
31 | 32 | {{ partial "utils/svg.html" "/icons/search.svg" }} |
32 | 33 | </span> |
33 | 34 | </div> |
34 | | - <div |
35 | | - id="search-bar-dropdown" |
36 | | - x-show="open" |
37 | | - x-cloak |
38 | | - x-ref="dropdown" |
39 | | - x-init="$nextTick(() => { |
40 | | - if (open) { |
| 35 | + <div id="search-bar-dropdown" x-show="open" x-cloak x-ref="dropdown" x-init="$nextTick(() => { |
| 36 | + if (open) { |
41 | 37 | const containerRect = document.getElementById('search-bar-container').getBoundingClientRect(); |
42 | 38 | const rect = $refs.searchBarRef.getBoundingClientRect(); |
43 | 39 | $el.style.top = (rect.bottom + window.scrollY + 9) + 'px'; |
44 | | - $el.style.left = (containerRect.right - Math.max(rect.width, 400)) + 'px'; |
45 | | - $el.style.width = Math.max(rect.width, 400) + 'px'; |
| 40 | + $el.style.left = (containerRect.right - 600) + 'px'; |
| 41 | + $el.style.width = '600px'; |
46 | 42 | } |
47 | | - })" |
48 | | - x-effect="if (open) { |
49 | | - const containerRect = document.getElementById('search-bar-container').getBoundingClientRect(); |
50 | | - const rect = $refs.searchBarRef.getBoundingClientRect(); |
51 | | - $el.style.top = (rect.bottom + window.scrollY + 9) + 'px'; |
52 | | - $el.style.left = (containerRect.right - Math.max(rect.width, 400)) + 'px'; |
53 | | - $el.style.width = Math.max(rect.width, 400) + 'px'; |
54 | | - }" |
55 | | - class="bg-background-light dark:bg-background-dark fixed z-[999] max-w-xl rounded-sm px-6 py-4 shadow-lg" |
56 | | - > |
| 43 | + })" x-effect="if (open) { |
| 44 | + const containerRect = document.getElementById('search-bar-container').getBoundingClientRect(); |
| 45 | + const rect = $refs.searchBarRef.getBoundingClientRect(); |
| 46 | + $el.style.top = (rect.bottom + window.scrollY + 9) + 'px'; |
| 47 | + $el.style.left = (containerRect.right - 600) + 'px'; |
| 48 | + $el.style.width = '600px'; |
| 49 | + }" |
| 50 | + class="font-medium text-gray-400 dark:text-gray-200 bg-gray-50 dark:bg-gray-900 rounded-sm mt-1 border-1 border-gray-100 dark:border-gray-700 fixed z-[999] max-w-xl p-6 shadow-md"> |
57 | 51 | <div id="search-bar-results"> |
58 | | - {{- $emptyState := `<div class="p-2 text-gray-500 dark:text-gray-400">Start typing to search or try <button onclick="askAI('search-bar-input')" class="link">Ask AI</button></div>` }} |
| 52 | + {{- $emptyState := `<div>Start typing to search or try <button onclick="askAI('search-bar-input')" class="link">Ask |
| 53 | + AI</button>.</div>` }} |
59 | 54 | {{- $emptyState | safe.HTML }} |
60 | 55 | <!-- results --> |
61 | 56 | </div> |
|
0 commit comments