feat(website): the four templates and the public site

Heritage, Bold, Community and Clean drawing all 26 section variants
with their headers, homepage order and style settings; colours made
safe (WCAG AA) by the backend; fonts and corners from the shared brand
style. Publishing into numbered versions, the content API with live
messages and events and the church profile from Accounts, uploads,
every page kind, simple event pages, Coming soon, 404, sitemap, SEO
basics and the church's JSON-LD. The demo church (npm run demo) and
Playwright e2e: every template's pages pass axe and the SEO checks.
website.sh builds packages/seo. Decision 17 (first Owner) recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 10:59:03 +02:00
co-authored by Claude Opus 5.5
parent 138c73e20c
commit 5ed7201efa
45 changed files with 2704 additions and 63 deletions
+73
View File
@@ -0,0 +1,73 @@
/** Small building blocks every template uses. */
import type { Image } from "./types";
export const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" ");
/** An image in a frame (Heritage frames, duotone tints), or a soft placeholder when there's none. */
export function Img({ image, className, sizes = "(min-width: 768px) 50vw, 100vw", priority = false, ratio = "aspect-[4/3]" }: { image: Image | null; className?: string; sizes?: string; priority?: boolean; ratio?: string }) {
return (
<div className={cx("cc-frame", ratio, className)}>
{image ? (
<img src={image.url} alt={image.alt} sizes={sizes} width={image.width ?? undefined} height={image.height ?? undefined}
loading={priority ? "eager" : "lazy"} fetchPriority={priority ? "high" : undefined} decoding="async" className="cc-img" />
) : (
<div aria-hidden="true" className="h-full w-full bg-gradient-to-br from-brand/25 via-brand-tint to-accent/30" />
)}
</div>
);
}
export type ButtonData = { label: string; href: string } | null | undefined;
export function Button({ button, className }: { button: ButtonData; className?: string }) {
if (!button?.label || !button.href) return null;
const external = button.href.startsWith("https://");
return (
<a href={button.href} className={cx("cc-btn", className)} {...(external ? { rel: "noopener" } : {})}>
{button.label}
</a>
);
}
/** Text the admins wrote, as paragraphs (blank lines). Never HTML. */
export function Paragraphs({ text, className }: { text: string | null | undefined; className?: string }) {
if (!text) return null;
const paras = text.split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean);
return (
<div className={cx("cc-prose", className)}>
{paras.map((p, i) => <p key={i}>{p.split("\n").map((line, j) => <span key={j}>{j > 0 && <br />}{line}</span>)}</p>)}
</div>
);
}
const DAYS: Record<string, string> = { monday: "Monday", tuesday: "Tuesday", wednesday: "Wednesday", thursday: "Thursday", friday: "Friday", saturday: "Saturday", sunday: "Sunday" };
export const dayName = (d: string) => DAYS[d] ?? d;
export function fmtDate(iso: string, timeZone: string, opts: Intl.DateTimeFormatOptions = { weekday: "short", day: "numeric", month: "long" }) {
return new Intl.DateTimeFormat("en-ZA", { timeZone, ...opts }).format(new Date(iso));
}
export function fmtTime(iso: string, timeZone: string) {
return new Intl.DateTimeFormat("en-ZA", { timeZone, hour: "2-digit", minute: "2-digit", hour12: false }).format(new Date(iso));
}
/** Day and month in a box (event cards and lists). */
export function DateBadge({ iso, timeZone, className }: { iso: string; timeZone: string; className?: string }) {
return (
<div className={cx("flex w-16 shrink-0 flex-col items-center justify-center rounded-cc-sm bg-brand py-2 text-brand-on", className)} aria-hidden="true">
<span className="text-2xl font-bold leading-none">{fmtDate(iso, timeZone, { day: "numeric" })}</span>
<span className="text-xs uppercase tracking-wide">{fmtDate(iso, timeZone, { month: "short" })}</span>
</div>
);
}
export function SectionHeading({ eyebrow, heading, intro, centred = false, as: H = "h2" }: { eyebrow?: string | null; heading?: string | null; intro?: string | null; centred?: boolean; as?: "h1" | "h2" }) {
if (!heading && !eyebrow && !intro) return null;
return (
<div className={cx("mb-10", centred && "text-center")}>
{eyebrow && <p className="cc-eyebrow mb-2">{eyebrow}</p>}
{heading && <H className={H === "h1" ? "cc-h1" : "cc-h2"}>{heading}</H>}
{intro && <p className={cx("cc-muted mt-3 text-lg", centred && "mx-auto max-w-2xl")}>{intro}</p>}
</div>
);
}