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
|
|
@ -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