g1t/apps/docs/src/components/Header.astro
| 1 | --- |
| 2 | // Starlight's header, with the tabs that divide the docs beneath it. |
| 3 | import Default from '@astrojs/starlight/components/Header.astro'; |
| 4 | |
| 5 | import { TABS, tabFor } from '../tabs'; |
| 6 | |
| 7 | const 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 | } |
| 29 | .g1t-header-top { |
| 30 | height: 3.5rem; |
| 31 | padding: 0 var(--sl-nav-pad-x); |
| 32 | } |
| 33 | /* On phones the menu button sits at the top row's end: leave it room. */ |
| 34 | @media (max-width: 49.99rem) { |
| 35 | :global([data-has-sidebar]) .g1t-header-top { |
| 36 | padding-inline-end: calc(var(--sl-nav-pad-x) + var(--sl-menu-button-size) + var(--sl-nav-gap)); |
| 37 | } |
| 38 | } |
| 39 | .g1t-tabs { |
| 40 | display: flex; |
| 41 | gap: 1.5rem; |
| 42 | height: 2.75rem; |
| 43 | padding: 0 var(--sl-nav-pad-x); |
| 44 | overflow-x: auto; |
| 45 | scrollbar-width: none; |
| 46 | } |
| 47 | .g1t-tabs a { |
| 48 | display: flex; |
| 49 | align-items: center; |
| 50 | border-bottom: 1.5px solid transparent; |
| 51 | font-size: 0.875rem; |
| 52 | font-weight: 500; |
| 53 | white-space: nowrap; |
| 54 | color: var(--g1t-muted); |
| 55 | text-decoration: none; |
| 56 | transition: color 0.15s; |
| 57 | } |
| 58 | .g1t-tabs a:hover { |
| 59 | color: var(--g1t-fg); |
| 60 | } |
| 61 | .g1t-tabs a[aria-current='page'] { |
| 62 | border-color: var(--g1t-fg); |
| 63 | color: var(--g1t-fg); |
| 64 | } |
| 65 | </style> |