g1t/apps/docs/src/components/Header.astro

69 lines1,625 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Docs in the shape of docs.continue.dev1---
2// Starlight's header, with the tabs that divide the docs beneath it.
3import Default from '@astrojs/starlight/components/Header.astro';
4
5import { TABS, tabFor } from '../tabs';
6
7const current = tabFor(Astro.locals.starlightRoute.id);
8---
9
10<div class="g1t-header">
11 <div class="g1t-header-top"><Default /></div>
12 <nav class="g1t-tabs" aria-label="Sections">
13 {
14 TABS.map((tab) => (
15 <a href={tab.href} aria-current={tab === current ? 'page' : undefined}>
16 {tab.label}
17 </a>
18 ))
19 }
20 </nav>
21</div>
22
23<style>
24 .g1t-header {
25 display: flex;
26 flex-direction: column;
27 height: 100%;
28 }
The docs' top bar is the app's: 4rem tall with a line under it, above the section tabs29 /* The same bar as the app's: 4rem, and a line under it. */
Docs in the shape of docs.continue.dev30 .g1t-header-top {
The docs' top bar is the app's: 4rem tall with a line under it, above the section tabs31 box-sizing: border-box;
32 height: 4rem;
33 flex-shrink: 0;
Docs in the shape of docs.continue.dev34 padding: 0 var(--sl-nav-pad-x);
The docs' top bar is the app's: 4rem tall with a line under it, above the section tabs35 border-bottom: 1px solid var(--g1t-line);
Docs in the shape of docs.continue.dev36 }
37 /* On phones the menu button sits at the top row's end: leave it room. */
38 @media (max-width: 49.99rem) {
39 :global([data-has-sidebar]) .g1t-header-top {
40 padding-inline-end: calc(var(--sl-nav-pad-x) + var(--sl-menu-button-size) + var(--sl-nav-gap));
41 }
42 }
43 .g1t-tabs {
44 display: flex;
45 gap: 1.5rem;
46 height: 2.75rem;
47 padding: 0 var(--sl-nav-pad-x);
48 overflow-x: auto;
49 scrollbar-width: none;
50 }
51 .g1t-tabs a {
52 display: flex;
53 align-items: center;
54 border-bottom: 1.5px solid transparent;
55 font-size: 0.875rem;
56 font-weight: 500;
57 white-space: nowrap;
58 color: var(--g1t-muted);
59 text-decoration: none;
60 transition: color 0.15s;
61 }
62 .g1t-tabs a:hover {
63 color: var(--g1t-fg);
64 }
65 .g1t-tabs a[aria-current='page'] {
66 border-color: var(--g1t-fg);
67 color: var(--g1t-fg);
68 }
69</style>