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
|
|
@ -19,9 +19,10 @@ import { useState } from "react";
|
|||
import { post, ApiError } from "../../lib/api.ts";
|
||||
import { PAGE_LINKS, PAGE_SECTIONS } from "../../navConfig.ts";
|
||||
import { DATA_REQUEST, FEEDBACK_TYPES } from "../../data/feedbackTypes.ts";
|
||||
import { accentText } from '../../lib/color.ts'
|
||||
|
||||
const ACCENT = "#0f7183";
|
||||
const MUTED = "#4a6b72";
|
||||
const MUTED = "var(--color-muted)";
|
||||
const MAX_CHARS = 1500;
|
||||
const MIN_MESSAGE = 10; // matches the server
|
||||
|
||||
|
|
@ -34,17 +35,17 @@ const WHOLE_PAGE = "";
|
|||
/* ── Shared field chrome ─────────────────────────────────────── */
|
||||
|
||||
const fieldClass =
|
||||
"w-full rounded-xl border border-[#4a6b72]/25 bg-white px-4 py-3 text-[#26454c] " +
|
||||
"placeholder:text-[#4a6b72]/50 outline-none transition-colors " +
|
||||
"focus:border-[#138ba0] focus:ring-2 focus:ring-[#138ba0]/25";
|
||||
"w-full rounded-xl border border-muted/25 bg-surface px-4 py-3 text-body " +
|
||||
"placeholder:text-muted/50 outline-none transition-colors " +
|
||||
"focus:border-brand focus:ring-2 focus:ring-brand/25";
|
||||
|
||||
const errorFieldClass = "border-[#b3261e] focus:border-[#b3261e] focus:ring-[#b3261e]/20";
|
||||
const errorFieldClass = "border-danger focus:border-danger focus:ring-danger/20";
|
||||
|
||||
const selectClass = `${fieldClass} appearance-none pr-10`;
|
||||
|
||||
function OptionalTag() {
|
||||
return (
|
||||
<span className="ml-2 rounded-full bg-[#eef9fb] px-2 py-0.5 text-xs font-medium text-[#0f7183]">
|
||||
<span className="ml-2 rounded-full bg-tint px-2 py-0.5 text-xs font-medium text-link">
|
||||
Optional
|
||||
</span>
|
||||
);
|
||||
|
|
@ -53,7 +54,7 @@ function OptionalTag() {
|
|||
function FieldError({ id, children }) {
|
||||
if (!children) return null;
|
||||
return (
|
||||
<p id={id} className="mt-2 text-sm text-[#b3261e]">
|
||||
<p id={id} className="mt-2 text-sm text-danger">
|
||||
{children}
|
||||
</p>
|
||||
);
|
||||
|
|
@ -63,7 +64,7 @@ function FieldError({ id, children }) {
|
|||
function Select({ id, label, value, onChange, children }) {
|
||||
return (
|
||||
<div>
|
||||
<label htmlFor={id} className="block text-sm font-medium text-[#26454c]">
|
||||
<label htmlFor={id} className="block text-sm font-medium text-body">
|
||||
{label}
|
||||
</label>
|
||||
<div className="relative mt-2">
|
||||
|
|
@ -100,7 +101,7 @@ function Select({ id, label, value, onChange, children }) {
|
|||
function TypePicker({ value, onChange }) {
|
||||
return (
|
||||
<fieldset>
|
||||
<legend className="text-base font-semibold text-[#26454c]">
|
||||
<legend className="text-base font-semibold text-body">
|
||||
What kind of feedback is this?
|
||||
</legend>
|
||||
<p className="mt-1 text-sm" style={{ color: MUTED }}>
|
||||
|
|
@ -123,21 +124,21 @@ function TypePicker({ value, onChange }) {
|
|||
<span
|
||||
className={
|
||||
"flex h-full flex-col gap-1 rounded-xl border p-4 transition-colors " +
|
||||
"peer-focus-visible:ring-2 peer-focus-visible:ring-[#138ba0]/40 " +
|
||||
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand/40 " +
|
||||
(selected
|
||||
? "border-[#138ba0] bg-[#eef9fb]"
|
||||
: "border-[#4a6b72]/20 bg-white hover:border-[#138ba0]/50")
|
||||
? "border-brand bg-tint"
|
||||
: "border-muted/20 bg-surface hover:border-brand/50")
|
||||
}
|
||||
>
|
||||
<span className="flex items-start justify-between gap-2">
|
||||
<span className="font-semibold text-[#26454c]">{type.label}</span>
|
||||
<span className="font-semibold text-body">{type.label}</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={
|
||||
"mt-0.5 h-4 w-4 shrink-0 rounded-full border-2 transition-colors " +
|
||||
(selected
|
||||
? "border-[#138ba0] bg-[#0f7183] ring-2 ring-inset ring-white"
|
||||
: "border-[#4a6b72]/30")
|
||||
? "border-brand bg-action ring-2 ring-inset ring-white"
|
||||
: "border-muted/30")
|
||||
}
|
||||
/>
|
||||
</span>
|
||||
|
|
@ -161,7 +162,7 @@ function LocationPicker({ page, section, onPageChange, onSectionChange }) {
|
|||
return (
|
||||
<div>
|
||||
<div className="flex flex-wrap items-center">
|
||||
<h3 className="text-base font-semibold text-[#26454c]">
|
||||
<h3 className="text-base font-semibold text-body">
|
||||
Where did you run into it?
|
||||
</h3>
|
||||
<OptionalTag />
|
||||
|
|
@ -294,9 +295,9 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
return (
|
||||
<div
|
||||
aria-live="polite"
|
||||
className="rounded-2xl border border-[#138ba0]/20 bg-white p-8 sm:p-10"
|
||||
className="rounded-2xl border border-brand/20 bg-surface p-8 sm:p-10"
|
||||
>
|
||||
<h3 className="text-2xl font-bold" style={{ color: ACCENT }}>
|
||||
<h3 className="text-2xl font-bold" style={{ color: accentText(ACCENT) }}>
|
||||
Thanks, we've got it
|
||||
</h3>
|
||||
{where && (
|
||||
|
|
@ -314,7 +315,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
<button
|
||||
type="button"
|
||||
onClick={reset}
|
||||
className="mt-6 rounded-full border border-[#138ba0] px-5 py-2.5 font-semibold text-[#0f7183] transition-colors hover:bg-[#eef9fb] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#138ba0]/40"
|
||||
className="mt-6 rounded-full border border-brand px-5 py-2.5 font-semibold text-link transition-colors hover:bg-tint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40"
|
||||
>
|
||||
{request ? "Send another request" : "Send more feedback"}
|
||||
</button>
|
||||
|
|
@ -326,7 +327,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
<form
|
||||
onSubmit={handleSubmit}
|
||||
noValidate
|
||||
className="rounded-2xl border border-[#138ba0]/20 bg-white p-6 sm:p-8"
|
||||
className="rounded-2xl border border-brand/20 bg-surface p-6 sm:p-8"
|
||||
>
|
||||
{!fixedType && (
|
||||
<>
|
||||
|
|
@ -347,7 +348,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
<div className={fixedType ? "" : "mt-10"}>
|
||||
<label
|
||||
htmlFor="feedback-message"
|
||||
className="text-base font-semibold text-[#26454c]"
|
||||
className="text-base font-semibold text-body"
|
||||
>
|
||||
{request ? "Your request" : "Tell us more"}
|
||||
</label>
|
||||
|
|
@ -385,9 +386,9 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
</div>
|
||||
|
||||
{/* Optional contact details */}
|
||||
<div className="mt-8 rounded-xl border border-dashed border-[#4a6b72]/30 bg-[#eef9fb]/60 p-5 sm:p-6">
|
||||
<div className="mt-8 rounded-xl border border-dashed border-muted/30 bg-tint/60 p-5 sm:p-6">
|
||||
<div className="flex flex-wrap items-center">
|
||||
<h3 className="text-base font-semibold text-[#26454c]">
|
||||
<h3 className="text-base font-semibold text-body">
|
||||
{request ? "How we reach you" : "Your details"}
|
||||
</h3>
|
||||
{!request && <OptionalTag />}
|
||||
|
|
@ -402,9 +403,9 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
<div>
|
||||
<label
|
||||
htmlFor="feedback-name"
|
||||
className="block text-sm font-medium text-[#26454c]"
|
||||
className="block text-sm font-medium text-body"
|
||||
>
|
||||
Name <span className="font-normal text-[#4a6b72]">(optional)</span>
|
||||
Name <span className="font-normal text-muted">(optional)</span>
|
||||
</label>
|
||||
<input
|
||||
id="feedback-name"
|
||||
|
|
@ -418,10 +419,10 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
<div>
|
||||
<label
|
||||
htmlFor="feedback-email"
|
||||
className="block text-sm font-medium text-[#26454c]"
|
||||
className="block text-sm font-medium text-body"
|
||||
>
|
||||
Email{" "}
|
||||
<span className="font-normal text-[#4a6b72]">{request ? "(required)" : "(optional)"}</span>
|
||||
<span className="font-normal text-muted">{request ? "(required)" : "(optional)"}</span>
|
||||
</label>
|
||||
<input
|
||||
id="feedback-email"
|
||||
|
|
@ -459,7 +460,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
{formError && (
|
||||
<p
|
||||
role="alert"
|
||||
className="mt-8 rounded-xl border border-[#b3261e]/30 bg-[#fdf3f2] px-4 py-3 text-sm text-[#b3261e]"
|
||||
className="mt-8 rounded-xl border border-danger/30 bg-danger-tint px-4 py-3 text-sm text-danger"
|
||||
>
|
||||
{formError}
|
||||
</p>
|
||||
|
|
@ -469,7 +470,7 @@ export default function FeedbackForm({ fixedType }: { fixedType?: string } = {})
|
|||
<button
|
||||
type="submit"
|
||||
disabled={!ready || sending}
|
||||
className="rounded-full bg-[#0f7183] px-7 py-3 font-semibold text-white transition-colors hover:bg-[#0b5c6a] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#138ba0]/40 disabled:cursor-not-allowed disabled:bg-[#4a6b72]/25 disabled:text-white/80"
|
||||
className="rounded-full bg-action px-7 py-3 font-semibold text-white transition-colors hover:bg-action-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand/40 disabled:cursor-not-allowed disabled:bg-muted/25 disabled:text-white/80"
|
||||
>
|
||||
{sending ? "Sending…" : request ? "Send request" : "Send feedback"}
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue