Skip to content

Commit 39ff715

Browse files
authored
ux: move support and theme buttons to topnav (#23243)
Move the contact support button and the theme switch button to the top nav bar.
1 parent 5e8b1da commit 39ff715

File tree

15 files changed

+251
-180
lines changed

15 files changed

+251
-180
lines changed

assets/css/theme.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
--color-yellow-outlinedborder: rgba(235, 156, 0, 0.56);
202202
--color-yellow-selected: rgba(235, 156, 0, 0.16);
203203

204+
--topnav-button-bg: #4878f3;
204205
--tw-prose-code-bg: var(--color-gray-100);
205206
--tw-prose-code-bg-dark: var(--color-gray-800);
206207
}

assets/css/utilities.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,17 @@
249249
@utility breadcrumbs {
250250
font-size: 90%;
251251
}
252+
252253
@utility topbar-button {
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;
254+
@apply text-center max-w-40 text-white font-semibold min-h-10 px-2 bg-(--topnav-button-bg) rounded-md border-1 border-blue-300;
255+
@apply inline-flex justify-center items-center gap-1.5 hover:bg-blue-400 hover:border-blue-300 transition-colors;
256+
svg {
257+
font-size: 19px;
258+
}
259+
}
260+
@utility topbar-button-clear {
261+
@apply text-center text-white/95 font-semibold min-h-9 px-0 hover:text-white/85 transition-colors;
254262
svg {
255263
font-size: 19px;
256264
}
257265
}
258-

assets/icons/headset.svg

Lines changed: 3 additions & 0 deletions
Loading

assets/icons/moon.svg

Lines changed: 8 additions & 0 deletions
Loading

assets/icons/search.svg

Lines changed: 4 additions & 4 deletions
Loading

assets/icons/sparkle.svg

Lines changed: 4 additions & 4 deletions
Loading

assets/icons/sun.svg

Lines changed: 8 additions & 0 deletions
Loading

hugo_stats.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,13 @@
330330
"hidden",
331331
"hidden'",
332332
"highlight",
333-
"hover:bg-blue",
334333
"hover:bg-blue-400",
335334
"hover:bg-blue-400/90",
336335
"hover:bg-blue-500",
337336
"hover:bg-gray-100",
338337
"hover:bg-gray-200",
339338
"hover:bg-gray-50",
340339
"hover:border-white/20",
341-
"hover:dark:bg-blue-500",
342340
"hover:dark:bg-gray-800",
343341
"hover:dark:text-blue-400",
344342
"hover:dark:text-blue-700",
@@ -375,6 +373,7 @@
375373
"lg:grid-cols-3",
376374
"lg:grid-cols-4",
377375
"lg:hidden",
376+
"lg:inline",
378377
"lg:no-underline",
379378
"lg:pb-2",
380379
"lg:scale-100",
@@ -446,8 +445,6 @@
446445
"object-cover",
447446
"open-kapa-widget",
448447
"openSUSE-and-SLES",
449-
"order-1",
450-
"order-2",
451448
"origin-bottom-right",
452449
"origin-top-right",
453450
"ot-sdk-show-settings",
@@ -563,14 +560,13 @@
563560
"top-16",
564561
"top-6",
565562
"topbar-button",
563+
"topbar-button-clear",
566564
"transition",
567565
"transition-colors",
568566
"transition-transform",
569567
"truncate",
570568
"underline-offset-2",
571-
"w-0",
572569
"w-2",
573-
"w-32",
574570
"w-5",
575571
"w-65",
576572
"w-8",

layouts/_default/baseof.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,40 @@
4949
>
5050
Back
5151
</button>
52+
<!-- Top nav buttons appear here on sm width -->
53+
<div class="flex flex-col gap-2 md:hidden mb-4">
54+
<button
55+
@click="open = false"
56+
class="topbar-button open-kapa-widget w-full flex items-center gap-2"
57+
>
58+
<span>Ask&nbsp;AI</span>
59+
<span class="icon-svg">
60+
{{ partialCached "utils/svg.html" "/icons/sparkle.svg" }}
61+
</span>
62+
</button>
63+
<div class="topbar-button w-full flex items-center gap-2" id="search-bar-container">
64+
{{ partialCached "search-bar.html" "-" }}
65+
</div>
66+
{{ partial "contact-support-button.html" .}}
67+
<button
68+
aria-label="Theme switch"
69+
id="theme-switch"
70+
class="topbar-button flex items-center"
71+
x-data="{ theme: localStorage.getItem('theme-preference') }"
72+
x-init="$watch('theme', value => {
73+
localStorage.setItem('theme-preference', value);
74+
document.firstElementChild.className = value;
75+
})"
76+
@click="theme = (theme === 'dark' ? 'light' : 'dark')"
77+
>
78+
<span class="icon-svg icon-sm dark:hidden"
79+
>{{ partialCached "icon" "icons/sun.svg" "sun" }}
80+
</span>
81+
<span class="icon-svg icon-sm hidden dark:block">
82+
{{ partialCached "icon" "icons/moon.svg" "moon" }}
83+
</span>
84+
</button>
85+
</div>
5286
<!-- Actual Sidebar Content -->
5387
{{ block "left" . }}
5488
{{ partial "sidebar/mainnav.html" . }}

layouts/_default/search.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ <h1 class="py-4">{{ .Title }}</h1>
1111
<input type="search" id="search-page-input"
1212
class="ring-3-gray-light-200 dark:ring-3-gray-dark-400 dark:bg-background-dark focus:ring-3-blue-light dark:focus:ring-3-blue-dark ring-3-[1.5px] w-full max-w-xl min-w-0 rounded-sm bg-white px-4 py-2 outline-hidden"
1313
placeholder="Search…" tabindex="0" />
14-
<div class="admonition flex flex-row min-w-fit items-center w-0 gap-1">
14+
<div class="admonition flex flex-row min-w-fit items-center gap-1">
1515
<p>Not finding what you're looking for? Try</p>
1616
<button onclick="askAI('search-page-input')" class="topbar-button bg-blue-400/95 border-blue-300 hover:bg-blue-400/90">
1717
<span>Ask&nbsp;AI</span>
1818
<span class="icon-svg">
1919
{{ partial "utils/svg.html" "/icons/sparkle.svg" }}
2020
</span>
2121
</button>
22-
</div>
2322
</div>
2423
<hr class="border-divider-light dark:border-divider-dark" />
2524
<div id="search-page-results">

0 commit comments

Comments
 (0)