/** * Each template's header (WEBSITE-1.0-PLAN §3, "Headers"), with its options from the Header style * setting. Every header collapses to a Menu button on phones (a
, so it works without * JavaScript). Links to the church's other sites (Events, App) sit next to the pages (§9). */ import Link from "next/link"; import { productLinks } from "@crosscode/ui"; import { ScrollSolid } from "./ScrollSolid"; import { cx } from "./parts"; import type { Published } from "./types"; type Item = { label: string; href: string; current: boolean }; function items(site: Published, path: string): { nav: Item[]; visit: Item | null } { const pages = site.snapshot.pages; const nav: Item[] = pages.filter((p) => p.inNav).map((p) => ({ label: p.navLabel, href: p.path, current: p.path === path })); for (const l of site.church ? productLinks(site.church.links, "website") : []) nav.push({ label: l.label, href: l.href, current: false }); const v = pages.find((p) => p.kind === "visit"); return { nav, visit: v ? { label: v.navLabel, href: v.path, current: v.path === path } : null }; } function Brand({ site, className, light }: { site: Published; className?: string; light?: boolean }) { const church = site.church; const name = church?.name ?? "Home"; return ( {church?.branding.logoUrl ? : {name}} ); } function Links({ nav, className, linkClass }: { nav: Item[]; className?: string; linkClass?: string }) { return ( ); } function MobileMenu({ nav, visit, className, always = false }: { nav: Item[]; visit: Item | null; className?: string; always?: boolean }) { return (
Menu
); } export function Header({ site, path }: { site: Published; path: string }) { const { template, style } = site.snapshot.design; const { nav, visit } = items(site, path); const option = style.header; if (template === "heritage") { const nextService = site.church?.serviceTimes[0]; return (
{option === "centred-top-bar" && (nextService || visit) && (
{nextService && Sundays {site.church!.serviceTimes.filter((s) => s.day === "sunday").map((s) => s.time).join(" & ") || nextService.time}} {visit && {visit.label}}
)}
); } if (template === "bold") { const transparent = !!site.transparentHeader[path]; return (
); } if (template === "community") { return (
); } // Clean: small, logo left, text navigation (or a menu on every width). const menuOnly = option === "small-menu"; return (
{!menuOnly && ( )}
); }