Compare commits

..

2 commits

Author SHA1 Message Date
Zaldimmar
4a937454a8 Side nav circle: a slight drop shadow
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 04:36:17 -05:00
Zaldimmar
5e77da9a66 Corner sun moves to take in the whole list when the window holds it small
Held by the column's width, the stuck circle's center moves down the
screen's edge until the list's corners are inside it, then off the
screen to the left (growing as much, so its right edge stays put).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 04:35:09 -05:00
2 changed files with 35 additions and 6 deletions

View file

@ -6,6 +6,8 @@
.side-nav-circle { .side-nav-circle {
background: #d6f5fa; background: #d6f5fa;
/* A slight drop shadow, as the cards have: down and soft, no glow. */
box-shadow: 0 4px 12px rgb(0 16 17 / 0.14);
/* Color by section; size and place between centered on the list /* Color by section; size and place between centered on the list
and the corner sun once it sticks. */ and the corner sun once it sticks. */
transition: transition:
@ -25,6 +27,7 @@
/* Dark mode: the toggle's choice, or the system's when there is none. */ /* Dark mode: the toggle's choice, or the system's when there is none. */
:root[data-theme="dark"] .side-nav-circle { :root[data-theme="dark"] .side-nav-circle {
background: #003a45; background: #003a45;
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
} }
:root[data-theme="dark"] .side-nav-circle[data-family="green"] { :root[data-theme="dark"] .side-nav-circle[data-family="green"] {
background: #23361a; background: #23361a;
@ -35,6 +38,7 @@
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .side-nav-circle { :root:not([data-theme="light"]) .side-nav-circle {
background: #003a45; background: #003a45;
box-shadow: 0 4px 12px rgb(0 0 0 / 0.45);
} }
:root:not([data-theme="light"]) .side-nav-circle[data-family="green"] { :root:not([data-theme="light"]) .side-nav-circle[data-family="green"] {
background: #23361a; background: #23361a;

View file

@ -124,6 +124,9 @@ const STUCK_TOP = 16;
const stickAt = (listTop: number) => `calc(var(--header-h, 5rem) + ${STUCK_TOP - listTop}px)`; const stickAt = (listTop: number) => `calc(var(--header-h, 5rem) + ${STUCK_TOP - listTop}px)`;
const LIST_LEFT = 16; const LIST_LEFT = 16;
const CIRCLE_GAP = 8 + 4; const CIRCLE_GAP = 8 + 4;
/* How far off the screen's left edge the stuck circle's center may
go to take in a long list on a narrow window. */
const MAX_BACK = 1200;
/* The circle's color family for a section's accent (PageShell.css): /* The circle's color family for a section's accent (PageShell.css):
green and amber their own, teal and deep teal (and any other) teal. */ green and amber their own, teal and deep teal (and any other) teal. */
@ -198,15 +201,37 @@ export default function PageShell({ title, intro, sections, sideNav = false }: P
// the corner, centered on the header's bottom left so the header // the corner, centered on the header's bottom left so the header
// and the screen's edge hide three quarters of it, big enough to // and the screen's edge hide three quarters of it, big enough to
// reach past the list's far corner, but never wider than the column // reach past the list's far corner, but never wider than the column
// (it'd show a cut edge at the content). // (it'd show a cut edge at the content). When a narrow window holds
// it smaller than that, it moves to take the whole list in anyway:
// first its center down the screen's edge, then (if that isn't
// enough) off the screen to the left, growing by as much, so its
// right edge stays put while its arc flattens over the list.
const circleBox = (() => { const circleBox = (() => {
if (!listBox || !circle) return null; if (!listBox || !circle) return null;
if (stuck) { if (stuck) {
const radius = Math.min( const edge = columnWidth - 8; // the furthest right it may reach
Math.hypot(LIST_LEFT + listBox.width + 24, STUCK_TOP + listBox.height + 24), const roomy = Math.hypot(LIST_LEFT + listBox.width + 24, STUCK_TOP + listBox.height + 24);
columnWidth - 8, if (roomy <= edge) return { size: roomy * 2, left: -roomy, top: listTop - STUCK_TOP - roomy };
);
return { size: radius * 2, left: -radius, top: listTop - STUCK_TOP - radius }; // From the header's bottom left, with a slim margin: how far
// right the list reaches, and its top and bottom.
const right = LIST_LEFT + listBox.width + 8;
const top = STUCK_TOP - 4;
const bottom = STUCK_TOP + listBox.height + 8;
const reach = Math.sqrt(Math.max(edge * edge - right * right, 0));
const drop = Math.min(Math.max(0, bottom - reach), (top + bottom) / 2);
// Off screen by `back`, if the list's corners are still out; at
// most MAX_BACK, since a list as wide as its column can't be
// taken in without crossing into the content (it nearly can't
// happen: titles wrap first).
const half = (bottom - top) / 2;
const gap = Math.max(edge - right, 1);
const back =
Math.hypot(right, Math.max(bottom - drop, drop - top)) <= edge
? 0
: Math.min(MAX_BACK, Math.max(0, (half * half - gap * gap) / (2 * gap) - right));
const radius = edge + back;
return { size: radius * 2, left: -back - radius, top: listTop - STUCK_TOP + drop - radius };
} }
return { return {
size: circle, size: circle,