-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Expand file tree
/
Copy pathHeader.astro
More file actions
173 lines (148 loc) · 3.47 KB
/
Header.astro
File metadata and controls
173 lines (148 loc) · 3.47 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
import LanguageSelect from "@astrojs/starlight/components/LanguageSelect.astro";
import DocSearch from "@astrojs/starlight-docsearch/DocSearch.astro";
import SiteTitle from "@astrojs/starlight/components/SiteTitle.astro";
import ThemeSelect from "@astrojs/starlight/components/ThemeSelect.astro";
import HeaderDropdowns from "../HeaderDropdowns.tsx";
import AgentDirective from "../AgentDirective.astro";
---
<AgentDirective />
<div class="header-inner">
<div class="header-start">
<SiteTitle />
</div>
<div class="header-end">
<div id="docsearch">
<DocSearch />
</div>
<div id="right-group">
<HeaderDropdowns client:idle />
<div class="header-divider" role="separator"></div>
<a
id="header-login-button"
href="https://dash.cloudflare.com/"
class="header-login btn-soft"
>
Log in
</a>
<ThemeSelect />
<LanguageSelect />
</div>
</div>
</div>
<style>
.header-inner {
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
gap: 1rem;
}
.header-start {
display: flex;
align-items: center;
flex-shrink: 0;
}
.header-end {
display: flex;
align-items: center;
gap: 0.5rem;
}
.header-divider {
width: 1px;
height: 1rem;
background-color: var(--color-header-line);
margin-inline: 0.375rem;
flex-shrink: 0;
}
.header-login {
display: flex;
align-items: center;
justify-content: center;
height: 2.25rem;
padding: 0 0.875rem;
border-radius: 0.5rem;
border: 1px solid transparent;
font-size: 0.875rem;
font-weight: 500;
line-height: 1;
white-space: nowrap;
text-decoration: none;
transition: color 150ms, background-color 150ms, border-color 150ms;
}
.header-login {
background-color: var(--color-header-fill);
color: var(--color-header-text);
}
.header-login:hover {
background-color: var(--color-header-line);
color: var(--color-header-hover-text);
}
:global(.site-title) {
gap: 0.5rem;
min-width: fit-content;
overflow: visible;
}
:global(.site-title span) {
color: var(--color-cl1-black);
font-weight: 600;
letter-spacing: -0.01em;
}
:root[data-theme="dark"] :global(.site-title span) {
color: var(--color-cl1-white);
}
:global(.site-title img) {
height: 1.25rem;
}
:global(starlight-theme-select > label > select) {
line-height: 1.25rem;
margin: 1px;
color: var(--color-header-text-subtle);
}
:global(
starlight-theme-select > label > select:focus,
starlight-theme-select > label > select:focus-visible
) {
margin: 1px;
outline-offset: -4px;
}
:global(starlight-theme-select > label > .label-icon) {
left: 8%;
color: var(--color-header-text-subtle);
}
:global(starlight-theme-select > label > .caret) {
left: 75%;
}
#right-group {
display: none;
align-items: center;
gap: 0.25rem;
}
@media screen and (min-width: 800px) {
#right-group {
display: flex;
}
#docsearch {
width: 18rem;
}
#docsearch :global(.DocSearch-Button) {
height: 2.25rem;
border-color: var(--color-header-line);
color: var(--color-header-text-subtle);
transition: color 150ms, background-color 150ms, border-color 150ms;
}
#docsearch :global(.DocSearch-Button:hover) {
border-color: var(--color-header-line);
background-color: var(--color-header-fill);
color: var(--color-header-hover-text);
}
}
</style>
<script>
import { track } from "~/util/zaraz";
document
.querySelector("#header-login-button")
?.addEventListener("click", () => {
track("clicked header login button");
});
</script>