diff --git a/CLAUDE.md b/CLAUDE.md index d462ebd..3e95d37 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,7 +32,6 @@ In dev, Vite proxies `/api` to the target set in `vite.config.ts`, so the API mu - Debugging: check `journalctl -u ngu-api -n 40 --no-pager` first. Make sure rsync ran from the repo (not the deployed copy) before restarting the service. - Never run commands against the production server or database unless explicitly asked. - Uploaded media: `UPLOADS_DIR=/var/lib/ngu/uploads`, served by nginx at `/uploads/`. Setup and the nginx block are in `docs/media-uploads.md`. -- Analytics: self-hosted Plausible, proxied by nginx at `/pa/`. The API adds its script to every page (`analyticsTag` in `server/src/pageMeta.js`), counting under the hostname of `site.json`'s `url`, so each deployment reports as itself. Nothing in `index.html` or the app. - Page HTML goes through the API, which fills in each page's title, description, preview image and structured data (`server/src/pageMeta.js`), and serves `/sitemap.xml`. It reads `SITE_CONFIG` (site.json) and `SITE_INDEX` (the built index.html), with Panel → Site settings (the `site_settings` table) laid over site.json, and serves `/robots.txt` from the same merge. nginx setup: `docs/seo.md`. - Video clips (Tools, admins and up): yt-dlp downloads our YouTube/Facebook videos into `CLIPS_DIR`, ffmpeg cuts them; one job at a time, files swept after a day (`server/src/clips.js`). Needs yt-dlp and ffmpeg on the VPS: `docs/video-clips.md`. - Newsletter countdown pictures: `/api/countdown/:id.png` (`server/src/routes/countdown.js`), drawn with sharp when an email is opened; it uses the VPS's fonts, so install Poppins there (eg. into `/usr/local/share/fonts`, then `fc-cache`) or it falls back to a plain sans. The social bar's icons are static files in `public/email/`. diff --git a/docs/updating-data-in-code.md b/docs/updating-data-in-code.md index a186be5..2866be8 100644 --- a/docs/updating-data-in-code.md +++ b/docs/updating-data-in-code.md @@ -279,7 +279,6 @@ The numbers band's "Number Source" dropdown works the same way: | The icons a Front page "Find your way in" path can pick | `src/data/pathIcons.ts` (keys and labels) **and** `ICONS` in `src/pages/sections/home/Pathfinder.tsx` (the Phosphor icon for each key) | Add a line to both. A path saved with an emoji from before the list shows it as it is. | | A page section's accent color | `BRAND` and `ACCENTS` in `src/lib/color.ts` | Pages pick from these (`accent: ACCENTS.green`); add a color there, not a hex in a page. Each is readable as text on white and the tints. | | The palette (the 16-color grid the theme is drawn from) | `PALETTE` in `src/lib/color.ts` | Four families, a column each. `PALETTE_LIGHT` / `PALETTE_DARK` are the fills things colored by data use (a person's initials tile, `paletteFill`); the page background's layers (how many circles, their sizes and parallax speeds) are `LAYERS` in `src/components/PageBackdrop.tsx` and its shades are in `PageBackdrop.css`; the admin home's two alternating group colors are `BLOCK_COLORS` in `src/pages/admin/AdminHome.tsx`. | -| The accessibility panel's choices (bottom right of every public page) | `SETTINGS` in `src/components/AccessibilityPanel.tsx`; the color blind modes are `VISIONS` and `SWAPS` in `src/lib/color.ts` | Each choice is an attribute on `` styled in `src/index.css`, and `index.html` sets it again before the first paint, so a new one goes in all three. A color blind mode swaps palette families (`SWAPS`, picked by simulating each type: see the comment there) in code, in data colors as they load (`src/lib/api.ts`, never under /admin) and in CSS (the `--green-*` variables in `src/index.css`); a hex from the green family in a component should be one of those variables. Something saved or sent (the newsletter's colors) uses `STORED_PALETTE`, which is never swapped. | | Privacy Policy and Terms wording | `src/pages/Privacy.tsx`, `src/pages/Terms.tsx` | The `PARTS` list, and `LAST_UPDATED` whenever the wording changes. The Privacy page must stay true of the code: what the feedback form stores, what the browser keeps, which embeds wait for a click. | | Event type labels and plurals (public site) | `src/lib/eventTypes.ts` | Also the order of the type filter chips. | | Event and person role labels (public site) | `ROLE_LABEL` in `src/pages/EventDetail.tsx` and `src/pages/PersonDetail.tsx` | | diff --git a/index.html b/index.html index b395471..50ffe59 100644 --- a/index.html +++ b/index.html @@ -17,14 +17,8 @@ document.documentElement.dataset.theme = t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; // The accessibility panel's choices (AccessibilityPanel.tsx). - // Reading and color blind modes are for the public pages: the - // admin edits colors and layout, which they would hide. if (localStorage.getItem("site-font") === "dyslexic") document.documentElement.dataset.font = "dyslexic"; - if (!location.pathname.startsWith("/admin")) { - if (localStorage.getItem("site-reading") === "on") document.documentElement.dataset.reading = "on"; - var v = localStorage.getItem("site-vision"); - if (/^(protanopia|deuteranopia|tritanopia|monochrome)$/.test(v || "")) document.documentElement.dataset.vision = v; - } + if (localStorage.getItem("site-reading") === "on") document.documentElement.dataset.reading = "on"; } catch (e) {} diff --git a/server/src/admin-schema/events.js b/server/src/admin-schema/events.js index 396f5c3..6274dfb 100644 --- a/server/src/admin-schema/events.js +++ b/server/src/admin-schema/events.js @@ -61,8 +61,6 @@ export const events = { text("event_logo"), text("color"), text("card_image"), - text("photo"), - text("photo_alt"), bool("is_published"), bool("is_listed"), bool("in_timeline"), diff --git a/server/src/migrations/061_event_photo.sql b/server/src/migrations/061_event_photo.sql deleted file mode 100644 index 66f02a9..0000000 --- a/server/src/migrations/061_event_photo.sql +++ /dev/null @@ -1,20 +0,0 @@ --- ═══════════════════════════════════════════════════════════════ --- 061 EVENTS: EVENT PHOTO --- --- An event's own 16:9 photo, shown whole: at the top of its page, as --- the front page's featured event, on featured cards, in newsletter --- picks and as its page's share preview. photo_alt says what it --- shows, for screen readers (blank: decoration). --- --- card_image (029) goes back to being only the faded background of --- the event's card, which crops it to the card's shape. Until now it --- did both jobs, so each event's photo starts as its card --- background, to keep the front page and previews as they were. --- --- v_events selects e.*, so it carries the new columns as it is. --- ═══════════════════════════════════════════════════════════════ - -ALTER TABLE events ADD COLUMN photo TEXT; -ALTER TABLE events ADD COLUMN photo_alt TEXT; - -UPDATE events SET photo = card_image WHERE card_image IS NOT NULL; diff --git a/server/src/pageMeta.js b/server/src/pageMeta.js index 65ff79d..f91ac5a 100644 --- a/server/src/pageMeta.js +++ b/server/src/pageMeta.js @@ -199,7 +199,7 @@ function eventMeta(site, db, id, meta) { const when = [row.date_label, row.location_label].filter(Boolean).join(" · "); const image = - imageUrl(site, row.photo, "eventPhoto") ?? + imageUrl(site, row.card_image, "eventBackground") ?? imageUrl(site, row.event_logo, "eventLogo") ?? imageUrl(site, row.effective_org_logo, "organization") ?? meta.image; @@ -445,22 +445,6 @@ const REPLACED = [ can end the element early. */ const scriptJson = (value) => JSON.stringify(value).replace(/`; -} - export function renderPage(html, meta) { const site = meta.site; let out = html; @@ -493,7 +477,6 @@ export function renderPage(html, meta) { // script in the head runs during parsing; modules wait). ``, site.themeCss && ``, - analyticsTag(site), ].filter(Boolean); // A blocked site (Site settings indexing off, or site.json's diff --git a/server/src/routes/content.js b/server/src/routes/content.js index 4ec6e7e..6d65d0e 100644 --- a/server/src/routes/content.js +++ b/server/src/routes/content.js @@ -150,8 +150,6 @@ function shapeEvent(row, links, cardBlocks, hosts = []) { event_logo: row.event_logo, color: row.effective_color, card_image: row.card_image, - photo: row.photo, - photo_alt: row.photo_alt, hosts: hosts.map(shapeHost), @@ -465,7 +463,7 @@ content.get("/events", (c) => { // Optional filters, each narrowing the list (src/lib/eventData.ts): // ?scope=national ?host= ?status=upcoming - // ?type=class,workshop ?from=&to= (a date window) ?past=12 + // ?type=class,workshop const where = [`is_published = 1`, `is_listed = 1`]; const params = []; const scope = c.req.query("scope"); @@ -479,38 +477,11 @@ content.get("/events", (c) => { if (status) where.push(`effective_status = ?`), params.push(status); const types = (c.req.query("type") ?? "").split(",").filter(Boolean).slice(0, 20); if (types.length) where.push(`event_type IN (${marks(types.length)})`), params.push(...types); - // ?from=2026-10-01&to=2026-11-07: only events with a day in that - // window (the calendar's six weeks), plus the undated ones it - // counts. Either end may be left off. A series with no end date - // runs on, so it stays in every window after its start. - const day = (name) => { - const value = c.req.query(name); - return /^\d{4}-\d{2}-\d{2}$/.test(value ?? "") ? value : null; - }; - const from = day("from"); - const to = day("to"); - if (from || to) { - const dated = []; - if (to) dated.push(`starts_on <= ?`), params.push(to); - if (from) { - dated.push(`COALESCE(ends_on, CASE WHEN is_series = 1 THEN '9999-12-31' ELSE starts_on END) >= ?`); - params.push(from); - } - where.push(`(starts_on IS NULL OR (${dated.join(" AND ")}))`); - } - let rows = db + const rows = db .prepare(`SELECT * FROM v_events WHERE ${where.join(" AND ")} ORDER BY ${EVENT_ORDER}`) .all(...params); - // ?past=12: only the 12 most recent past events (a carousel's way - // back), before their links, cards and hosts are loaded. - const past = Number.parseInt(c.req.query("past") ?? "", 10); - if (past >= 0) { - let keep = rows.filter((row) => row.effective_status === "past").length - past; - rows = rows.filter((row) => row.effective_status !== "past" || keep-- <= 0); - } - const ids = rows.map((row) => row.id); const links = loadLinks(db, "event", ids); const cards = loadBlocks(db, "event", ids, "card"); diff --git a/server/src/routes/home.js b/server/src/routes/home.js index 5a8ab80..467523e 100644 --- a/server/src/routes/home.js +++ b/server/src/routes/home.js @@ -87,15 +87,14 @@ function statValue(db, row) { } /* The countdown's fields plus what the hero's event card also draws: - its tagline, place, photo and buttons. */ + its tagline, place, card background and buttons. */ function shapeHeroEvent(db, row) { if (!row) return null; const { actions } = splitLinks(loadLinks(db, "event", [row.id]).get(row.id) ?? []); return { ...shapeCountdown(row), tagline: row.tagline, - photo: row.photo, - photo_alt: row.photo_alt, + card_image: row.card_image, org_logo: row.effective_org_logo, links: actions, }; diff --git a/server/src/seed-showcase.js b/server/src/seed-showcase.js index 6b66af4..550f6f9 100644 --- a/server/src/seed-showcase.js +++ b/server/src/seed-showcase.js @@ -369,8 +369,6 @@ tx(db, () => { event_logo: IMAGE, color: "#d62976", card_image: IMAGE, - photo: IMAGE, - photo_alt: "The showcase test image", is_published: 1, is_listed: LISTED, in_timeline: LISTED, diff --git a/server/src/shape.js b/server/src/shape.js index 751bea9..4a23395 100644 --- a/server/src/shape.js +++ b/server/src/shape.js @@ -203,7 +203,7 @@ export function shapeSeries(row) { `image` is { file, kind }, like the timeline's logo: the record tables keep bare filenames in different public/ directories, and logoForKind in media.ts knows which is which. The kinds are - the ref kinds, plus 'event-photo' and 'featured' (the + the ref kinds, plus 'event-background' and 'featured' (the card's own image). An unpublished record's card is dropped; an unlisted one's stays, since featuring it is attaching it by hand. @@ -213,11 +213,11 @@ const FEATURED_REFS = { event: { sql: (marks) => `SELECT id, title, tagline AS blurb, date_label AS eyebrow, - photo, event_logo + card_image, event_logo FROM events WHERE is_published = 1 AND id IN (${marks})`, image: (row) => - row.photo - ? { file: row.photo, kind: "event-photo" } + row.card_image + ? { file: row.card_image, kind: "event-background" } : row.event_logo ? { file: row.event_logo, kind: "event" } : null, diff --git a/src/components/AccessibilityPanel.tsx b/src/components/AccessibilityPanel.tsx index 9f25f16..faf5ecc 100644 --- a/src/components/AccessibilityPanel.tsx +++ b/src/components/AccessibilityPanel.tsx @@ -2,42 +2,28 @@ ACCESSIBILITY PANEL A button fixed to the bottom right of every public page, opening - two switches and a choice that change how the whole site reads: + two switches that change how the whole site reads: Dyslexia-friendly font every typeface becomes OpenDyslexic (self-hosted, index.css) - Reading mode the page as plain text: one column of - ink on white, no colors, pictures, - cards or motion; a picture's - description stays in its place - Color blind mode the palette swapped so its colors stay - apart for that type of color blindness, - or grays (color.ts, VISIONS) + Reading mode the design steps back: no background + circles, motion or shadows, one column, + larger text and plain underlined links, + the same content throughout - Each is a data attribute on (data-font, data-reading, - data-vision) that index.css styles, saved in this browser - (site-font, site-reading, site-vision) and set again before the - first paint by index.html, so a page never flashes the other - look. A color blind mode reloads the page, since colors set from - code and data are swapped as they load. Blocked storage just - means the choice lasts until the tab closes. + Each is a data attribute on (data-font, data-reading) that + index.css styles, saved in this browser (site-font, site-reading) + and set again before the first paint by index.html, so a page + never flashes the other look. Blocked storage just means the + choice lasts until the tab closes. - Reading and color blind modes belong to the public pages, which - are the only ones with this panel: it sets them when they mount - and clears them when the admin takes over (index.html leaves them - off there too), since the admin edits the colors and layout they - would hide. The font follows the visitor everywhere. - - The panel opens on its first switch, comes after its button in - the Tab order, closes on Escape, on the button again, or a click + The panel closes on Escape, on the button again, or a click anywhere else, and gives focus back to the button. ═══════════════════════════════════════════════════════════════ */ import { PersonArmsSpread, X } from '@phosphor-icons/react' import { useEffect, useId, useRef, useState } from 'react' -import { VISIONS } from '../lib/color.ts' - /* A setting: its attribute, storage key, the value that turns it on, and its words. */ const SETTINGS = [ @@ -53,89 +39,35 @@ const SETTINGS = [ key: 'site-reading', on: 'on', label: 'Reading mode', - help: 'The page as plain text: one column, larger type, no colors, pictures or motion.', + help: 'A plain, single column with larger text and no motion.', }, ] as const type Setting = (typeof SETTINGS)[number] -/* The saved choice, or the page's own where storage is blocked. */ -function saved(attribute: string, key: string): string | null { - try { - return localStorage.getItem(key) - } catch { - return document.documentElement.dataset[attribute] ?? null - } -} +const isOn = (setting: Setting) => document.documentElement.dataset[setting.attribute] === setting.on -const isOn = (setting: Setting) => saved(setting.attribute, setting.key) === setting.on -const PUBLIC_ONLY = [ - { attribute: 'reading', key: 'site-reading' }, - { attribute: 'vision', key: 'site-vision' }, -] - -/* Sets (or, given null, clears) an attribute and its saved copy. */ -function apply(attribute: string, key: string, value: string | null) { +function apply(setting: Setting, on: boolean) { const root = document.documentElement - if (value) root.dataset[attribute] = value - else delete root.dataset[attribute] + if (on) root.dataset[setting.attribute] = setting.on + else delete root.dataset[setting.attribute] try { - if (value) localStorage.setItem(key, value) - else localStorage.removeItem(key) + if (on) localStorage.setItem(setting.key, setting.on) + else localStorage.removeItem(setting.key) } catch { // Storage blocked: the choice holds for this page view. } } -/* Reading mode hides pictures, video and maps; their descriptions - (alt, title, aria-label) go on the parent as data-reading-alt, - which index.css shows in their place. An attribute rather than a - new element, so React's own nodes are left alone. */ -const DESCRIBED = 'main img[alt]:not([alt=""]), main iframe[title], main video[aria-label]' - -function describeMedia() { - for (const el of document.querySelectorAll(DESCRIBED)) { - const words = el.getAttribute('alt') ?? el.getAttribute('title') ?? el.getAttribute('aria-label') - const kind = el.tagName === 'IMG' ? 'Image' : 'Video' - el.parentElement?.setAttribute('data-reading-alt', `${kind}: ${words}`) - } -} - -function useMediaDescriptions(on: boolean) { - useEffect(() => { - if (!on) return undefined - describeMedia() - const observer = new MutationObserver(describeMedia) - observer.observe(document.body, { childList: true, subtree: true }) - return () => observer.disconnect() - }, [on]) -} - export default function AccessibilityPanel() { const [open, setOpen] = useState(false) const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)]))) - const [vision, setVision] = useState(() => saved('vision', 'site-vision') ?? '') const rootRef = useRef(null) const buttonRef = useRef(null) - const firstRef = useRef(null) const panelId = useId() - useMediaDescriptions(state['site-reading']) - - useEffect(() => { - const root = document.documentElement - for (const { attribute, key } of PUBLIC_ONLY) { - const value = saved(attribute, key) - if (value) root.dataset[attribute] = value - } - return () => { - for (const { attribute } of PUBLIC_ONLY) delete root.dataset[attribute] - } - }, []) - useEffect(() => { if (!open) return undefined - firstRef.current?.focus() const close = () => { setOpen(false) buttonRef.current?.focus() @@ -156,38 +88,18 @@ export default function AccessibilityPanel() { const toggle = (setting: Setting) => { const next = !state[setting.key] - apply(setting.attribute, setting.key, next ? setting.on : null) + apply(setting, next) setState((current) => ({ ...current, [setting.key]: next })) } - const chooseVision = (value: string) => { - setVision(value) - apply('vision', 'site-vision', value || null) - window.location.reload() - } - return (
- - - {/* After the button in the page, so Tab goes from it into the - panel; drawn above it. */} {open && (

Accessibility

@@ -205,31 +117,25 @@ export default function AccessibilityPanel() {
    - {SETTINGS.map((setting, i) => { + {SETTINGS.map((setting) => { const on = state[setting.key] const labelId = `${panelId}-${setting.attribute}` - const helpId = `${labelId}-help` return (
  • @@ -237,35 +143,26 @@ export default function AccessibilityPanel() { {setting.label} - - {setting.help} - + {setting.help}
  • ) })}
- -
)} + +
) } diff --git a/src/components/Banner.tsx b/src/components/Banner.tsx index a8fb404..a0be933 100644 --- a/src/components/Banner.tsx +++ b/src/components/Banner.tsx @@ -25,7 +25,7 @@ export default function Banner() { if (!visible) return null; const linkClass = - "underline underline-offset-4 decoration-[var(--green-2)] hover:text-white transition-colors"; + "underline underline-offset-4 decoration-[#9cc47c] hover:text-white transition-colors"; return (
+

{text}

) case 'subheading': return ( -

+

{text}

) @@ -245,9 +248,8 @@ function Block({ block, accent, anchor }: { block: ContentBlock; accent: string; const width = Math.max(...rows.map((row) => row.length)) return ( // Wide tables scroll sideways inside their box on a phone - // rather than squeezing every column to a word. Focusable, so - // the arrow keys scroll it too (Safari won't on its own). -
+ // rather than squeezing every column to a word. +
diff --git a/src/components/FeaturedCards.tsx b/src/components/FeaturedCards.tsx index 9476633..708052a 100644 --- a/src/components/FeaturedCards.tsx +++ b/src/components/FeaturedCards.tsx @@ -35,7 +35,7 @@ import { useSmallImage } from '../lib/useSmallImage.ts' /* Image kinds that are photographs, drawn edge to edge. Anything else is a logo, drawn whole. */ -const PHOTO_KINDS = new Set(['event-photo', 'featured', 'person']) +const PHOTO_KINDS = new Set(['event-background', 'featured', 'person']) function hrefFor(card: FeaturedCard): string | null { if (card.kind === 'record' && card.ref) { diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 4ec43b4..a291b87 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -28,14 +28,14 @@ const Footer_Links = [ ]; const footerLinkClass = - "text-white/65 hover:text-[var(--green-2)] text-sm transition-colors"; + "text-white/65 hover:text-[#9cc47c] text-sm transition-colors"; // inline-block with a little height of its own, so a finger can hit it. const pageLinkClass = - "inline-block py-1 text-white/80 hover:text-[var(--green-2)] text-sm font-semibold transition-colors"; + "inline-block py-1 text-white/80 hover:text-[#9cc47c] text-sm font-semibold transition-colors"; const sectionLinkClass = - "inline-block py-1 text-white/65 hover:text-[var(--green-2)] text-sm transition-colors"; + "inline-block py-1 text-white/65 hover:text-[#9cc47c] text-sm transition-colors"; const headingClass = "text-white/90 text-sm font-semibold mb-4"; diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 8bbb625..e98b6b2 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -10,7 +10,7 @@ import PrivacyNotice from "./PrivacyNotice.tsx"; import PageBackdrop from "./PageBackdrop.tsx"; import AccessibilityPanel from "./AccessibilityPanel.tsx"; import ThemeToggle from "./ThemeToggle.tsx"; -import { jumpTo } from "../lib/focus.ts"; +import { scrollBehavior } from "../lib/motion.ts"; /* ── Right-side nav actions ──────────────────────────────── */ @@ -82,12 +82,7 @@ export default function Layout() { const [headerHeight, setHeaderHeight] = useState(72); const headerRef = useRef(null); const closeMenuRef = useRef(null); - const openMenuRef = useRef(null); - // The desktop dropdown Escape has shut, until the pointer or focus - // leaves it (hover and focus would otherwise hold it open). - const [dismissed, setDismissed] = useState(null); const location = useLocation(); - const lastPath = useRef(location.pathname); const sectionsOf = useNavSections(); @@ -103,13 +98,7 @@ export default function Layout() { closeMenuRef.current?.focus(); const onKey = (e: KeyboardEvent) => e.key === "Escape" && setMobileMenuOpen(false); window.addEventListener("keydown", onKey); - return () => { - window.removeEventListener("keydown", onKey); - // Closed with Escape or Close, focus fell to the page with the - // menu: give it back to the menu button. A link that changed - // the page has already sent it to the new page (below). - if (document.activeElement === document.body) openMenuRef.current?.focus(); - }; + return () => window.removeEventListener("keydown", onKey); }, [mobileMenuOpen]); // The header grows and shrinks: the banner can be dismissed, and @@ -126,36 +115,27 @@ export default function Layout() { return () => ro.disconnect(); }, []); - // On the root, so anything can read it: index.css keeps focused - // and jumped-to things clear of the header with it - // (scroll-padding-top), and PostContents offsets by it. - useEffect(() => { - const root = document.documentElement; - root.style.setProperty("--header-h", `${headerHeight}px`); - // The admin has no fixed header: nothing to stay clear of there. - return () => { - root.style.removeProperty("--header-h"); - }; - }, [headerHeight]); - // Router does not scroll on navigation. Go to top on a new page, // or to the anchor if the URL carries one (handles deep links too). - // A new page also takes focus to its content, as a page load would, - // so a screen reader starts there and Tab doesn't begin from a - // link that may be gone. useEffect(() => { - const newPage = lastPath.current !== location.pathname; - lastPath.current = location.pathname; - if (location.hash && jumpTo(decodeURIComponent(location.hash.slice(1)))) return; + if (location.hash) { + const el = document.querySelector(location.hash); + if (el) { + el.scrollIntoView({ behavior: scrollBehavior() }); + return; + } + } window.scrollTo({ top: 0 }); - if (newPage) document.getElementById("main")?.focus({ preventScroll: true }); }, [location.pathname, location.hash, location.key]); return ( // overflow-x-clip, not -hidden: hidden makes this div a scroll // container, and then nothing inside it can be position: sticky // (a blog post's contents column scrolled away with the page). -
+
{ const pageSections = page.path === "/" ? [] : sectionsOf(page.path); return ( -
{ - if (e.key !== "Escape" || pageSections.length === 0) return; - setDismissed(page.path); - e.currentTarget.querySelector("a")?.focus(); - }} - onMouseLeave={() => setDismissed(null)} - onBlur={(e) => { - if (!e.currentTarget.contains(e.relatedTarget as Node)) setDismissed(null); - }} - > +
`block text-base font-bold pb-1 border-b-2 transition-colors duration-200 ${ isActive - ? "text-white border-[var(--green-2)]" + ? "text-white border-[#9cc47c]" : "text-white/75 hover:text-white border-transparent" }` } @@ -226,14 +194,10 @@ export default function Layout() { // (:focus-visible): a click leaves focus on the // link, which held the menu open after the // pointer had gone. -
+
    {pageSections.map((section) => (
  • @@ -264,7 +228,6 @@ export default function Layout() {