Compare commits
No commits in common. "4a937454a8935f9d1de7e65b8dae293bccc45ae7" and "c335774db5f0ef0836bb2845256c66b6a2374c52" have entirely different histories.
4a937454a8
...
c335774db5
2 changed files with 6 additions and 35 deletions
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
.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:
|
||||||
|
|
@ -27,7 +25,6 @@
|
||||||
/* 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;
|
||||||
|
|
@ -38,7 +35,6 @@
|
||||||
@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;
|
||||||
|
|
|
||||||
|
|
@ -124,9 +124,6 @@ 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. */
|
||||||
|
|
@ -201,37 +198,15 @@ 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). When a narrow window holds
|
// (it'd show a cut edge at the content).
|
||||||
// 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 edge = columnWidth - 8; // the furthest right it may reach
|
const radius = Math.min(
|
||||||
const roomy = Math.hypot(LIST_LEFT + listBox.width + 24, STUCK_TOP + listBox.height + 24);
|
Math.hypot(LIST_LEFT + listBox.width + 24, STUCK_TOP + listBox.height + 24),
|
||||||
if (roomy <= edge) return { size: roomy * 2, left: -roomy, top: listTop - STUCK_TOP - roomy };
|
columnWidth - 8,
|
||||||
|
);
|
||||||
// From the header's bottom left, with a slim margin: how far
|
return { size: radius * 2, left: -radius, top: listTop - STUCK_TOP - radius };
|
||||||
// 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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue