|
5 | 5 | */ |
6 | 6 | import SiteHeader from './SiteHeader.astro' |
7 | 7 | --- |
8 | | - |
9 | | -<header class="site-header"> |
10 | | - <div class="header-inner"> |
11 | | - <a href="/" class="header-logo"> |
12 | | - <img src="/brand/logo.png" alt="rtk logo" width="26" height="26" style="border-radius:var(--radius-sm);"> |
13 | | - <span>rtk</span> |
14 | | - </a> |
15 | | - |
16 | | - <!-- Desktop nav --> |
17 | | - <nav class="header-nav" aria-label="Main navigation"> |
18 | | - <a href="/#problem" class="header-link">Why</a> |
19 | | - <a href="/#install" class="header-link">Install</a> |
20 | | - <span class="header-divider" aria-hidden="true"></span> |
21 | | - <a href="/docs/" class="header-link header-link--active">Docs</a> |
22 | | - <a href="/savings/" class="header-link">Savings</a> |
23 | | - <span class="header-divider" aria-hidden="true"></span> |
24 | | - <button id="search-trigger" class="header-search-btn" aria-label="Search (Cmd+K)"> |
25 | | - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="15" height="15" aria-hidden="true"> |
26 | | - <circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/> |
27 | | - </svg> |
28 | | - <span class="header-search-label">Search</span> |
29 | | - <kbd class="header-search-kbd">⌘K</kbd> |
30 | | - </button> |
31 | | - <a href="https://github.com/rtk-ai/rtk" class="header-btn-ghost" target="_blank" rel="noopener"> |
32 | | - <IconGitHub size={14} /> |
33 | | - GitHub |
34 | | - </a> |
35 | | - </nav> |
36 | | - |
37 | | - <!-- Mobile right: search + hamburger --> |
38 | | - <div class="header-mobile-right"> |
39 | | - <button id="docs-search-trigger-mobile" class="header-icon-btn" aria-label="Search"> |
40 | | - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" width="18" height="18" aria-hidden="true"> |
41 | | - <circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/> |
42 | | - </svg> |
43 | | - </button> |
44 | | - <button class="header-icon-btn header-hamburger" id="docs-hamburger" aria-label="Open menu" aria-expanded="false" aria-controls="docs-drawer"> |
45 | | - <span></span><span></span><span></span> |
46 | | - </button> |
47 | | - </div> |
48 | | - </div> |
49 | | -</header> |
50 | | - |
51 | | -<!-- Mobile drawer --> |
52 | | -<div class="docs-drawer" id="docs-drawer" aria-hidden="true"> |
53 | | - <div class="docs-drawer-inner"> |
54 | | - <div class="docs-drawer-links"> |
55 | | - <a href="/#problem">Why</a> |
56 | | - <a href="/#install">Install</a> |
57 | | - <a href="/docs/" class="active">Docs</a> |
58 | | - <a href="/savings/">Savings</a> |
59 | | - </div> |
60 | | - <div class="docs-drawer-actions"> |
61 | | - <a href="https://github.com/rtk-ai/rtk" target="_blank" rel="noopener"> |
62 | | - <IconGitHub size={14} /> |
63 | | - GitHub |
64 | | - </a> |
65 | | - </div> |
66 | | - </div> |
67 | | -</div> |
68 | | -<div class="docs-overlay" id="docs-overlay"></div> |
69 | | - |
70 | | -<style> |
71 | | - .site-header { |
72 | | - position: fixed; |
73 | | - top: 0; |
74 | | - left: 0; |
75 | | - right: 0; |
76 | | - z-index: 100; |
77 | | - height: 60px; |
78 | | - background: var(--bg-glass); |
79 | | - border-bottom: 1px solid var(--border); |
80 | | - backdrop-filter: blur(20px); |
81 | | - -webkit-backdrop-filter: blur(20px); |
82 | | - } |
83 | | - |
84 | | - .header-inner { |
85 | | - max-width: 1140px; |
86 | | - margin: 0 auto; |
87 | | - padding: 0 24px; |
88 | | - height: 100%; |
89 | | - display: flex; |
90 | | - align-items: center; |
91 | | - justify-content: space-between; |
92 | | - gap: 32px; |
93 | | - } |
94 | | - |
95 | | - .header-logo { |
96 | | - display: flex; |
97 | | - align-items: center; |
98 | | - gap: 8px; |
99 | | - text-decoration: none; |
100 | | - flex-shrink: 0; |
101 | | - color: var(--text-bright); |
102 | | - font-size: 1rem; |
103 | | - font-weight: 700; |
104 | | - letter-spacing: -0.01em; |
105 | | - } |
106 | | - .header-logo:hover { text-decoration: none; color: var(--text-bright); } |
107 | | - |
108 | | - .header-nav { |
109 | | - display: flex; |
110 | | - align-items: center; |
111 | | - gap: 2px; |
112 | | - } |
113 | | - |
114 | | - .header-divider { |
115 | | - width: 1px; |
116 | | - height: 18px; |
117 | | - background: var(--border); |
118 | | - margin: 0 6px; |
119 | | - flex-shrink: 0; |
120 | | - } |
121 | | - |
122 | | - .header-link { |
123 | | - display: inline-flex; |
124 | | - align-items: center; |
125 | | - padding: 5px 10px; |
126 | | - color: var(--text-muted); |
127 | | - font-size: 0.875rem; |
128 | | - font-weight: 500; |
129 | | - border-radius: 6px; |
130 | | - text-decoration: none; |
131 | | - transition: color 150ms ease, background 150ms ease; |
132 | | - } |
133 | | - .header-link:hover { |
134 | | - color: var(--text); |
135 | | - background: var(--bg-card); |
136 | | - text-decoration: none; |
137 | | - } |
138 | | - .header-link--active { color: var(--text); } |
139 | | - .header-link--vox { color: #a78bfa; } |
140 | | - .header-link--vox:hover { color: #a78bfa; background: rgba(167,139,250,0.08); } |
141 | | - .header-link--icm { color: #38bdf8; } |
142 | | - .header-link--icm:hover { color: #38bdf8; background: rgba(56,189,248,0.08); } |
143 | | - |
144 | | - .header-btn-ghost { |
145 | | - display: inline-flex; |
146 | | - align-items: center; |
147 | | - gap: 6px; |
148 | | - padding: 5px 12px; |
149 | | - color: var(--text-muted); |
150 | | - font-size: 0.875rem; |
151 | | - font-weight: 500; |
152 | | - border-radius: 6px; |
153 | | - border: 1px solid var(--border); |
154 | | - text-decoration: none; |
155 | | - transition: color 150ms ease, border-color 150ms ease, background 150ms ease; |
156 | | - margin-left: 4px; |
157 | | - } |
158 | | - .header-btn-ghost:hover { |
159 | | - color: var(--text); |
160 | | - border-color: var(--border-light); |
161 | | - background: var(--bg-card); |
162 | | - text-decoration: none; |
163 | | - } |
164 | | - |
165 | | - .header-search-btn { |
166 | | - display: inline-flex; |
167 | | - align-items: center; |
168 | | - gap: 6px; |
169 | | - padding: 5px 10px; |
170 | | - color: var(--text-muted); |
171 | | - font-size: 0.875rem; |
172 | | - font-weight: 500; |
173 | | - border-radius: 6px; |
174 | | - border: 1px solid var(--border); |
175 | | - background: transparent; |
176 | | - cursor: pointer; |
177 | | - transition: color 150ms ease, border-color 150ms ease, background 150ms ease; |
178 | | - margin-left: 4px; |
179 | | - } |
180 | | - .header-search-btn:hover { |
181 | | - color: var(--text); |
182 | | - border-color: var(--border-light); |
183 | | - background: var(--bg-card); |
184 | | - } |
185 | | - .header-search-label { |
186 | | - color: var(--text-dim); |
187 | | - font-size: 0.8125rem; |
188 | | - } |
189 | | - .header-search-kbd { |
190 | | - display: inline-flex; |
191 | | - align-items: center; |
192 | | - padding: 1px 5px; |
193 | | - font-size: 0.6875rem; |
194 | | - color: var(--text-dim); |
195 | | - background: var(--bg-alt); |
196 | | - border: 1px solid var(--border); |
197 | | - border-radius: 4px; |
198 | | - font-family: inherit; |
199 | | - } |
200 | | - |
201 | | - /* Mobile controls — hidden on desktop */ |
202 | | - .header-mobile-right { |
203 | | - display: none; |
204 | | - align-items: center; |
205 | | - gap: 8px; |
206 | | - } |
207 | | - |
208 | | - .header-icon-btn { |
209 | | - display: flex; |
210 | | - align-items: center; |
211 | | - justify-content: center; |
212 | | - width: 38px; |
213 | | - height: 38px; |
214 | | - border-radius: 8px; |
215 | | - border: 1px solid var(--border); |
216 | | - background: var(--bg-card); |
217 | | - color: var(--text-muted); |
218 | | - cursor: pointer; |
219 | | - transition: color 150ms ease, border-color 150ms ease, background 150ms ease; |
220 | | - padding: 0; |
221 | | - } |
222 | | - .header-icon-btn:hover { |
223 | | - color: var(--text); |
224 | | - border-color: var(--border-light); |
225 | | - background: var(--bg-card); |
226 | | - } |
227 | | - |
228 | | - .header-hamburger { |
229 | | - flex-direction: column; |
230 | | - gap: 5px; |
231 | | - } |
232 | | - .header-hamburger span { |
233 | | - display: block; |
234 | | - width: 18px; |
235 | | - height: 2px; |
236 | | - background: currentColor; |
237 | | - border-radius: 2px; |
238 | | - transition: transform 200ms ease, opacity 200ms ease; |
239 | | - } |
240 | | - .header-hamburger[aria-expanded="true"] span:nth-child(1) { |
241 | | - transform: translateY(7px) rotate(45deg); |
242 | | - } |
243 | | - .header-hamburger[aria-expanded="true"] span:nth-child(2) { |
244 | | - opacity: 0; |
245 | | - } |
246 | | - .header-hamburger[aria-expanded="true"] span:nth-child(3) { |
247 | | - transform: translateY(-7px) rotate(-45deg); |
248 | | - } |
249 | | - |
250 | | - /* Drawer */ |
251 | | - .docs-drawer { |
252 | | - position: fixed; |
253 | | - top: 60px; |
254 | | - right: 0; |
255 | | - bottom: 0; |
256 | | - width: min(280px, 80vw); |
257 | | - background: var(--bg-alt); |
258 | | - border-left: 1px solid var(--border); |
259 | | - z-index: 200; |
260 | | - transform: translateX(100%); |
261 | | - transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1); |
262 | | - display: none; |
263 | | - } |
264 | | - .docs-drawer.open { |
265 | | - transform: translateX(0); |
266 | | - } |
267 | | - |
268 | | - .docs-drawer-inner { |
269 | | - display: flex; |
270 | | - flex-direction: column; |
271 | | - padding: 24px 20px; |
272 | | - height: 100%; |
273 | | - gap: 32px; |
274 | | - } |
275 | | - |
276 | | - .docs-drawer-links { |
277 | | - display: flex; |
278 | | - flex-direction: column; |
279 | | - gap: 4px; |
280 | | - } |
281 | | - .docs-drawer-links a { |
282 | | - display: block; |
283 | | - padding: 12px 16px; |
284 | | - color: var(--text-muted); |
285 | | - font-size: 1rem; |
286 | | - font-weight: 500; |
287 | | - text-decoration: none; |
288 | | - border-radius: 8px; |
289 | | - transition: color 150ms ease, background 150ms ease; |
290 | | - } |
291 | | - .docs-drawer-links a:hover { |
292 | | - color: var(--text); |
293 | | - background: var(--bg-card); |
294 | | - } |
295 | | - .docs-drawer-links a.active { |
296 | | - color: var(--text); |
297 | | - background: rgba(255,255,255,0.04); |
298 | | - } |
299 | | - |
300 | | - .docs-drawer-actions { |
301 | | - display: flex; |
302 | | - flex-direction: column; |
303 | | - gap: 8px; |
304 | | - } |
305 | | - .docs-drawer-actions a { |
306 | | - display: inline-flex; |
307 | | - align-items: center; |
308 | | - gap: 8px; |
309 | | - padding: 10px 16px; |
310 | | - color: var(--text-muted); |
311 | | - font-size: 0.875rem; |
312 | | - font-weight: 500; |
313 | | - border-radius: 8px; |
314 | | - border: 1px solid var(--border); |
315 | | - text-decoration: none; |
316 | | - transition: color 150ms ease, border-color 150ms ease, background 150ms ease; |
317 | | - } |
318 | | - .docs-drawer-actions a:hover { |
319 | | - color: var(--text); |
320 | | - border-color: var(--border-light); |
321 | | - background: var(--bg-card); |
322 | | - } |
323 | | - |
324 | | - /* Overlay */ |
325 | | - .docs-overlay { |
326 | | - display: none; |
327 | | - position: fixed; |
328 | | - inset: 60px 0 0 0; |
329 | | - background: rgba(0, 0, 0, 0.6); |
330 | | - backdrop-filter: blur(2px); |
331 | | - z-index: 199; |
332 | | - } |
333 | | - .docs-overlay.open { display: block; } |
334 | | - |
335 | | - @media (max-width: 768px) { |
336 | | - .header-inner { |
337 | | - padding: 0 16px; |
338 | | - gap: 0; |
339 | | - } |
340 | | - .header-nav { |
341 | | - display: none; |
342 | | - } |
343 | | - .header-mobile-right { |
344 | | - display: flex; |
345 | | - } |
346 | | - .docs-drawer { |
347 | | - display: block; |
348 | | - } |
349 | | - } |
350 | | -</style> |
351 | | - |
352 | | -<script> |
353 | | - const hamburger = document.getElementById('docs-hamburger') |
354 | | - const drawer = document.getElementById('docs-drawer') |
355 | | - const overlay = document.getElementById('docs-overlay') |
356 | | - const searchMobile = document.getElementById('docs-search-trigger-mobile') |
357 | | - const searchDesktop = document.getElementById('search-trigger') |
358 | | - |
359 | | - function openDrawer() { |
360 | | - drawer?.classList.add('open') |
361 | | - overlay?.classList.add('open') |
362 | | - hamburger?.setAttribute('aria-expanded', 'true') |
363 | | - drawer?.setAttribute('aria-hidden', 'false') |
364 | | - document.body.style.overflow = 'hidden' |
365 | | - } |
366 | | - |
367 | | - function closeDrawer() { |
368 | | - drawer?.classList.remove('open') |
369 | | - overlay?.classList.remove('open') |
370 | | - hamburger?.setAttribute('aria-expanded', 'false') |
371 | | - drawer?.setAttribute('aria-hidden', 'true') |
372 | | - document.body.style.overflow = '' |
373 | | - } |
374 | | - |
375 | | - hamburger?.addEventListener('click', () => { |
376 | | - drawer?.classList.contains('open') ? closeDrawer() : openDrawer() |
377 | | - }) |
378 | | - |
379 | | - overlay?.addEventListener('click', closeDrawer) |
380 | | - drawer?.querySelectorAll('a').forEach(link => link.addEventListener('click', closeDrawer)) |
381 | | - searchMobile?.addEventListener('click', () => { |
382 | | - closeDrawer() |
383 | | - searchDesktop?.click() |
384 | | - }) |
385 | | - document.addEventListener('keydown', e => { if (e.key === 'Escape') closeDrawer() }) |
386 | | -</script> |
| 8 | +<SiteHeader lang="en" /> |
0 commit comments