Side nav and its circle in front of the section lines, the circle starting just below the first

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-10-01 03:54:39 -05:00
parent a5c4e365cd
commit 1db18a8f91

View file

@ -107,10 +107,14 @@ const circleSize = (box: { width: number; height: number }) =>
Math.min(Math.max(box.width * 1.5, box.height * 1.1), 22 * 16);
/* Where the side nav sticks, and how far its list sits in from the
column's top and left (pt-8, pl-4): the circle centers on that. */
column's top and left: the circle centers on that. The list sits
at least LIST_TOP down, and lower if its circle needs the room to
start CIRCLE_GAP below the first section line (h-2, 8px), rather
than over it. */
const STICK = "calc(var(--header-h, 5rem) + 1rem)";
const LIST_TOP = 32;
const LIST_LEFT = 16;
const CIRCLE_GAP = 8 + 4;
/* How far left of the list's center the circle sits. */
const CIRCLE_SHIFT = 24;
@ -137,6 +141,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
return () => ro.disconnect();
}, [sideNav]);
const circle = listBox && circleSize(listBox);
const listTop = listBox && circle ? Math.max(LIST_TOP, CIRCLE_GAP + circle / 2 - listBox.height / 2) : LIST_TOP;
// The tab's title as the visitor moves around. The first load's
// comes from the server (pageMeta.js), which also sets the page's
@ -171,8 +176,7 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
{sideNav ? (
<div className="relative">
{/* The margin left of the content (72rem, its text 1.5rem in),
clipping sideways only (the circle shows above and below
the list, past the column's top), so nothing reaches the
clipping sideways only, so nothing reaches the
content or the screen's edge. clip, not hidden: hidden
would make it a scroll container, and the sticky layers in
it would stop sticking. */}
@ -182,27 +186,26 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
style={{ width: "calc((100% - 72rem) / 2 + 1rem)" }}
>
{/* A solid circle centered on the list, in the tint the
nav's text reads on in either mode. Its own sticky layer
(a sticky box is a layer of its own, so it couldn't sit
inside the list's): z-index -1 puts it behind the
section lines, and after the page backdrop (also -1)
so in front of that. Height 0, so the list's layer
below starts, and sticks, at the same place. */}
nav's text reads on in either mode: a sticky layer of
its own, in front of the section lines like the list,
which comes after it and so draws over it. Height 0, so
the list's layer below starts, and sticks, at the same
place. */}
{listBox && circle ? (
<div aria-hidden="true" className="pointer-events-none sticky h-0" style={{ top: STICK, zIndex: -1 }}>
<div aria-hidden="true" className="pointer-events-none sticky z-10 h-0" style={{ top: STICK }}>
<div
className="absolute rounded-full bg-tint"
style={{
width: circle,
height: circle,
left: Math.min(LIST_LEFT + listBox.width / 2 - CIRCLE_SHIFT - circle / 2, columnWidth - circle),
top: LIST_TOP + listBox.height / 2 - circle / 2,
top: listTop + listBox.height / 2 - circle / 2,
}}
/>
</div>
) : null}
{/* The list, in front of the section lines. */}
<div className="sticky z-10 pt-8 pl-4 pr-2" style={{ top: STICK }}>
{/* The list, in front of the section lines and its circle. */}
<div className="sticky z-10 pl-4 pr-2" style={{ top: STICK, paddingTop: listTop }}>
<div ref={listRef} className="w-fit max-w-full">
<SectionNav sections={sections.map((s) => ({ id: s.id, label: s.title }))} wrap />
</div>