@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
astro 393 lines 14 KB
Raw
1 ---
2 import Search from "@astrojs/starlight/components/Search.astro";
3 import { activeTab } from "../../docs-tabs";
4 import Logo from "./Logo.astro";
5
6 interface Props {
7 /**
8 * Set on the marketing layout, where this nav is the only header and there
9 * is no Starlight sidebar — so every control stays in the top bar on all
10 * viewports. Docs pages render this as Starlight's `Header` override and
11 * leave it unset; there the GitHub/Discord links are dropped on mobile (they
12 * live in the hamburger menu footer; see the `.alc-nav--docs` mobile rule
13 * below).
14 */
15 marketing?: boolean;
16 }
17
18 const { marketing = false } = Astro.props;
19 const current = marketing ? undefined : activeTab(Astro.url.pathname).label;
20 const metaLink = (label: string) => [
21 "alc-nav__link",
22 { "alc-nav__link--active": current === label },
23 ];
24 ---
25
26 <nav class:list={["alc-nav", { "alc-nav--docs": !marketing }]}>
27 <a href="/" class="alc-nav__brand">
28 <Logo />
29 </a>
30
31 <div class="alc-nav__spacer"></div>
32 <div class="alc-nav__search">
33 <Search />
34 </div>
35 <a href="/getting-started" class="alc-nav__link alc-nav__link--docs">Docs</a>
36 {
37 !marketing && (
38 <a href="/providers" class:list={metaLink("Reference")}>
39 Reference
40 </a>
41 )
42 }
43 <a href="/blog" class:list={metaLink("Blog")}>Blog</a>
44 <a href="/compare" class:list={metaLink("Compare")}>Compare</a>
45 <a
46 href="https://github.com/alchemy-run/alchemy"
47 class="alc-nav__link alc-nav__link--icon"
48 aria-label="GitHub"
49 >
50 <svg aria-hidden width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
51 <path
52 d="M12 .5C5.73.5.5 5.73.5 12c0 5.08 3.29 9.39 7.86 10.91.58.1.79-.25.79-.56 0-.28-.01-1.02-.02-2-3.2.69-3.88-1.54-3.88-1.54-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.71.08-.71 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.55-.29-5.24-1.28-5.24-5.69 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11.04 11.04 0 0 1 5.79 0c2.21-1.49 3.18-1.18 3.18-1.18.63 1.59.23 2.76.11 3.05.74.81 1.19 1.84 1.19 3.1 0 4.42-2.69 5.39-5.25 5.68.41.36.78 1.07.78 2.16 0 1.56-.01 2.81-.01 3.19 0 .31.21.67.8.56C20.71 21.39 24 17.08 24 12 24 5.73 18.27.5 12 .5z"
53 ></path>
54 </svg>
55 <span class="alc-nav__link-text">GitHub</span>
56 </a>
57 <a
58 href="/discord"
59 class="alc-nav__link alc-nav__link--icon"
60 aria-label="Discord"
61 >
62 <svg aria-hidden width="18" height="18" viewBox="0 0 24 24" fill="currentColor">
63 <path
64 d="M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.075.075 0 0 0-.079.037c-.34.6-.717 1.384-.98 2-1.797-.27-3.583-.27-5.342 0-.263-.63-.654-1.4-.997-2A.077.077 0 0 0 9.08 3.2a19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C1.533 9.046.6 13.58 1.057 18.058a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.029.077.077 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.108 13.108 0 0 1-1.872-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.099.246.197.373.291a.077.077 0 0 1-.006.128 12.3 12.3 0 0 1-1.873.892.077.077 0 0 0-.04.106c.36.699.772 1.364 1.225 1.994a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.548-13.66a.061.061 0 0 0-.031-.029ZM8.02 15.331c-1.183 0-2.157-1.085-2.157-2.42 0-1.333.956-2.418 2.157-2.418 1.21 0 2.176 1.094 2.157 2.418 0 1.335-.956 2.42-2.157 2.42Zm7.974 0c-1.183 0-2.157-1.085-2.157-2.42 0-1.333.955-2.418 2.157-2.418 1.21 0 2.176 1.094 2.157 2.418 0 1.335-.946 2.42-2.157 2.42Z"
65 ></path>
66 </svg>
67 <span class="alc-nav__link-text">Discord</span>
68 </a>
69 </nav>
70
71 <style>
72 .alc-nav,
73 .alc-nav * {
74 box-sizing: border-box;
75 }
76 .alc-nav {
77 height: 100%;
78 display: flex;
79 align-items: center;
80 gap: 24px;
81 }
82 /* Flex + fixed line-height so the logo centers the same way on marketing
83 pages (body line-height 1.6) and Starlight pages (1.75). */
84 .alc-nav__brand {
85 display: flex;
86 align-items: center;
87 line-height: 1;
88 text-decoration: none;
89 }
90 .alc-nav__spacer {
91 flex: 1;
92 }
93 .alc-nav__search {
94 display: flex;
95 align-items: center;
96 width: 220px;
97 }
98 .alc-nav__search :global(site-search) {
99 display: block;
100 width: 100%;
101 }
102 .alc-nav__search :global(button[data-open-modal]) {
103 display: flex;
104 align-items: center;
105 gap: 8px;
106 width: 100%;
107 height: 32px;
108 padding: 0 8px 0 12px;
109 background: var(--alc-bg);
110 border: 1px solid var(--alc-hairline-2);
111 border-radius: 8px;
112 font-size: 12px;
113 color: var(--alc-fg-4);
114 cursor: pointer;
115 font-family: inherit;
116 }
117 .alc-nav__search :global(button[data-open-modal]:hover) {
118 border-color: var(--alc-fg-4);
119 color: var(--alc-fg-2);
120 }
121 .alc-nav__search :global(button[data-open-modal] svg) {
122 width: 14px;
123 height: 14px;
124 flex-shrink: 0;
125 }
126 .alc-nav__search :global(button[data-open-modal] > :last-child) {
127 margin-inline-start: auto;
128 }
129 .alc-nav__search :global(button[data-open-modal] kbd) {
130 display: inline-flex;
131 align-items: center;
132 gap: 2px;
133 background: transparent;
134 border: 0;
135 padding: 0;
136 font-family: var(--alc-font-mono);
137 font-size: 11px;
138 color: var(--alc-fg-2);
139 }
140 .alc-nav__search :global(button[data-open-modal] kbd kbd) {
141 background: var(--alc-bg-elev-1);
142 border: 1px solid var(--alc-hairline-2);
143 border-radius: 4px;
144 padding: 1px 5px;
145 }
146 .alc-nav__link {
147 color: var(--alc-fg-2);
148 text-decoration: none;
149 font-size: 14px;
150 }
151 .alc-nav__link:hover {
152 color: var(--alc-accent-deep);
153 }
154 .alc-nav__link--active {
155 color: var(--alc-accent-deep);
156 }
157 .alc-nav__link--icon {
158 display: inline-flex;
159 align-items: center;
160 gap: 6px;
161 }
162
163 /* Collapse search to an icon-only button —
164 docs pages have no other search entry point, so it must stay reachable. */
165 @media (max-width: 880px) {
166 .alc-nav__search {
167 width: auto;
168 }
169 .alc-nav__search :global(button[data-open-modal]) {
170 width: 32px;
171 justify-content: center;
172 padding: 0;
173 }
174 .alc-nav__search :global(button[data-open-modal] svg) {
175 width: 16px;
176 height: 16px;
177 }
178 .alc-nav__search :global(button[data-open-modal] > span),
179 .alc-nav__search :global(button[data-open-modal] kbd) {
180 display: none;
181 }
182 .alc-nav__link--icon .alc-nav__link-text {
183 display: none;
184 }
185 }
186 @media (max-width: 640px) {
187 .alc-nav { gap: 16px; }
188 }
189 @media (max-width: 480px) {
190 .alc-nav { gap: 12px; }
191 }
192 /* On phones every link stays: the gaps, text and wordmark shrink so
193 Docs, Blog, Compare and the icons fit down to 320px. */
194 @media (max-width: 460px) {
195 .alc-nav { gap: 10px; }
196 .alc-nav__link { font-size: 13.5px; }
197 /* The wordmark's size is an inline style (Logo's size prop). */
198 .alc-nav__brand :global(.alc-logo__word) { font-size: 20px !important; }
199 }
200 @media (max-width: 380px) {
201 .alc-nav { gap: 7px; }
202 .alc-nav__link { font-size: 13px; }
203 .alc-nav__brand :global(.alc-logo__word) { font-size: 17px !important; }
204 }
205 /* The narrowest phones keep the mark and drop the wordmark. */
206 @media (max-width: 350px) {
207 .alc-nav__brand :global(.alc-logo__word) { display: none; }
208 }
209 /*
210 * Docs pages render this nav inside Starlight's fixed `<header>`, which
211 * reserves room on the right for the floating hamburger button and shows a
212 * mobile menu (with social icons in its footer) below the
213 * `md` (50rem) breakpoint. Packing every control into the top bar too made it
214 * overflow past that reserved area and slide under the hamburger. Below 50rem
215 * we drop just the GitHub/Discord links — they live in the hamburger menu. The
216 * docs gutter is also trimmed on mobile (see `--sl-nav-pad-x` in custom.css)
217 * to make room. Marketing pages have no hamburger/menu, so they keep every
218 * control (see `marketing`).
219 */
220 @media (max-width: 50rem) {
221 .alc-nav--docs .alc-nav__link--icon {
222 display: none;
223 }
224 }
225 </style>
226
227 <style is:global>
228 /*
229 * Starlight's Search dialog is rendered in the top layer (outside any
230 * scoped style boundary) and relies on Starlight tokens / utility classes
231 * (`--sl-color-*`, `sl-hidden`, `md:sl-hidden`) that are not loaded on
232 * marketing pages. We map the missing Starlight color tokens onto our
233 * parchment palette inside the search dialog so Starlight's own Pagefind
234 * styling (page icon, sub-result tree connector, focus rings, etc.)
235 * "just works" on every page.
236 */
237 site-search {
238 /* Starlight color tokens, mapped to our palette. Scoped to site-search
239 so docs pages keep their existing Starlight theme untouched. */
240 --sl-color-white: var(--alc-fg-1);
241 --sl-color-text: var(--alc-fg-1);
242 --sl-color-text-accent: var(--alc-accent-deep);
243 --sl-color-accent: var(--alc-accent);
244 --sl-color-accent-high: var(--alc-accent-deep);
245 --sl-color-accent-low: var(--alc-accent-12);
246 --sl-color-gray-1: var(--alc-fg-1);
247 --sl-color-gray-2: var(--alc-fg-2);
248 --sl-color-gray-3: var(--alc-fg-3);
249 --sl-color-gray-4: var(--alc-fg-4);
250 --sl-color-gray-5: var(--alc-hairline-2);
251 --sl-color-gray-6: var(--alc-bg-sunk);
252 --sl-color-black: var(--alc-bg-elev-1);
253 --sl-color-backdrop-overlay: rgba(42, 38, 32, 0.35);
254 --sl-shadow-lg: 0 24px 64px rgba(42, 38, 32, 0.25);
255 --__sl-font: var(--alc-font-sans);
256 }
257
258 site-search dialog {
259 color: var(--alc-fg-2);
260 border-radius: 12px;
261 font-family: var(--alc-font-sans);
262 }
263 site-search dialog::backdrop {
264 -webkit-backdrop-filter: blur(6px);
265 backdrop-filter: blur(6px);
266 }
267
268 /* Hide the mobile-only Cancel button on desktop. Starlight uses
269 `md:sl-hidden` for this but the utility CSS isn't loaded on the
270 marketing pages, so it otherwise leaks into the input on desktop. */
271 site-search button[data-close-modal] {
272 display: none;
273 font-family: var(--alc-font-sans);
274 }
275 @media (max-width: 50rem) {
276 site-search button[data-close-modal] {
277 display: inline-flex;
278 /* Starlight positions this button with `position: absolute` +
279 `align-self: flex-end`, relying on the static position of an
280 abs-pos flex child honoring alignment. WebKit doesn't implement
281 that, so on iOS the button lands at the frame's START and
282 overlaps the search input's magnifier/text. Pin it explicitly:
283 1rem matches .dialog-frame's mobile padding, which is exactly
284 where flex-end places it in browsers that do honor alignment —
285 inside the 5rem gutter that --sl-search-cancel-space reserves
286 to the right of the input. */
287 inset-inline-end: 1rem;
288 }
289 }
290
291 /* ── Pagefind UI re-skin (Effect-style result cards) ────────────────── */
292 site-search #starlight__search {
293 --pagefind-ui-primary: var(--alc-fg-1);
294 --pagefind-ui-text: var(--alc-fg-2);
295 --pagefind-ui-background: var(--alc-bg-sunk);
296 --pagefind-ui-border: var(--alc-hairline-2);
297 --pagefind-ui-tag: var(--alc-bg-sunk);
298 --pagefind-ui-border-width: 1px;
299 --pagefind-ui-font: var(--alc-font-sans);
300 --pagefind-ui-scale: 0.85;
301 }
302 /* Search input — sits on a slightly sunk surface so the white result
303 cards beneath it have something to pop against. */
304 site-search #starlight__search .pagefind-ui__form {
305 border-bottom: 1px solid var(--alc-hairline-2);
306 padding-bottom: 0.75rem;
307 margin-bottom: 0.25rem;
308 }
309 site-search #starlight__search .pagefind-ui__search-input {
310 color: var(--alc-fg-1);
311 background: var(--alc-bg-elev-1);
312 font-family: var(--alc-font-sans);
313 border: 1px solid var(--alc-hairline-2);
314 border-radius: 8px;
315 }
316 site-search #starlight__search input:focus {
317 --pagefind-ui-border: var(--alc-accent);
318 box-shadow: 0 0 0 3px var(--alc-accent-12);
319 }
320 site-search #starlight__search .pagefind-ui__message {
321 color: var(--alc-fg-3);
322 font-weight: 500;
323 padding-block: 0.5rem;
324 }
325
326 /* Each "result" = a page = a white elevated card. */
327 site-search #starlight__search .pagefind-ui__results {
328 display: flex;
329 flex-direction: column;
330 gap: 12px;
331 }
332 site-search #starlight__search .pagefind-ui__results > * + * {
333 margin-top: 0;
334 }
335 site-search #starlight__search .pagefind-ui__result {
336 background: var(--alc-bg-elev-1);
337 border: 1px solid var(--alc-hairline);
338 border-radius: 10px;
339 box-shadow: 0 1px 2px rgba(42, 38, 32, 0.04);
340 overflow: hidden;
341 }
342 site-search #starlight__search .pagefind-ui__result-inner {
343 background: transparent;
344 }
345 /* Top-level page row + sub-result rows share the same elevated card,
346 so we drop the per-row backgrounds Starlight applies. */
347 site-search
348 #starlight__search
349 .pagefind-ui__result-title:not(:where(.pagefind-ui__result-nested *)),
350 site-search #starlight__search .pagefind-ui__result-nested {
351 background: transparent;
352 }
353 /* Hover/focus highlight — soft accent tint instead of a hard outline. */
354 site-search
355 #starlight__search
356 .pagefind-ui__result-title:not(:where(.pagefind-ui__result-nested *)):hover,
357 site-search #starlight__search .pagefind-ui__result-nested:hover,
358 site-search
359 #starlight__search
360 .pagefind-ui__result-title:not(
361 :where(.pagefind-ui__result-nested *)
362 ):focus-within,
363 site-search #starlight__search .pagefind-ui__result-nested:focus-within {
364 outline: none;
365 background: var(--alc-accent-12);
366 }
367
368 site-search #starlight__search .pagefind-ui__result-link {
369 --pagefind-ui-text: var(--alc-fg-1);
370 color: var(--alc-fg-1);
371 font-weight: 700;
372 font-size: 1rem;
373 }
374 site-search #starlight__search .pagefind-ui__result-excerpt {
375 color: var(--alc-fg-3);
376 font-size: 0.9rem;
377 line-height: 1.55;
378 margin-top: 0.25rem;
379 }
380 site-search #starlight__search mark {
381 color: var(--alc-accent-deep);
382 background: transparent;
383 font-weight: 700;
384 }
385 /* Page / tree icons recolored to fit parchment. */
386 site-search #starlight__search .pagefind-ui__result-title::before {
387 background: var(--alc-fg-4) !important;
388 }
389 site-search #starlight__search .pagefind-ui__result-nested::before {
390 background: var(--alc-hairline-3) !important;
391 }
392 </style>
393