Add colour tokens, dark mode and drop gradients
- Colour tokens in index.css named by role (ink, body, muted, link, brand, action, surface, tint, danger), used everywhere instead of hex - Dark mode: follows the system, a header toggle (site and admin) overrides it and is remembered; set before first paint in index.html - Data colours go through src/lib/color.ts: withAlpha for tints, accentText (lighter on dark) for text in an accent, readableOn for text on one, so an admin's pale colour still reads - Migration 040 drops events.gradient: a card is its photo or plain, with its colour as the border; other decorative gradients are solid - The countdown and a hero event without a photo mix their colour toward ink behind white text Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee61568911
commit
c74ad746f5
70 changed files with 829 additions and 596 deletions
|
|
@ -38,8 +38,9 @@ import type { ContentBlock } from '../lib/useContent.ts'
|
|||
import { Anchor, Inline, Paragraphs } from './InlineText.tsx'
|
||||
import VideoPlayer from './VideoPlayer.tsx'
|
||||
import ScheduleBlock from './ScheduleBlock.tsx'
|
||||
import { accentText } from '../lib/color.ts'
|
||||
|
||||
const BODY = '#4a6b72'
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
||||
export default function ContentBlocks({
|
||||
blocks,
|
||||
|
|
@ -76,14 +77,14 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
|||
switch (block.type) {
|
||||
case 'heading':
|
||||
return (
|
||||
<h3 className="text-2xl font-bold" style={{ color: accent }}>
|
||||
<h3 className="text-2xl font-bold" style={{ color: accentText(accent) }}>
|
||||
{text}
|
||||
</h3>
|
||||
)
|
||||
|
||||
case 'subheading':
|
||||
return (
|
||||
<h4 className="text-lg font-semibold" style={{ color: accent }}>
|
||||
<h4 className="text-lg font-semibold" style={{ color: accentText(accent) }}>
|
||||
{text}
|
||||
</h4>
|
||||
)
|
||||
|
|
@ -93,12 +94,12 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
|||
<ul className="space-y-2">
|
||||
{(block.items ?? []).map((item, index) => (
|
||||
<li key={index} className="flex gap-3">
|
||||
<span aria-hidden="true" style={{ color: accent }}>
|
||||
<span aria-hidden="true" style={{ color: accentText(accent) }}>
|
||||
•
|
||||
</span>
|
||||
<span style={{ color: BODY }}>
|
||||
{item.url ? (
|
||||
<Anchor href={item.url} className="underline" style={{ color: accent }}>
|
||||
<Anchor href={item.url} className="underline" style={{ color: accentText(accent) }}>
|
||||
{item.text}
|
||||
</Anchor>
|
||||
) : (
|
||||
|
|
@ -120,8 +121,8 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
|||
<Anchor
|
||||
key={index}
|
||||
href={item.url as string}
|
||||
className="rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
||||
style={{ borderColor: accent, color: accent }}
|
||||
className="rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||
style={{ borderColor: accent, color: accentText(accent) }}
|
||||
>
|
||||
{item.text}
|
||||
</Anchor>
|
||||
|
|
@ -150,7 +151,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
|||
<Inline text={text} accent={accent} />
|
||||
</blockquote>
|
||||
{block.cite && (
|
||||
<figcaption className="mt-2 text-sm font-semibold not-italic" style={{ color: accent }}>
|
||||
<figcaption className="mt-2 text-sm font-semibold not-italic" style={{ color: accentText(accent) }}>
|
||||
{block.cite}
|
||||
</figcaption>
|
||||
)}
|
||||
|
|
@ -162,7 +163,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
|||
return (
|
||||
<aside
|
||||
className="space-y-3 rounded-2xl border-l-4 px-6 py-5 leading-relaxed"
|
||||
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 8%, white)`, color: '#26454c' }}
|
||||
style={{ borderColor: accent, background: `color-mix(in srgb, ${accent} 8%, var(--color-surface))`, color: 'var(--color-body)' }}
|
||||
>
|
||||
<Paragraphs text={text} accent={accent} />
|
||||
</aside>
|
||||
|
|
@ -213,7 +214,7 @@ function Block({ block, accent }: { block: ContentBlock; accent: string }) {
|
|||
if (!text) return null
|
||||
return block.href ? (
|
||||
<p className="leading-relaxed" style={{ color: BODY }}>
|
||||
<Anchor href={block.href} className="underline" style={{ color: accent }}>
|
||||
<Anchor href={block.href} className="underline" style={{ color: accentText(accent) }}>
|
||||
{text}
|
||||
</Anchor>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function Picture({ card }: { card: FeaturedCard }) {
|
|||
const photo = card.image ? PHOTO_KINDS.has(card.image.kind) : false
|
||||
|
||||
if (!src || failed) {
|
||||
return <div className="aspect-video w-full bg-gradient-to-br from-[#eef9fb] to-[#d9f0f3]" />
|
||||
return <div className="aspect-video w-full bg-tint" />
|
||||
}
|
||||
|
||||
return photo ? (
|
||||
|
|
@ -55,7 +55,7 @@ function Picture({ card }: { card: FeaturedCard }) {
|
|||
className="aspect-video w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex aspect-video w-full items-center justify-center bg-[#eef9fb] p-8">
|
||||
<div className="flex aspect-video w-full items-center justify-center bg-tint p-8">
|
||||
<img
|
||||
src={src}
|
||||
alt=""
|
||||
|
|
@ -78,10 +78,10 @@ function Card({ card }: { card: FeaturedCard }) {
|
|||
const text = (
|
||||
<div className="flex flex-1 flex-col p-6">
|
||||
{card.eyebrow && (
|
||||
<p className="text-xs font-bold uppercase tracking-[0.2em] text-[#0f7183]">{card.eyebrow}</p>
|
||||
<p className="text-xs font-bold uppercase tracking-[0.2em] text-link">{card.eyebrow}</p>
|
||||
)}
|
||||
{card.title && (
|
||||
<h3 className="mt-2 font-display text-xl font-extrabold leading-snug text-[#073d4a]">
|
||||
<h3 className="mt-2 font-display text-xl font-extrabold leading-snug text-ink">
|
||||
{href ? (
|
||||
// Stretched over the whole card, so the picture and the
|
||||
// blurb are part of the click without nesting links.
|
||||
|
|
@ -96,12 +96,12 @@ function Card({ card }: { card: FeaturedCard }) {
|
|||
)}
|
||||
</h3>
|
||||
)}
|
||||
{card.blurb && <p className="mt-2 leading-relaxed text-[#4a6b72]">{card.blurb}</p>}
|
||||
{card.blurb && <p className="mt-2 leading-relaxed text-muted">{card.blurb}</p>}
|
||||
</div>
|
||||
)
|
||||
|
||||
return (
|
||||
<li className="relative flex flex-col overflow-hidden rounded-2xl border border-[#138ba0]/15 bg-white shadow-sm transition-shadow hover:shadow-lg">
|
||||
<li className="relative flex flex-col overflow-hidden rounded-2xl border border-brand/15 bg-surface shadow-sm transition-shadow hover:shadow-lg">
|
||||
{card.kind === 'video' ? (
|
||||
// Above the stretched link, which a video card doesn't have
|
||||
// anyway, so the play button always gets the click.
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
import { Fragment, type CSSProperties, type ReactNode } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { accentText } from '../lib/color.ts'
|
||||
|
||||
const TOKEN = /\*\*(.+?)\*\*|\*(.+?)\*|\[([^\]]+)\]\(([^)\s]+)\)/g
|
||||
const SAFE_URL = /^(\/(?!\/)|#|https?:\/\/|mailto:|tel:)/i
|
||||
|
|
@ -88,7 +89,7 @@ function line(text: string, accent: string, key: string): ReactNode[] {
|
|||
else if (italic != null) out.push(<em key={k}>{italic}</em>)
|
||||
else if (label != null && SAFE_URL.test(url)) {
|
||||
out.push(
|
||||
<Anchor key={k} href={url} className="underline underline-offset-2" style={{ color: accent }}>
|
||||
<Anchor key={k} href={url} className="underline underline-offset-2" style={{ color: accentText(accent) }}>
|
||||
{label}
|
||||
</Anchor>,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import Banner from "./Banner.tsx";
|
|||
import nguLogo from "../assets/logos/NGU_Logo.svg";
|
||||
import Footer from "./Footer.tsx";
|
||||
import PrivacyNotice from "./PrivacyNotice.tsx";
|
||||
import ThemeToggle from "./ThemeToggle.tsx";
|
||||
|
||||
/* ── Right-side nav actions ──────────────────────────────── */
|
||||
|
||||
|
|
@ -154,7 +155,7 @@ export default function Layout() {
|
|||
<div className="min-h-screen overflow-x-hidden">
|
||||
<a
|
||||
href="#main"
|
||||
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-full focus:bg-white focus:px-4 focus:py-2 focus:font-semibold focus:text-[#073d4a]"
|
||||
className="sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-full focus:bg-surface focus:px-4 focus:py-2 focus:font-semibold focus:text-ink"
|
||||
>
|
||||
Skip to content
|
||||
</a>
|
||||
|
|
@ -207,6 +208,8 @@ export default function Layout() {
|
|||
))}
|
||||
</div>
|
||||
|
||||
<ThemeToggle className="text-white/80 hover:bg-white/10 hover:text-white" />
|
||||
|
||||
<button
|
||||
className="md:hidden text-white p-2"
|
||||
aria-label="Open menu"
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ export type LegalPart = {
|
|||
|
||||
export default function LegalText({ parts }: { parts: LegalPart[] }) {
|
||||
return (
|
||||
<div className="mx-auto max-w-3xl space-y-10 px-6 leading-relaxed text-[#2c4a50]">
|
||||
<div className="mx-auto max-w-3xl space-y-10 px-6 leading-relaxed text-body">
|
||||
{parts.map((part) => (
|
||||
<section key={part.id} id={part.id} style={{ scrollMarginTop: '6rem' }}>
|
||||
<h3 className="text-xl font-bold text-[#073d4a]">{part.heading}</h3>
|
||||
<h3 className="text-xl font-bold text-ink">{part.heading}</h3>
|
||||
<div className="mt-3 space-y-3">
|
||||
{part.body.map((paragraph, i) => (
|
||||
<p key={i}>{paragraph}</p>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
title: "Local Chapters",
|
||||
blurb: "Optional line under the section heading.",
|
||||
accent: "#0f7183", // heading, banner, rule
|
||||
background: "#eef9fb",
|
||||
background: "var(--color-tint)",
|
||||
actions: <SomeButton />, // optional, right of the heading
|
||||
content: <YourStuff />,
|
||||
},
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
import { useEffect, type ReactNode } from "react";
|
||||
|
||||
import { documentTitle } from "../lib/site.ts";
|
||||
import { accentText } from '../lib/color.ts'
|
||||
|
||||
const TEAL = "#0f7183";
|
||||
|
||||
|
|
@ -75,10 +76,10 @@ export function Section({ section }: { section: ShellSection }) {
|
|||
<div className="max-w-6xl mx-auto px-6 mb-10">
|
||||
<div className="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<h2 className="text-4xl md:text-5xl font-extrabold" style={{ color: accent }}>
|
||||
<h2 className="text-4xl md:text-5xl font-extrabold" style={{ color: accentText(accent) }}>
|
||||
{title}
|
||||
</h2>
|
||||
{blurb && <p className="mt-2 text-[#4a6b72] max-w-xl">{blurb}</p>}
|
||||
{blurb && <p className="mt-2 text-muted max-w-xl">{blurb}</p>}
|
||||
</div>
|
||||
{actions}
|
||||
</div>
|
||||
|
|
@ -101,12 +102,12 @@ export default function PageShell({ title, intro, sections }: PageShellProps) {
|
|||
return (
|
||||
<>
|
||||
{/* Page header */}
|
||||
<div className="pt-24 pb-12 px-6" style={{ background: "#eef9fb" }}>
|
||||
<div className="pt-24 pb-12 px-6" style={{ background: "var(--color-tint)" }}>
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<h1 className="text-5xl md:text-6xl font-extrabold" style={{ color: TEAL }}>
|
||||
<h1 className="text-5xl md:text-6xl font-extrabold" style={{ color: accentText(TEAL) }}>
|
||||
{title}
|
||||
</h1>
|
||||
{intro && <p className="mt-3 text-lg text-[#4a6b72] max-w-2xl">{intro}</p>}
|
||||
{intro && <p className="mt-3 text-lg text-muted max-w-2xl">{intro}</p>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
import { Link } from 'react-router-dom'
|
||||
import PageShell from './PageShell.tsx'
|
||||
import { accentText } from '../lib/color.ts'
|
||||
|
||||
const TEAL = '#0f7183'
|
||||
const BODY = '#4a6b72'
|
||||
const BODY = 'var(--color-muted)'
|
||||
|
||||
export default function PageState({
|
||||
loading,
|
||||
|
|
@ -51,8 +52,8 @@ export default function PageState({
|
|||
</p>
|
||||
<Link
|
||||
to={backTo}
|
||||
className="mt-4 inline-block rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
||||
style={{ borderColor: TEAL, color: TEAL }}
|
||||
className="mt-4 inline-block rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||
>
|
||||
{backLabel}
|
||||
</Link>
|
||||
|
|
@ -66,8 +67,8 @@ export default function PageState({
|
|||
<button
|
||||
type="button"
|
||||
onClick={onRetry}
|
||||
className="mt-3 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-[#eef9fb]"
|
||||
style={{ borderColor: TEAL, color: TEAL }}
|
||||
className="mt-3 rounded-full border px-4 py-1.5 text-sm font-medium transition-colors hover:bg-tint"
|
||||
style={{ borderColor: TEAL, color: accentText(TEAL) }}
|
||||
>
|
||||
Try again
|
||||
</button>
|
||||
|
|
@ -85,7 +86,7 @@ export default function PageState({
|
|||
return (
|
||||
<PageShell
|
||||
title={title}
|
||||
sections={[{ id: 'status', title: '', accent: TEAL, background: '#ffffff', content }]}
|
||||
sections={[{ id: 'status', title: '', accent: TEAL, background: 'var(--color-surface)', content }]}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
|
||||
/* color */
|
||||
--pl-accent: #0f7183;
|
||||
--pl-frame-bg: #fff;
|
||||
--pl-frame-bg: var(--color-surface);
|
||||
--pl-frame-edge: rgba(15, 23, 42, 0.1);
|
||||
--pl-photo-bg: #e7edef;
|
||||
--pl-ink: #16262b;
|
||||
--pl-muted: #4a6b72;
|
||||
--pl-photo-bg: color-mix(in srgb, var(--color-muted) 15%, var(--color-surface));
|
||||
--pl-ink: var(--color-ink);
|
||||
--pl-muted: var(--color-muted);
|
||||
--pl-rule: rgba(45, 200, 224, 0.3);
|
||||
--pl-shadow: 0 1px 1px rgba(15, 23, 42, 0.06), 0 10px 18px -14px rgba(15, 23, 42, 0.5);
|
||||
|
||||
|
|
@ -249,7 +249,7 @@
|
|||
padding: 1rem 1.1rem;
|
||||
border-left: 3px solid var(--pl-accent);
|
||||
border-radius: 6px;
|
||||
background: color-mix(in srgb, var(--pl-accent) 7%, #fff);
|
||||
background: color-mix(in srgb, var(--pl-accent) 7%, var(--color-surface));
|
||||
max-width: 68ch;
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@
|
|||
height: 1.75rem;
|
||||
border: 1px solid var(--pl-frame-edge);
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
background: var(--color-surface);
|
||||
color: var(--pl-muted);
|
||||
font-size: 1.1rem;
|
||||
line-height: 1;
|
||||
|
|
@ -309,7 +309,7 @@
|
|||
}
|
||||
|
||||
.pl__fact a {
|
||||
color: var(--pl-accent);
|
||||
color: color-mix(in srgb, var(--pl-accent) var(--accent-text-mix), #fff);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@
|
|||
margin-top: 0.75rem;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 600;
|
||||
color: var(--pl-accent);
|
||||
color: color-mix(in srgb, var(--pl-accent) var(--accent-text-mix), #fff);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,19 +42,19 @@ export default function PrivacyNotice() {
|
|||
<div
|
||||
role="region"
|
||||
aria-label="Privacy notice"
|
||||
className="fixed bottom-4 left-4 right-4 z-40 mx-auto max-w-md rounded-2xl border border-[#138ba0]/20 bg-white p-4 text-sm text-[#26454c] shadow-xl sm:right-auto"
|
||||
className="fixed bottom-4 left-4 right-4 z-40 mx-auto max-w-md rounded-2xl border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
||||
>
|
||||
<p>
|
||||
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
||||
play or show them, and those services may set their own cookies then.{' '}
|
||||
<Link to="/privacy#cookies" className="font-semibold text-[#0f7183] underline underline-offset-2">
|
||||
<Link to="/privacy#cookies" className="font-semibold text-link underline underline-offset-2">
|
||||
Privacy Policy
|
||||
</Link>
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={close}
|
||||
className="mt-3 rounded-full bg-[#0f7183] px-4 py-1.5 font-semibold text-white hover:bg-[#0b5c6a]"
|
||||
className="mt-3 rounded-full bg-action px-4 py-1.5 font-semibold text-white hover:bg-action-hover"
|
||||
>
|
||||
Got it
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -27,8 +27,9 @@ import { personHref } from '../lib/hrefs.ts'
|
|||
import { blockMedia, initials, personPhoto } from '../lib/media.ts'
|
||||
import type { ContentBlockItem } from '../lib/useContent.ts'
|
||||
import { Anchor, Paragraphs } from './InlineText.tsx'
|
||||
import { withAlpha, accentText, readableOn } from '../lib/color.ts'
|
||||
|
||||
const BODY = '#4a6b72'
|
||||
const BODY = 'var(--color-muted)'
|
||||
const WEEKDAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']
|
||||
|
||||
type Day = { name: string; entries: ContentBlockItem[] }
|
||||
|
|
@ -71,7 +72,7 @@ function Avatar({ person, size }: { person: NonNullable<ContentBlockItem['person
|
|||
) : (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`${size} flex shrink-0 items-center justify-center rounded-full bg-[#eef9fb] text-xs font-bold text-[#0f7183]`}
|
||||
className={`${size} flex shrink-0 items-center justify-center rounded-full bg-tint text-xs font-bold text-link`}
|
||||
>
|
||||
{initials(person.name)}
|
||||
</span>
|
||||
|
|
@ -88,7 +89,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
const more = Boolean(entry.description || graphic || place || entry.person)
|
||||
|
||||
const title = entry.url ? (
|
||||
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accent }}>
|
||||
<Anchor href={entry.url} className="underline-offset-2 hover:underline" style={{ color: accentText(accent) }}>
|
||||
{entry.text}
|
||||
</Anchor>
|
||||
) : (
|
||||
|
|
@ -96,14 +97,14 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
)
|
||||
|
||||
return (
|
||||
<li className="border-b border-[#138ba0]/10 last:border-b-0">
|
||||
<li className="border-b border-brand/10 last:border-b-0">
|
||||
<div className="flex gap-4 py-4 sm:gap-6">
|
||||
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accent }}>
|
||||
<p className="w-24 shrink-0 pt-0.5 text-sm font-semibold sm:w-32" style={{ color: accentText(accent) }}>
|
||||
{entry.time}
|
||||
</p>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="font-semibold text-[#26454c]">{title}</p>
|
||||
<p className="font-semibold text-body">{title}</p>
|
||||
{(entry.location || entry.person) && (
|
||||
<p className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm" style={{ color: BODY }}>
|
||||
{entry.location && <span>{entry.location}</span>}
|
||||
|
|
@ -129,8 +130,8 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
aria-expanded={open}
|
||||
aria-controls={panelId}
|
||||
aria-label={open ? `Less about ${entry.text}` : `More about ${entry.text}`}
|
||||
className="h-8 w-8 shrink-0 rounded-full border text-sm transition-colors hover:bg-[#eef9fb]"
|
||||
style={{ borderColor: `${accent}55`, color: accent }}
|
||||
className="h-8 w-8 shrink-0 rounded-full border text-sm transition-colors hover:bg-tint"
|
||||
style={{ borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }}
|
||||
>
|
||||
<span aria-hidden="true" className={`inline-block transition-transform ${open ? 'rotate-180' : ''}`}>
|
||||
▾
|
||||
|
|
@ -140,7 +141,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
</div>
|
||||
|
||||
{more && open && (
|
||||
<div id={panelId} className="mb-5 space-y-5 rounded-2xl bg-[#f6fbfc] p-5 sm:ml-38">
|
||||
<div id={panelId} className="mb-5 space-y-5 rounded-2xl bg-tint-soft p-5 sm:ml-38">
|
||||
{entry.person && (
|
||||
<div className="flex items-center gap-4">
|
||||
<Avatar person={entry.person} size="h-16 w-16" />
|
||||
|
|
@ -148,7 +149,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
<Link
|
||||
to={personHref(entry.person.id)}
|
||||
className="font-semibold hover:underline"
|
||||
style={{ color: accent }}
|
||||
style={{ color: accentText(accent) }}
|
||||
>
|
||||
{entry.person.name}
|
||||
</Link>
|
||||
|
|
@ -184,7 +185,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
type="button"
|
||||
onClick={() => setShowMap(true)}
|
||||
className="flex aspect-video w-full flex-col items-center justify-center gap-1 rounded-lg border border-dashed text-sm"
|
||||
style={{ borderColor: `${accent}55`, color: BODY }}
|
||||
style={{ borderColor: `${withAlpha(accent, 33)}`, color: BODY }}
|
||||
>
|
||||
<span className="font-semibold">Show map</span>
|
||||
<span className="text-xs">{place}, from Google Maps</span>
|
||||
|
|
@ -195,7 +196,7 @@ function Entry({ entry, accent }: { entry: ContentBlockItem; accent: string }) {
|
|||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="mt-2 inline-block text-sm underline"
|
||||
style={{ color: accent }}
|
||||
style={{ color: accentText(accent) }}
|
||||
>
|
||||
Open in Google Maps
|
||||
</a>
|
||||
|
|
@ -258,8 +259,8 @@ export default function ScheduleBlock({
|
|||
className="rounded-full border px-5 py-2 text-sm font-semibold transition-colors"
|
||||
style={
|
||||
selected
|
||||
? { background: accent, borderColor: accent, color: '#ffffff' }
|
||||
: { borderColor: `${accent}55`, color: accent }
|
||||
? { background: accent, borderColor: accent, color: readableOn(accent) }
|
||||
: { borderColor: `${withAlpha(accent, 33)}`, color: accentText(accent) }
|
||||
}
|
||||
>
|
||||
{day.name || 'Schedule'}
|
||||
|
|
@ -273,7 +274,7 @@ export default function ScheduleBlock({
|
|||
id={`${baseId}-panel`}
|
||||
role={days.length > 1 ? 'tabpanel' : undefined}
|
||||
aria-labelledby={days.length > 1 ? `${baseId}-tab-${days.indexOf(current)}` : undefined}
|
||||
className="rounded-2xl border border-[#138ba0]/15 bg-white px-5"
|
||||
className="rounded-2xl border border-brand/15 bg-surface px-5"
|
||||
>
|
||||
{current.entries.map((entry, index) => (
|
||||
<Entry key={`${current.name}-${index}`} entry={entry} accent={accent} />
|
||||
|
|
|
|||
79
src/components/ThemeToggle.tsx
Normal file
79
src/components/ThemeToggle.tsx
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/* ═══════════════════════════════════════════════════════════════
|
||||
THEME TOGGLE
|
||||
|
||||
Light or dark. The theme lives on <html data-theme>, which
|
||||
index.html sets before the first paint (from this browser's
|
||||
choice, else the system setting) so a dark visitor never sees a
|
||||
white flash. Pressing this makes an explicit choice and remembers
|
||||
it; until then the site follows the system, including a change
|
||||
made while the page is open. Colours come from the tokens in
|
||||
index.css.
|
||||
═══════════════════════════════════════════════════════════════ */
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
type Theme = 'light' | 'dark'
|
||||
|
||||
export const THEME_STORAGE_KEY = 'ngu-theme'
|
||||
|
||||
const current = (): Theme =>
|
||||
document.documentElement.dataset.theme === 'dark' ? 'dark' : 'light'
|
||||
|
||||
function chosen(): Theme | null {
|
||||
try {
|
||||
const value = localStorage.getItem(THEME_STORAGE_KEY)
|
||||
return value === 'dark' || value === 'light' ? value : null
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export default function ThemeToggle({ className = '' }: { className?: string }) {
|
||||
const [theme, setTheme] = useState<Theme>(current)
|
||||
|
||||
// No choice made: follow the system as it changes.
|
||||
useEffect(() => {
|
||||
const media = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
const follow = () => {
|
||||
if (chosen()) return
|
||||
const next: Theme = media.matches ? 'dark' : 'light'
|
||||
document.documentElement.dataset.theme = next
|
||||
setTheme(next)
|
||||
}
|
||||
media.addEventListener('change', follow)
|
||||
return () => media.removeEventListener('change', follow)
|
||||
}, [])
|
||||
|
||||
const toggle = () => {
|
||||
const next: Theme = theme === 'dark' ? 'light' : 'dark'
|
||||
document.documentElement.dataset.theme = next
|
||||
setTheme(next)
|
||||
try {
|
||||
localStorage.setItem(THEME_STORAGE_KEY, next)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const dark = theme === 'dark'
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggle}
|
||||
aria-label={dark ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||
title={dark ? 'Light mode' : 'Dark mode'}
|
||||
className={`flex h-9 w-9 items-center justify-center rounded-full transition-colors ${className}`}
|
||||
>
|
||||
{dark ? (
|
||||
// Sun
|
||||
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="4" />
|
||||
<path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" strokeLinecap="round" />
|
||||
</svg>
|
||||
) : (
|
||||
// Moon
|
||||
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
|
||||
<path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z" strokeLinejoin="round" />
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ export default function VideoPlayer({
|
|||
{image ? (
|
||||
<img src={image} alt="" loading="lazy" className={`aspect-video w-full object-cover ${className}`} />
|
||||
) : (
|
||||
<div className={`aspect-video w-full bg-gradient-to-br from-[#073d4a] to-[#04262e] ${className}`} />
|
||||
<div className={`aspect-video w-full bg-[#073d4a] ${className}`} />
|
||||
)}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ export type MediaItem = {
|
|||
};
|
||||
|
||||
const button =
|
||||
"rounded-full border border-[#138ba0] px-3 py-1 text-sm font-medium text-[#0f7183] " +
|
||||
"transition-colors hover:bg-[#eef9fb] disabled:cursor-default disabled:opacity-50";
|
||||
"rounded-full border border-brand px-3 py-1 text-sm font-medium text-link " +
|
||||
"transition-colors hover:bg-tint disabled:cursor-default disabled:opacity-50";
|
||||
|
||||
/* A light checkerboard, so a white logo on a transparent background
|
||||
is still visible in its thumbnail. */
|
||||
|
|
@ -166,18 +166,18 @@ export function UploadButton({
|
|||
className="hidden"
|
||||
onChange={(e) => send(e.target.files)}
|
||||
/>
|
||||
<label htmlFor={keepId} className="flex items-center gap-1.5 text-xs text-[#4a6b72]">
|
||||
<label htmlFor={keepId} className="flex items-center gap-1.5 text-xs text-muted">
|
||||
<input
|
||||
id={keepId}
|
||||
type="checkbox"
|
||||
checked={keepOriginal}
|
||||
onChange={(e) => setKeepOriginal(e.target.checked)}
|
||||
className="h-3.5 w-3.5 rounded border-[#4a6b72]/40 text-[#0f7183]"
|
||||
className="h-3.5 w-3.5 rounded border-muted/40 text-link"
|
||||
/>
|
||||
Keep original
|
||||
</label>
|
||||
</div>
|
||||
{error && <p className="mt-1 text-xs text-[#b3261e]">{error}</p>}
|
||||
{error && <p className="mt-1 text-xs text-danger">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -200,7 +200,7 @@ export function MediaGrid({
|
|||
renderActions?: (item: MediaItem) => ReactNode;
|
||||
}) {
|
||||
if (items.length === 0) {
|
||||
return <p className="text-sm text-[#4a6b72]">Nothing here yet.</p>;
|
||||
return <p className="text-sm text-muted">Nothing here yet.</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -214,7 +214,7 @@ export function MediaGrid({
|
|||
// A still of the first frame; metadata only, not the file.
|
||||
<video src={item.url} preload="metadata" muted className="h-full w-full bg-black object-contain" />
|
||||
) : item.content_type.startsWith("audio/") ? (
|
||||
<div className="flex h-full w-full items-center justify-center bg-[#eef9fb] text-3xl" aria-hidden="true">
|
||||
<div className="flex h-full w-full items-center justify-center bg-tint text-3xl" aria-hidden="true">
|
||||
♪
|
||||
</div>
|
||||
) : (
|
||||
|
|
@ -226,18 +226,18 @@ export function MediaGrid({
|
|||
/>
|
||||
)}
|
||||
</div>
|
||||
<p className="mt-1.5 truncate text-xs font-medium text-[#26454c]" title={item.original_name}>
|
||||
<p className="mt-1.5 truncate text-xs font-medium text-body" title={item.original_name}>
|
||||
{item.original_name}
|
||||
</p>
|
||||
<p className="text-xs text-[#4a6b72]/80">{mediaSize(item)}</p>
|
||||
<p className="text-xs text-muted/80">{mediaSize(item)}</p>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<li
|
||||
key={item.id}
|
||||
className={`rounded-xl border bg-white p-2 ${
|
||||
isSelected ? "border-[#138ba0] ring-2 ring-[#138ba0]/30" : "border-[#4a6b72]/20"
|
||||
className={`rounded-xl border bg-surface p-2 ${
|
||||
isSelected ? "border-brand ring-2 ring-brand/30" : "border-muted/20"
|
||||
}`}
|
||||
>
|
||||
{onPick ? (
|
||||
|
|
@ -292,27 +292,27 @@ export function MediaPicker({
|
|||
className="w-[min(56rem,calc(100vw-2rem))] rounded-2xl p-0 backdrop:bg-[#0f2f36]/40"
|
||||
>
|
||||
<div className="flex max-h-[85vh] flex-col">
|
||||
<div className="flex flex-wrap items-center gap-3 border-b border-[#138ba0]/15 px-5 py-4">
|
||||
<h2 className="text-lg font-semibold text-[#0f7183]">Choose an image</h2>
|
||||
<div className="flex flex-wrap items-center gap-3 border-b border-brand/15 px-5 py-4">
|
||||
<h2 className="text-lg font-semibold text-link">Choose an image</h2>
|
||||
<input
|
||||
type="search"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Search by file name"
|
||||
className="ml-auto w-56 rounded-lg border border-[#4a6b72]/25 px-3 py-1.5 text-sm outline-none focus:border-[#138ba0]"
|
||||
className="ml-auto w-56 rounded-lg border border-muted/25 px-3 py-1.5 text-sm outline-none focus:border-brand"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => dialogRef.current?.close()}
|
||||
aria-label="Close"
|
||||
className="h-8 w-8 rounded-full text-[#4a6b72] hover:bg-[#eef9fb]"
|
||||
className="h-8 w-8 rounded-full text-muted hover:bg-tint"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{roleCanWrite(user) && (
|
||||
<div className="border-b border-[#138ba0]/10 px-5 py-3">
|
||||
<div className="border-b border-brand/10 px-5 py-3">
|
||||
<UploadButton
|
||||
label="Upload new"
|
||||
onUploaded={(item) => {
|
||||
|
|
@ -321,15 +321,15 @@ export function MediaPicker({
|
|||
dialogRef.current?.close();
|
||||
}}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-[#4a6b72]">{UPLOAD_HELP}</p>
|
||||
<p className="mt-1 text-xs text-muted">{UPLOAD_HELP}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="overflow-y-auto px-5 py-4">
|
||||
{error ? (
|
||||
<p className="text-sm text-[#b3261e]">{error}</p>
|
||||
<p className="text-sm text-danger">{error}</p>
|
||||
) : items === null ? (
|
||||
<p className="text-sm text-[#4a6b72]">Loading…</p>
|
||||
<p className="text-sm text-muted">Loading…</p>
|
||||
) : (
|
||||
<MediaGrid
|
||||
items={items}
|
||||
|
|
@ -375,13 +375,13 @@ export function ImageInput({
|
|||
return (
|
||||
<div className="flex gap-3">
|
||||
<div
|
||||
className="flex h-20 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[#4a6b72]/20"
|
||||
className="flex h-20 w-20 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-muted/20"
|
||||
style={CHECKER}
|
||||
>
|
||||
{src && !broken ? (
|
||||
<img src={src} alt="" className="h-full w-full object-contain" onError={() => setBroken(true)} />
|
||||
) : (
|
||||
<span className="px-1 text-center text-[10px] text-[#4a6b72]/70">
|
||||
<span className="px-1 text-center text-[10px] text-muted/70">
|
||||
{src ? "Not found" : "No image"}
|
||||
</span>
|
||||
)}
|
||||
|
|
@ -406,7 +406,7 @@ export function ImageInput({
|
|||
<button
|
||||
type="button"
|
||||
onClick={() => onChange("")}
|
||||
className="px-2 py-1 text-sm text-[#4a6b72] hover:text-[#b3261e]"
|
||||
className="px-2 py-1 text-sm text-muted hover:text-danger"
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
|
|
@ -498,7 +498,7 @@ export function LinkPreviewInput({
|
|||
{busy ? "Fetching…" : "Fetch preview"}
|
||||
</button>
|
||||
{note && (
|
||||
<span className={`text-xs ${note.tone === "ok" ? "text-[#0f7183]" : "text-[#b3261e]"}`}>
|
||||
<span className={`text-xs ${note.tone === "ok" ? "text-link" : "text-danger"}`}>
|
||||
{note.text}
|
||||
</span>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ function Label({ section }: { section: EditorSection }) {
|
|||
<>
|
||||
<span className="truncate">{section.label}</span>
|
||||
{section.count != null && (
|
||||
<span className="text-xs text-[#4a6b72]/70">({section.count})</span>
|
||||
<span className="text-xs text-muted/70">({section.count})</span>
|
||||
)}
|
||||
{section.hasError && (
|
||||
<span aria-label="needs attention" className="h-1.5 w-1.5 shrink-0 rounded-full bg-[#b3261e]" />
|
||||
<span aria-label="needs attention" className="h-1.5 w-1.5 shrink-0 rounded-full bg-danger" />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
@ -87,10 +87,10 @@ export function SectionNav({ sections }: { sections: EditorSection[] }) {
|
|||
|
||||
return (
|
||||
<nav aria-label="Sections" className="hidden max-h-[calc(100vh-8rem)] overflow-y-auto lg:block">
|
||||
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-[#4a6b72]/70">
|
||||
<p className="mb-2 px-3 text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||
On this page
|
||||
</p>
|
||||
<ul className="space-y-0.5 border-l border-[#138ba0]/15">
|
||||
<ul className="space-y-0.5 border-l border-brand/15">
|
||||
{sections.map((section) => {
|
||||
const lit = section.id === active;
|
||||
return (
|
||||
|
|
@ -101,8 +101,8 @@ export function SectionNav({ sections }: { sections: EditorSection[] }) {
|
|||
aria-current={lit ? "location" : undefined}
|
||||
className={`-ml-px flex w-full items-center gap-1.5 border-l-2 px-3 py-1.5 text-left text-sm transition-colors ${
|
||||
lit
|
||||
? "border-[#138ba0] font-semibold text-[#0f7183]"
|
||||
: "border-transparent text-[#4a6b72] hover:border-[#138ba0]/40 hover:text-[#0f7183]"
|
||||
? "border-brand font-semibold text-link"
|
||||
: "border-transparent text-muted hover:border-brand/40 hover:text-link"
|
||||
}`}
|
||||
>
|
||||
<Label section={section} />
|
||||
|
|
@ -120,13 +120,13 @@ export function SectionJump({ sections }: { sections: EditorSection[] }) {
|
|||
const active = useActiveSection(sections);
|
||||
|
||||
return (
|
||||
<div className="sticky top-0 z-20 -mx-6 mt-4 mb-2 border-b border-[#138ba0]/15 bg-[#f6fbfc]/95 px-6 py-2 backdrop-blur lg:hidden">
|
||||
<label className="flex items-center gap-3 text-sm text-[#4a6b72]">
|
||||
<div className="sticky top-0 z-20 -mx-6 mt-4 mb-2 border-b border-brand/15 bg-tint-soft/95 px-6 py-2 backdrop-blur lg:hidden">
|
||||
<label className="flex items-center gap-3 text-sm text-muted">
|
||||
<span className="shrink-0">Jump to</span>
|
||||
<select
|
||||
value={active ?? ""}
|
||||
onChange={(e) => jump(e.target.value)}
|
||||
className="w-full rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-1.5 text-sm text-[#26454c] outline-none focus:border-[#138ba0]"
|
||||
className="w-full rounded-lg border border-muted/25 bg-surface px-3 py-1.5 text-sm text-body outline-none focus:border-brand"
|
||||
>
|
||||
{sections.map((section) => (
|
||||
<option key={section.id} value={section.id}>
|
||||
|
|
|
|||
|
|
@ -104,24 +104,24 @@ const PREVIEWS = {
|
|||
};
|
||||
|
||||
const input =
|
||||
"w-full rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm text-[#26454c] " +
|
||||
"outline-none transition-colors focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
||||
"w-full rounded-lg border border-muted/25 bg-surface px-3 py-2 text-sm text-body " +
|
||||
"outline-none transition-colors focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||
|
||||
/* Same box, but lit by the real input nested inside it. */
|
||||
const inputShell =
|
||||
"flex w-full items-center rounded-lg border border-[#4a6b72]/25 bg-white px-3 py-2 text-sm " +
|
||||
"text-[#26454c] transition-colors focus-within:border-[#138ba0] focus-within:ring-2 " +
|
||||
"focus-within:ring-[#138ba0]/25";
|
||||
"flex w-full items-center rounded-lg border border-muted/25 bg-surface px-3 py-2 text-sm " +
|
||||
"text-body transition-colors focus-within:border-brand focus-within:ring-2 " +
|
||||
"focus-within:ring-brand/25";
|
||||
|
||||
const inputError = "border-[#b3261e] focus:border-[#b3261e] focus:ring-[#b3261e]/20";
|
||||
const inputError = "border-danger focus:border-danger focus:ring-danger/20";
|
||||
const shellError =
|
||||
"border-[#b3261e] focus-within:border-[#b3261e] focus-within:ring-[#b3261e]/20";
|
||||
"border-danger focus-within:border-danger focus-within:ring-danger/20";
|
||||
|
||||
/* Reads as settled fact rather than as an empty box someone forgot
|
||||
to fill in. */
|
||||
const inputLocked =
|
||||
"w-full rounded-lg border border-[#4a6b72]/20 bg-[#f6fbfc] px-3 py-2 text-sm " +
|
||||
"text-[#4a6b72] outline-none cursor-default focus:border-[#4a6b72]/40";
|
||||
"w-full rounded-lg border border-muted/20 bg-tint-soft px-3 py-2 text-sm " +
|
||||
"text-muted outline-none cursor-default focus:border-muted/40";
|
||||
|
||||
/* ── Dotted paths ────────────────────────────────────────────── */
|
||||
|
||||
|
|
@ -226,21 +226,21 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
|
||||
return (
|
||||
<div className={field.full ? "sm:col-span-2" : ""}>
|
||||
<label htmlFor={id} className="block text-sm font-medium text-[#26454c]">
|
||||
<label htmlFor={id} className="block text-sm font-medium text-body">
|
||||
{typeof field.label === "function" ? field.label(row) : field.label}
|
||||
{field.required && !locked && <span className="ml-1 text-[#b3261e]">*</span>}
|
||||
{field.required && !locked && <span className="ml-1 text-danger">*</span>}
|
||||
</label>
|
||||
|
||||
<div className="mt-1.5">
|
||||
{widget === "checkbox" ? (
|
||||
<label className="flex items-center gap-2 text-sm text-[#4a6b72]">
|
||||
<label className="flex items-center gap-2 text-sm text-muted">
|
||||
<input
|
||||
id={id}
|
||||
type="checkbox"
|
||||
checked={value === 1 || value === true}
|
||||
disabled={locked}
|
||||
onChange={(e) => onChange(e.target.checked ? 1 : 0)}
|
||||
className="h-4 w-4 rounded border-[#4a6b72]/40 text-[#0f7183] focus:ring-[#138ba0]/40 disabled:opacity-50"
|
||||
className="h-4 w-4 rounded border-muted/40 text-link focus:ring-brand/40 disabled:opacity-50"
|
||||
/>
|
||||
{helpText(field, row) ?? "Yes"}
|
||||
</label>
|
||||
|
|
@ -277,7 +277,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
value={/^#[0-9a-f]{6}$/i.test(value ?? "") ? value : "#138ba0"}
|
||||
disabled={locked}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
className="h-9 w-12 shrink-0 rounded border border-[#4a6b72]/25 bg-white disabled:opacity-50"
|
||||
className="h-9 w-12 shrink-0 rounded border border-muted/25 bg-surface disabled:opacity-50"
|
||||
/>
|
||||
<input
|
||||
{...common}
|
||||
|
|
@ -318,7 +318,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
<span
|
||||
aria-hidden="true"
|
||||
className={`shrink-0 select-none ${
|
||||
field.prefixPending ? "text-[#4a6b72]/45" : "text-[#4a6b72]"
|
||||
field.prefixPending ? "text-muted/45" : "text-muted"
|
||||
}`}
|
||||
>
|
||||
{field.prefix}
|
||||
|
|
@ -329,7 +329,7 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
value={value ?? ""}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
placeholder={field.placeholder}
|
||||
className="w-full border-0 bg-transparent p-0 text-[#26454c] outline-none placeholder:text-[#4a6b72]/45"
|
||||
className="w-full border-0 bg-transparent p-0 text-body outline-none placeholder:text-muted/45"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
|
|
@ -347,15 +347,15 @@ export function Field({ field, value, row, options, error, onChange, onPatch }:
|
|||
</div>
|
||||
|
||||
{error ? (
|
||||
<p className="mt-1 text-xs text-[#b3261e]">{error}</p>
|
||||
<p className="mt-1 text-xs text-danger">{error}</p>
|
||||
) : orphaned && !locked ? (
|
||||
<p className="mt-1 text-xs text-[#b3261e]">
|
||||
<p className="mt-1 text-xs text-danger">
|
||||
This points at something that has been deleted. Pick a replacement before saving.
|
||||
</p>
|
||||
) : (
|
||||
helpText(field, row) &&
|
||||
widget !== "checkbox" && (
|
||||
<p className="mt-1 text-xs text-[#4a6b72]">{helpText(field, row)}</p>
|
||||
<p className="mt-1 text-xs text-muted">{helpText(field, row)}</p>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
|
|
@ -467,25 +467,25 @@ export function Repeater({
|
|||
return (
|
||||
<section className={className}>
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<h3 className="text-base font-semibold text-[#26454c]">
|
||||
<h3 className="text-base font-semibold text-body">
|
||||
{spec.label}
|
||||
{list.length > 0 && (
|
||||
<span className="ml-2 text-sm font-normal text-[#4a6b72]/80">{list.length}</span>
|
||||
<span className="ml-2 text-sm font-normal text-muted/80">{list.length}</span>
|
||||
)}
|
||||
</h3>
|
||||
{list.length > 1 && (
|
||||
<div className="flex gap-3 text-xs text-[#4a6b72]">
|
||||
<div className="flex gap-3 text-xs text-muted">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(new Set(list.map((_, i) => i)))}
|
||||
className="hover:text-[#0f7183] hover:underline"
|
||||
className="hover:text-link hover:underline"
|
||||
>
|
||||
Expand all
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(new Set())}
|
||||
className="hover:text-[#0f7183] hover:underline"
|
||||
className="hover:text-link hover:underline"
|
||||
>
|
||||
Collapse all
|
||||
</button>
|
||||
|
|
@ -494,15 +494,15 @@ export function Repeater({
|
|||
<button
|
||||
type="button"
|
||||
onClick={add}
|
||||
className="ml-auto rounded-full border border-[#138ba0] px-3 py-1 text-sm font-medium text-[#0f7183] transition-colors hover:bg-[#eef9fb]"
|
||||
className="ml-auto rounded-full border border-brand px-3 py-1 text-sm font-medium text-link transition-colors hover:bg-tint"
|
||||
>
|
||||
{spec.addLabel ?? "Add"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{spec.note && <p className="mt-1 text-sm text-[#4a6b72]">{spec.note}</p>}
|
||||
{spec.note && <p className="mt-1 text-sm text-muted">{spec.note}</p>}
|
||||
|
||||
{list.length === 0 && <p className="mt-2 text-sm text-[#4a6b72]">None yet.</p>}
|
||||
{list.length === 0 && <p className="mt-2 text-sm text-muted">None yet.</p>}
|
||||
|
||||
<div className="mt-3 space-y-3">
|
||||
{list.map((row, index) => {
|
||||
|
|
@ -533,10 +533,10 @@ export function Repeater({
|
|||
endDrag();
|
||||
}}
|
||||
className={
|
||||
`rounded-xl border bg-[#f6fbfc] ${expanded ? "p-4" : "px-4 py-2.5"} transition-colors ` +
|
||||
`rounded-xl border bg-tint-soft ${expanded ? "p-4" : "px-4 py-2.5"} transition-colors ` +
|
||||
(over
|
||||
? "border-[#138ba0] ring-2 ring-[#138ba0]/25 "
|
||||
: "border-[#4a6b72]/20 ") +
|
||||
? "border-brand ring-2 ring-brand/25 "
|
||||
: "border-muted/20 ") +
|
||||
(dragging ? "opacity-50" : "")
|
||||
}
|
||||
>
|
||||
|
|
@ -556,7 +556,7 @@ export function Repeater({
|
|||
onDragEnd={endDrag}
|
||||
title="Drag to reorder"
|
||||
aria-hidden="true"
|
||||
className="cursor-grab select-none px-1 text-[#4a6b72]/60 active:cursor-grabbing"
|
||||
className="cursor-grab select-none px-1 text-muted/60 active:cursor-grabbing"
|
||||
>
|
||||
⠿
|
||||
</span>
|
||||
|
|
@ -565,11 +565,11 @@ export function Repeater({
|
|||
type="button"
|
||||
onClick={() => toggle(index)}
|
||||
aria-expanded={expanded}
|
||||
className="flex min-w-0 flex-1 items-center gap-2 text-left text-sm font-medium text-[#26454c] hover:text-[#0f7183]"
|
||||
className="flex min-w-0 flex-1 items-center gap-2 text-left text-sm font-medium text-body hover:text-link"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`inline-block text-xs text-[#4a6b72] transition-transform ${
|
||||
className={`inline-block text-xs text-muted transition-transform ${
|
||||
expanded ? "rotate-90" : ""
|
||||
}`}
|
||||
>
|
||||
|
|
@ -579,7 +579,7 @@ export function Repeater({
|
|||
{spec.title ? spec.title(row, options) : `#${index + 1}`}
|
||||
</span>
|
||||
{!expanded && hasError(index) && (
|
||||
<span className="text-xs text-[#b3261e]">needs attention</span>
|
||||
<span className="text-xs text-danger">needs attention</span>
|
||||
)}
|
||||
</button>
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ export function Repeater({
|
|||
{(spec.children ?? [])
|
||||
.filter((nested) => fieldShown(nested, row, parentRow))
|
||||
.map((nested) => (
|
||||
<div key={nested.key} className="mt-4 border-t border-[#4a6b72]/15 pt-4">
|
||||
<div key={nested.key} className="mt-4 border-t border-muted/15 pt-4">
|
||||
<Repeater
|
||||
spec={nested}
|
||||
rows={row[nested.key]}
|
||||
|
|
@ -657,8 +657,8 @@ export function Repeater({
|
|||
))}
|
||||
|
||||
{spec.preview && PREVIEWS[spec.preview] && (
|
||||
<div className="mt-4 rounded-lg border border-dashed border-[#138ba0]/30 bg-white p-4">
|
||||
<p className="mb-3 text-xs font-semibold uppercase tracking-wider text-[#4a6b72]/70">
|
||||
<div className="mt-4 rounded-lg border border-dashed border-brand/30 bg-surface p-4">
|
||||
<p className="mb-3 text-xs font-semibold uppercase tracking-wider text-muted/70">
|
||||
Preview
|
||||
</p>
|
||||
{PREVIEWS[spec.preview](row, options)}
|
||||
|
|
@ -685,10 +685,10 @@ function IconButton({ label, onClick, danger = false, disabled = false, children
|
|||
className={
|
||||
"h-7 w-7 rounded-full border text-sm leading-none transition-colors " +
|
||||
(disabled
|
||||
? "cursor-default border-[#4a6b72]/20 text-[#4a6b72]/40"
|
||||
? "cursor-default border-muted/20 text-muted/40"
|
||||
: danger
|
||||
? "border-[#b3261e]/30 text-[#b3261e] hover:bg-[#fdf3f2]"
|
||||
: "border-[#4a6b72]/30 text-[#4a6b72] hover:bg-white")
|
||||
? "border-danger/30 text-danger hover:bg-danger-tint"
|
||||
: "border-muted/30 text-muted hover:bg-surface")
|
||||
}
|
||||
>
|
||||
{children}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue