-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Expand file tree
/
Copy pathheader.html
More file actions
117 lines (115 loc) · 4.68 KB
/
header.html
File metadata and controls
117 lines (115 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<header class="sticky top-0 z-20 h-16 w-full bg-blue-600 text-white">
<div class="mx-auto flex h-full justify-between gap-2 px-4">
<div class="flex h-full items-center gap-2 lg:gap-8">
{{- if not .IsHome }}
<button
x-data
@click="$store.showSidebar = true"
class="icon-svg block h-full px-4 md:hidden"
aria-label="Menu"
>
{{ partialCached "icon" "menu" "menu" }}
</button>
{{- end }}
<div>
{{/* main logo */}}
<a title="Docker Docs home page" href="{{ site.BaseURL }}">
<div class="hidden sm:block">
{{- (resources.Get "images/docker-docs-white.svg").Content | safe.HTML -}}
</div>
<div class="block sm:hidden">
{{- (resources.Get "images/docker-docs-white-condensed.svg").Content | safe.HTML -}}
</div>
</a>
</div>
<nav class="mt-1 hidden md:flex lg:flex xl:flex 2xl:flex">
{{/* main menu */}}
<ul class="flex text-sm md:text-base lg:gap-4">
{{ range site.Menus.main }}
<li
{{- if or (eq page.Permalink .Page.Permalink) (page.IsDescendant .Page) }}
class="border-b-4"
{{- else }}
class="border-b-4 border-transparent hover:border-white/20"
{{- end }}
>
<a class="block px-2 py-1 whitespace-nowrap" href="{{ .URL }}"
>{{ .Name }}</a
>
</li>
{{ end }}
</ul>
</nav>
</div>
<div
id="buttons"
class="flex min-w-0 flex-shrink-0 items-center justify-end"
>
<div class="flex items-center gap-2">
<div data-tooltip-wrapper class="relative">
<button
x-data
@click="$store.gordon.toggle()"
aria-label="Ask Gordon, AI assistant"
aria-describedby="gordon-tooltip"
class="shimmer open-kapa-widget flex cursor-pointer items-center gap-2 rounded-lg border border-blue-500 bg-blue-700 p-2 text-white transition-colors focus:ring focus:ring-blue-400 focus:outline-none"
>
<span class="icon-svg">
{{ partial "utils/svg.html" "/icons/sparkle.svg" }}
</span>
<span class="hidden px-1 lg:inline">Gordon</span>
</button>
<div
id="gordon-tooltip"
data-tooltip-body
class="absolute top-0 left-0 hidden rounded-sm bg-gray-900 p-2 text-sm whitespace-nowrap text-white"
role="tooltip"
>
Ask Gordon — AI assistant for Docker docs
<div
data-tooltip-arrow
class="absolute h-2 w-2 rotate-45 bg-gray-900"
></div>
</div>
</div>
<div id="search-bar-container">
{{ partialCached "search-bar.html" "-" }}
</div>
<button
aria-label="Theme switch"
id="theme-switch"
class="cursor-pointer rounded-lg border border-blue-500 bg-blue-700 p-2 transition-colors hover:border-blue-400 hover:bg-blue-800 focus:ring focus:ring-blue-400 focus:outline-none"
x-data="{ theme: localStorage.getItem('theme-preference') || 'auto' }"
x-init="
let mql = window.matchMedia('(prefers-color-scheme: dark)');
function applyTheme(val) {
if (val === 'auto') {
localStorage.removeItem('theme-preference');
document.firstElementChild.className = mql.matches ? 'dark' : 'light';
} else {
localStorage.setItem('theme-preference', val);
document.firstElementChild.className = val;
}
document.firstElementChild.dataset.themePreference = val;
}
let handler = e => { if (theme === 'auto') document.firstElementChild.className = e.matches ? 'dark' : 'light'; };
mql.addEventListener('change', handler);
$watch('theme', val => applyTheme(val));
return () => mql.removeEventListener('change', handler);
"
@click="theme = (theme === 'light' ? 'dark' : theme === 'dark' ? 'auto' : 'light')"
>
<span class="theme-icon-sun icon-svg" x-show="theme === 'light'"
>{{ partialCached "icon" "icons/sun.svg" "sun" }}
</span>
<span class="theme-icon-moon icon-svg" x-show="theme === 'dark'">
{{ partialCached "icon" "icons/moon.svg" "moon" }}
</span>
<span class="theme-icon-auto icon-svg" x-show="theme === 'auto'">
{{ partialCached "icon" "contrast" "contrast" }}
</span>
</button>
</div>
</div>
</div>
</header>