/** * 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, Picture, 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 (

{d.headline}

{d.subline &&

{d.subline}

} {d.button &&
}
); } /** 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 (
{still ? :
} {video && (
); } function Fullbleed({ d, site, children }: { d: HeroData; site: SectionProps["site"]; children: React.ReactNode }) { return (
{children}
{/* The scrim the headline's contrast is checked against, not the photo (§3). */}
); } 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, section.data)); const first = imgs[0] ?? null; const video = media(site, d.videoId, section.data); const services = (site.church?.serviceTimes ?? []).filter((s) => s.day === "sunday").map((s) => s.time); if (variant === "text") { if (template === "bold") { return (
); } return (
{template === "clean" && services.length > 0 &&

Sundays {services.join(" & ")}

}
); } if (variant === "split") { const words =
; if (template === "bold") { return (
{first && }
); } return (
{words}
); } if (variant === "collage") { const three = [imgs[0] ?? null, imgs[1] ?? null, imgs[2] ?? null]; if (template === "bold") { return (
{three.map((im, i) =>
{im ? :
}
)}
); } if (template === "community") { return (
!x) ? "true" : undefined}>
); } return (
{template === "clean" &&
}
{three.map((im, i) => )}
{template !== "clean" &&
}
); } // photo (and video, drawn the same way with its loop). const visual = variant === "video" ?