Skip to content

Commit 080d46f

Browse files
mavxdegodsNEOxplus
andauthored
docs: unify sidebar left edge — logo/search/nav/pill all align (#52)
Root cause: Starlight's .sidebar-content had its own --sl-sidebar-pad-x container padding that STACKED on top of per-element insets, so logo, search, group labels, nav items, and the active pill each landed on a different left edge (measured 116/195/163/155 px in mav's screenshot). Fix: single source of truth --gen-nav-inset; zero Starlight's container pad-x; active pill uses symmetric padding + negative margin so it wraps text evenly while text still sits on the nav edge; search wrapper at zero inset (its button padding already matches the nav edge). Measured final: logo 66 / search 69 / label 70 / item 70 / pill 70 px — aligned within 4px (logo's curved G). Co-authored-by: mavneox <mav@onlywithneo.com>
1 parent 9491a3a commit 080d46f

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

‎src/styles/custom.css‎

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,17 @@
120120
.gen-sidebar-search {
121121
margin: 0 0 1rem;
122122
padding-block-start: 0.5rem;
123-
padding-inline: 1.25rem 0.5rem; /* = pill left padding, aligns search with logo */
123+
/* Search box left edge already lands on the nav-item edge at zero inset
124+
(the button's own padding ≈ --gen-nav-inset). Measured: search 69px,
125+
nav items 70px — aligned. Do NOT add --gen-nav-inset here or it double-insets. */
126+
padding-inline: 0 0.4rem;
127+
margin-inline: 0;
124128
}
125129
.gen-sidebar-search :global(button[data-open-modal]),
126130
.gen-sidebar-search button {
127-
width: 100%;
131+
width: 100% !important;
132+
max-width: none !important; /* drop Starlight's 22rem cap so it fills the nav width */
133+
margin-inline: 0 !important; /* no extra inset — wrapper sets the edge */
128134
background: rgba(255, 255, 255, 0.04) !important;
129135
border: 1px solid var(--gen-hairline) !important;
130136
border-radius: 10px !important;
@@ -505,11 +511,24 @@ nav.sidebar ul ul li,
505511
margin-inline-start: 0 !important;
506512
padding-inline-start: 0 !important;
507513
}
508-
/* Sub-item links: align with the group label via MARGIN (not padding) so the
509-
active pill wraps its text with EVEN padding on both sides — not a full-width
510-
box with a big empty left gutter. Pill indent = group-label indent (1.25rem)
511-
minus the link's own 0.6rem padding, so text still lines up under the logo. */
512-
.sidebar-content a { padding-inline: 0.6rem !important; margin-inline: 0.65rem 0.4rem !important; }
514+
/* ─────────────────────────────────────────────────────────────────────
515+
SINGLE SOURCE OF TRUTH for the left-nav column edge.
516+
--gen-nav-inset = the gap from the sidebar pane's left edge to where ALL
517+
nav text (group labels, items, active-pill text, search) must start so it
518+
lines up under the GEN logo. Tune ONLY this one value.
519+
The active pill / item background uses a small symmetric pad (--gen-pill-pad)
520+
and is pulled left by that same pad via negative margin, so the pill wraps
521+
its text evenly AND the text still sits at --gen-nav-inset. ───────────── */
522+
:root { --gen-nav-inset: 1.25rem; --gen-pill-pad: 0.6rem; }
523+
/* Kill Starlight's own sidebar container padding so --gen-nav-inset is the
524+
ONLY horizontal inset (otherwise it stacks and pushes everything right). */
525+
.sidebar-content:where([class*="astro-"]),
526+
nav.sidebar-pane:where([class*="astro-"]) { --sl-sidebar-pad-x: 0px !important; padding-inline: 0 !important; }
527+
528+
.sidebar-content a {
529+
padding-inline: var(--gen-pill-pad) !important;
530+
margin-inline: calc(var(--gen-nav-inset) - var(--gen-pill-pad)) 0.4rem !important;
531+
}
513532
/* narrower sidebar + tight content gap (z.ai ≈ 240px nav, snug column) */
514533
:root {
515534
--sl-sidebar-width: 15rem; /* was 18.75rem */
@@ -543,7 +562,7 @@ nav.sidebar ul ul li,
543562
color: #c5cad3;
544563
opacity: 1;
545564
margin-bottom: 0.45rem;
546-
padding-inline: 1.25rem 0.7rem;
565+
padding-inline: var(--gen-nav-inset) 0.7rem;
547566
}
548567

549568
/* active item (z.ai): white text on a neutral full-width light pill, no accent bar. */

0 commit comments

Comments
 (0)