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
@@ -0,0 +1,167 @@
/**
* The hero (WEBSITE-1.0-PLAN §3): Photo · Video · Collage · Split · Text only, each drawn in the
* template's way. Bold fills the screen with the headline over a dark scrim; Heritage frames the
* image under its centred header; Community overlaps rounded photos; Clean never puts text on a
* photo.
*/
import { media } from "../load";
import { Button, cx, Img, type ButtonData } from "../parts";
import type { Image, SectionProps } from "../types";
type HeroData = { headline: string; subline: string | null; images: string[]; videoId: string | null; button: ButtonData };
function Words({ d, centred, light, size = "cc-h1" }: { d: HeroData; centred?: boolean; light?: boolean; size?: string }) {
return (
<div className={cx(centred && "text-center")}>
<h1 className={cx(size, light && "text-white")}>{d.headline}</h1>
{d.subline && <p className={cx("mt-5 text-lg sm:text-xl", light ? "text-white/90" : "cc-muted", centred && "mx-auto max-w-2xl")}>{d.subline}</p>}
{d.button && <div className={cx("mt-8", light && "cc-on-dark")}><Button button={d.button} /></div>}
</div>
);
}
/** A muted loop over its still; phones and reduced motion get the still only (§3). */
function Video({ video, still, className }: { video: Image | null; still: Image | null; className?: string }) {
return (
<div className={cx("relative h-full w-full", className)}>
{still ? <img src={still.url} alt={still.alt} className="cc-img absolute inset-0" fetchPriority="high" /> : <div className="absolute inset-0 bg-brand" />}
{video && (
<video className="cc-motion cc-img absolute inset-0 hidden sm:block" src={video.url} poster={still?.url} autoPlay muted loop playsInline aria-hidden="true" />
)}
</div>
);
}
function Fullbleed({ d, site, children }: { d: HeroData; site: SectionProps["site"]; children: React.ReactNode }) {
return (
<section className="cc-section-hero relative isolate flex min-h-[85vh] items-end overflow-hidden bg-gray-900 pb-16 pt-32 sm:pb-24">
<div className="absolute inset-0 -z-10">{children}</div>
{/* The scrim the headline's contrast is checked against, not the photo (§3). */}
<div className="absolute inset-0 -z-10 bg-gradient-to-t from-black/85 via-black/50 to-black/30" aria-hidden="true" />
<div className="cc-wrap">
<div className="max-w-3xl"><Words d={d} light /></div>
</div>
{site.snapshot.design.style.images === "duotone" && <div className="absolute inset-0 -z-10 bg-brand mix-blend-multiply" aria-hidden="true" />}
</section>
);
}
export function Hero({ section, site, template }: SectionProps) {
const d = section.data as unknown as HeroData;
const variant = section.variant ?? "photo";
const imgs = (d.images ?? []).map((id) => media(site, id));
const first = imgs[0] ?? null;
const video = media(site, d.videoId);
const services = (site.church?.serviceTimes ?? []).filter((s) => s.day === "sunday").map((s) => s.time);
if (variant === "text") {
if (template === "bold") {
return (
<section className="cc-section-hero bg-brand pb-20 pt-36 text-brand-on sm:pb-28">
<div className="cc-wrap"><div className="max-w-4xl"><Words d={d} light /></div></div>
</section>
);
}
return (
<section className={cx("cc-section-hero py-20 sm:py-28", template === "community" && "bg-brand-tint")}>
<div className={cx("cc-wrap", template === "heritage" && "text-center")}>
<div className={cx(template === "heritage" ? "mx-auto max-w-3xl" : "max-w-3xl")}>
<Words d={d} centred={template === "heritage"} size={template === "clean" ? "cc-h1 sm:text-7xl" : "cc-h1"} />
{template === "clean" && services.length > 0 && <p className="mt-8 border-l-4 border-accent pl-4 text-lg">Sundays {services.join(" & ")}</p>}
</div>
</div>
</section>
);
}
if (variant === "split") {
const words = <div className="flex flex-col justify-center p-8 sm:p-12"><Words d={d} /></div>;
if (template === "bold") {
return (
<section className="cc-section-hero grid bg-gray-950 text-white md:min-h-[80vh] md:grid-cols-2">
<div className="relative min-h-[50vh] md:order-2">{first && <img src={first.url} alt={first.alt} className="cc-img absolute inset-0" fetchPriority="high" />}</div>
<div className="flex flex-col justify-center px-6 pb-16 pt-32 sm:px-12"><Words d={d} light /></div>
</section>
);
}
return (
<section className={cx("cc-section-hero py-10 sm:py-16", template === "community" && "bg-brand-tint")}>
<div className="cc-wrap grid items-center gap-8 md:grid-cols-2">
{words}
<Img image={first} priority ratio="aspect-[4/3]" className={cx(template === "community" && "rounded-[2rem]")} />
</div>
</section>
);
}
if (variant === "collage") {
const three = [imgs[0] ?? null, imgs[1] ?? null, imgs[2] ?? null];
if (template === "bold") {
return (
<Fullbleed d={d} site={site}>
<div className="grid h-full grid-cols-3 gap-1">
{three.map((im, i) => <div key={i} className="relative">{im ? <img src={im.url} alt={im.alt} className="cc-img absolute inset-0" /> : <div className="absolute inset-0 bg-brand/60" />}</div>)}
</div>
</Fullbleed>
);
}
if (template === "community") {
return (
<section className="cc-section-hero overflow-hidden bg-brand-tint py-14 sm:py-20">
<div className="cc-wrap grid items-center gap-12 md:grid-cols-2">
<Words d={d} />
<div className="relative mx-auto h-80 w-full max-w-md sm:h-96" aria-hidden={three.every((x) => !x) ? "true" : undefined}>
<div className="absolute -right-10 top-4 h-72 w-72 rounded-full bg-accent/30 blur-2xl" aria-hidden="true" />
<Img image={three[0]} priority ratio="" className="absolute left-0 top-0 h-56 w-56 rotate-[-4deg] rounded-[2rem] shadow-xl sm:h-64 sm:w-64" />
<Img image={three[1]} ratio="" className="absolute bottom-0 left-16 h-44 w-44 rotate-[3deg] rounded-[2rem] shadow-xl sm:h-52 sm:w-52" />
<Img image={three[2]} ratio="" className="absolute right-0 top-16 h-40 w-40 rotate-[6deg] rounded-full shadow-xl sm:h-48 sm:w-48" />
</div>
</div>
</section>
);
}
return (
<section className="cc-section-hero py-12 sm:py-16">
<div className="cc-wrap">
{template === "clean" && <div className="mb-10 max-w-3xl"><Words d={d} /></div>}
<div className="grid grid-cols-3 gap-3 sm:gap-4">
{three.map((im, i) => <Img key={i} image={im} priority={i === 0} ratio={template === "heritage" ? "aspect-[3/4]" : "aspect-square"} />)}
</div>
{template !== "clean" && <div className="mx-auto mt-10 max-w-3xl"><Words d={d} centred /></div>}
</div>
</section>
);
}
// photo (and video, drawn the same way with its loop).
const visual = variant === "video" ? <Video video={video} still={first} /> : first ? <img src={first.url} alt={first.alt} className="cc-img absolute inset-0" fetchPriority="high" /> : null;
if (template === "bold") return <Fullbleed d={d} site={site}>{visual ?? <div className="h-full w-full bg-brand" />}</Fullbleed>;
if (template === "heritage") {
return (
<section className="cc-section-hero pb-14">
<div className="cc-wrap">
<div className="cc-frame relative aspect-[16/7]">{visual}</div>
<div className="mx-auto mt-12 max-w-3xl"><Words d={d} centred /></div>
</div>
</section>
);
}
if (template === "community") {
return (
<section className="cc-section-hero pb-12">
<div className="relative aspect-[16/9] max-h-[75vh] w-full overflow-hidden sm:aspect-[21/9]" style={{ clipPath: "ellipse(120% 100% at 50% 0%)" }}>{visual}</div>
<div className="cc-wrap -mt-24 relative sm:-mt-32">
<div className="max-w-2xl rounded-[2rem] bg-white p-8 shadow-xl sm:p-10"><Words d={d} /></div>
</div>
</section>
);
}
return (
<section className="cc-section-hero py-16 sm:py-24">
<div className="cc-wrap">
<div className="max-w-3xl"><Words d={d} /></div>
<div className="cc-frame relative mt-12 aspect-[16/9]">{visual}</div>
</div>
</section>
);
}