Skip to content

Commit 2a6260c

Browse files
committed
search dropdown
1 parent da9584a commit 2a6260c

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

assets/css/global.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
}
2121

2222
mark {
23-
@apply bg-transparent font-bold text-blue-500 dark:text-blue-800;
23+
@apply bg-transparent font-bold text-blue-500 dark:text-blue-400;
2424
}
2525

2626
/* Hide the clear (X) button for search inputs */

assets/css/utilities.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
font-size: 90%;
251251
}
252252
@utility topbar-button {
253-
@apply text-white font-semibold min-h-10 px-2 bg-blue-400/50 rounded-md border-1 border-blue-300 inline-flex justify-center items-center gap-1.5 hover:bg-blue-400/70 hover:border-blue-200 transition-colors;
253+
@apply text-white font-semibold min-h-10 px-2 bg-blue-300/50 rounded-md border-1 border-blue-300 inline-flex justify-center items-center gap-1.5 hover:bg-blue-400/70 hover:border-blue-200 transition-colors;
254254
svg {
255255
font-size: 19px;
256256
}

hugo_stats.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,12 @@
172172
"bg-blue-500",
173173
"bg-gradient-to-br",
174174
"bg-gradient-to-r",
175+
"bg-gray-0",
175176
"bg-gray-100",
177+
"bg-gray-100t",
176178
"bg-gray-400",
177179
"bg-gray-50",
180+
"bg-gray-50/2",
178181
"bg-gray-700",
179182
"bg-green-400",
180183
"bg-green-500",
@@ -188,11 +191,13 @@
188191
"block",
189192
"border",
190193
"border-0",
194+
"border-1",
191195
"border-b",
192196
"border-b-4",
193197
"border-blue",
194198
"border-blue-300",
195199
"border-divider-light",
200+
"border-gray-100",
196201
"border-gray-200",
197202
"border-gray-400",
198203
"border-green-400",
@@ -240,7 +245,10 @@
240245
"dark:border-b-blue-600",
241246
"dark:border-divider-dark",
242247
"dark:border-gray-400",
248+
"dark:border-gray-600",
243249
"dark:border-gray-700",
250+
"dark:border-gray-800",
251+
"dark:border-gray-900",
244252
"dark:border-green-400",
245253
"dark:border-l-magenta-dark",
246254
"dark:fill-blue-300",
@@ -293,7 +301,9 @@
293301
"focus:outline-none",
294302
"focus:ring-3-blue-light",
295303
"font-bold",
304+
"font-light",
296305
"font-medium",
306+
"font-mediux",
297307
"font-normal",
298308
"font-semibold",
299309
"footnote-backref",
@@ -551,8 +561,11 @@
551561
"text-gray-300",
552562
"text-gray-400",
553563
"text-gray-500",
564+
"text-gray-600",
554565
"text-gray-700",
555566
"text-gray-800",
567+
"text-gray-950",
568+
"text-gray-9700",
556569
"text-left",
557570
"text-lg",
558571
"text-magenta-light",

layouts/partials/search-bar.html

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
x-ref="searchBarInput"
1111
type="search"
1212
id="search-bar-input"
13+
placeholder="Search"
1314
@focus="open = true;"
1415
@keyup.enter.prevent="window.location.href = '/search/?q=' + $event.target.value;"
1516
@keyup.escape.prevent="open = false;"
@@ -31,31 +32,25 @@
3132
{{ partial "utils/svg.html" "/icons/search.svg" }}
3233
</span>
3334
</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) {
4137
const containerRect = document.getElementById('search-bar-container').getBoundingClientRect();
4238
const rect = $refs.searchBarRef.getBoundingClientRect();
4339
$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';
4642
}
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">
5751
<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>` }}
5954
{{- $emptyState | safe.HTML }}
6055
<!-- results -->
6156
</div>

0 commit comments

Comments
 (0)