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
|
|
@ -24,6 +24,7 @@ import { blogImage } from '../../lib/media.ts'
|
|||
import { preview } from '../../lib/text.ts'
|
||||
import { postDate, useCommunityBlog, type BlogPostSummary } from '../../lib/useBlog.ts'
|
||||
import HomeLink from './home/HomeLink.tsx'
|
||||
import { accentText } from '../../lib/color.ts'
|
||||
|
||||
/* Headings for a half the admin didn't title. */
|
||||
const DEFAULTS = {
|
||||
|
|
@ -40,19 +41,19 @@ function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
|||
const authors = post.authors.map((author) => author.name).join(', ')
|
||||
|
||||
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">
|
||||
{cover ? (
|
||||
<img src={cover} alt="" loading="lazy" className="aspect-video w-full object-cover" />
|
||||
) : (
|
||||
<div className="aspect-video w-full bg-gradient-to-br from-[#eef9fb] to-[#d9f0f3]" />
|
||||
<div className="aspect-video w-full bg-tint" />
|
||||
)}
|
||||
<div className="flex flex-1 flex-col p-6">
|
||||
{(date || post.tags.length > 0) && (
|
||||
<p className="text-xs font-bold uppercase tracking-[0.2em]" style={{ color: accent }}>
|
||||
<p className="text-xs font-bold uppercase tracking-[0.2em]" style={{ color: accentText(accent) }}>
|
||||
{[date, ...post.tags].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
<h4 className="mt-2 font-display text-xl font-extrabold leading-snug text-[#073d4a]">
|
||||
<h4 className="mt-2 font-display text-xl font-extrabold leading-snug text-ink">
|
||||
<Link
|
||||
to={blogHref(post.id)}
|
||||
className="after:absolute after:inset-0 after:rounded-2xl after:content-[''] hover:underline"
|
||||
|
|
@ -61,9 +62,9 @@ function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
|||
</Link>
|
||||
</h4>
|
||||
{post.excerpt && (
|
||||
<p className="mt-2 leading-relaxed text-[#4a6b72]">{preview(post.excerpt, EXCERPT_CHARS)}</p>
|
||||
<p className="mt-2 leading-relaxed text-muted">{preview(post.excerpt, EXCERPT_CHARS)}</p>
|
||||
)}
|
||||
{authors && <p className="mt-auto pt-4 text-sm font-medium text-[#26454c]">By {authors}</p>}
|
||||
{authors && <p className="mt-auto pt-4 text-sm font-medium text-body">By {authors}</p>}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
|
|
@ -71,7 +72,7 @@ function PostCard({ post, accent }: { post: BlogPostSummary; accent: string }) {
|
|||
|
||||
function Subheading({ children, accent }: { children: string; accent: string }) {
|
||||
return (
|
||||
<h3 className="text-2xl font-extrabold" style={{ color: accent }}>
|
||||
<h3 className="text-2xl font-extrabold" style={{ color: accentText(accent) }}>
|
||||
{children}
|
||||
</h3>
|
||||
)
|
||||
|
|
@ -82,13 +83,13 @@ export default function CommunityBlog({ accent = '#0f7183' }: { accent?: string
|
|||
|
||||
if (!blog) {
|
||||
return (
|
||||
<div className="mx-auto max-w-6xl px-6 text-[#4a6b72]">
|
||||
<div className="mx-auto max-w-6xl px-6 text-muted">
|
||||
{loading ? (
|
||||
'Loading…'
|
||||
) : (
|
||||
<>
|
||||
Couldn’t load the blog. {error}{' '}
|
||||
<button type="button" onClick={reload} className="underline" style={{ color: accent }}>
|
||||
<button type="button" onClick={reload} className="underline" style={{ color: accentText(accent) }}>
|
||||
Try again
|
||||
</button>
|
||||
</>
|
||||
|
|
@ -102,7 +103,7 @@ export default function CommunityBlog({ accent = '#0f7183' }: { accent?: string
|
|||
const hasExternal = external.cards.length > 0 || Boolean(external.url)
|
||||
|
||||
if (!hasInternal && !hasExternal) {
|
||||
return <p className="mx-auto max-w-6xl px-6 text-center text-[#4a6b72]">· Posts coming soon ·</p>
|
||||
return <p className="mx-auto max-w-6xl px-6 text-center text-muted">· Posts coming soon ·</p>
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue