@@ -10,12 +10,14 @@ import ThemeSelect from "virtual:starlight/components/ThemeSelect";
1010import { NAV_TABS as tabs } from " ../data/nav" ;
1111
1212/**
13- * Override of Starlight's Header: the original row plus a tab row underneath
14- * (the zensical.org pattern), so the main sections stay reachable from every
15- * page - the splash homepage has no sidebar. The row's extra height comes
16- * from `--sl-nav-height`, raised in custom.css; the first row keeps the
17- * original height via `--rs-nav-row`. The tabs live in src/data/nav.ts,
18- * shared with the Sidebar override.
13+ * Override of Starlight's Header with a section-tab nav (the zensical.org
14+ * pattern), so the main sections stay reachable from every page - the splash
15+ * homepage has no sidebar. Below 60rem the tabs sit on their own row under
16+ * the logo; from that breakpoint up they move next to the logo in the
17+ * single header row. The row heights come from `--sl-nav-height`, set
18+ * per breakpoint in custom.css; the logo row keeps the original height via
19+ * `--rs-nav-row`. The tabs live in src/data/nav.ts, shared with the Sidebar
20+ * override.
1921 */
2022
2123const shouldRenderSearch =
@@ -25,21 +27,9 @@ const shouldRenderSearch =
2527const pathname = Astro .url .pathname ;
2628---
2729
28- <div class =" stacked" >
29- <div class =" header" >
30- <div class =" title-wrapper sl-flex" >
31- <SiteTitle />
32- </div >
33- <div class =" search-wrapper sl-flex print:hidden" >
34- { shouldRenderSearch && <Search />}
35- </div >
36- <div class =" sl-hidden md:sl-flex print:hidden right-group" >
37- <div class =" sl-flex social-icons" >
38- <SocialIcons />
39- </div >
40- <ThemeSelect />
41- <LanguageSelect />
42- </div >
30+ <div class =" header" >
31+ <div class =" title-wrapper sl-flex" >
32+ <SiteTitle />
4333 </div >
4434 <nav class =" top-nav print:hidden" aria-label =" Main" >
4535 {
@@ -53,6 +43,16 @@ const pathname = Astro.url.pathname;
5343 ))
5444 }
5545 </nav >
46+ <div class =" search-wrapper sl-flex print:hidden" >
47+ { shouldRenderSearch && <Search />}
48+ </div >
49+ <div class =" sl-hidden md:sl-flex print:hidden right-group" >
50+ <div class =" sl-flex social-icons" >
51+ <SocialIcons />
52+ </div >
53+ <ThemeSelect />
54+ <LanguageSelect />
55+ </div >
5656</div >
5757
5858<script >
@@ -63,24 +63,21 @@ const pathname = Astro.url.pathname;
6363</script >
6464
6565{
66- /* The first -row styles are copied from Starlight's Header.astro so the
67- original layout survives the override; only `.stacked` and `. top-nav`
68- are new. */
66+ /* The single -row styles are copied from Starlight's Header.astro so the
67+ original layout survives the override; only `.top-nav` and the wrapping
68+ behavior are new. */
6969}
7070<style >
71- .stacked {
72- display: flex;
73- flex-direction: column;
74- justify-content: space-between;
75- height: 100%;
76- }
77-
71+ /* Two rows while stacked: the original header items on top, the tab row
72+ wrapped underneath and pushed to the header's bottom border. */
7873 .header {
7974 display: flex;
80- gap: var(--sl-nav-gap);
75+ flex-wrap: wrap;
76+ gap: 0 var(--sl-nav-gap);
8177 justify-content: space-between;
8278 align-items: center;
83- height: calc(var(--rs-nav-row) - 2 * var(--sl-nav-pad-y));
79+ align-content: space-between;
80+ height: 100%;
8481 }
8582
8683 .title-wrapper {
@@ -105,6 +102,9 @@ const pathname = Astro.url.pathname;
105102
106103 .top-nav {
107104 display: flex;
105+ order: 5;
106+ flex-basis: 100%;
107+ min-width: 0;
108108 gap: 1.5rem;
109109 overflow-x: auto;
110110 scrollbar-width: none;
@@ -137,10 +137,38 @@ const pathname = Astro.url.pathname;
137137 search to the right edge, next to the other controls, keeps it in
138138 the same place everywhere. */
139139 grid-template-columns: auto 1fr auto;
140- align-content: center;
140+ align-content: space-between;
141+ }
142+ .top-nav {
143+ grid-column: 1 / -1;
144+ grid-row: 2;
141145 }
142146 .search-wrapper {
143147 justify-content: flex-end;
144148 }
145149 }
150+
151+ /* Wide screens: one row, tabs between the logo and the search box. The
152+ tabs stretch to the full header height (the negative margins eat the
153+ header padding) so the active underline still touches the bottom
154+ border. Below 60rem the search box gets too cramped next to the tabs;
155+ keep this breakpoint in sync with --sl-nav-height in custom.css. */
156+ @media (min-width: 60rem) {
157+ .header {
158+ grid-template-columns: auto auto 1fr auto;
159+ }
160+ .top-nav {
161+ grid-column: 2;
162+ grid-row: 1;
163+ align-self: stretch;
164+ align-items: stretch;
165+ margin-block: calc(-1 * var(--sl-nav-pad-y));
166+ overflow-x: visible;
167+ }
168+ .top-nav a {
169+ display: inline-flex;
170+ align-items: center;
171+ padding-block: 0;
172+ }
173+ }
146174</style >
0 commit comments