LegalTemplate.tsx32 lines · main
| 1 | import type { LegalPage } from '../schemas' |
| 2 | import HeroSection from '../sections/HeroSection' |
| 3 | import SectionRenderer, { type CustomSectionRenderers } from '../sections/SectionRenderer' |
| 4 | import TableOfContents from '../sections/TableOfContents' |
| 5 | import TextBodySection from '../sections/TextBodySection' |
| 6 | |
| 7 | export default function LegalTemplate({ |
| 8 | page, |
| 9 | customRenderers, |
| 10 | }: { |
| 11 | page: LegalPage |
| 12 | customRenderers?: CustomSectionRenderers |
| 13 | }) { |
| 14 | const hero = page.effectiveDate |
| 15 | ? { ...page.hero, subtitle: `Effective date: ${page.effectiveDate}` } |
| 16 | : page.hero |
| 17 | |
| 18 | return ( |
| 19 | <div className="flex flex-col gap-16 sm:gap-24"> |
| 20 | <HeroSection section={hero} compact /> |
| 21 | <div className="grid grid-cols-1 lg:grid-cols-[220px_1fr] gap-24 max-w-5xl mx-auto px-8 w-full"> |
| 22 | <div className="hidden lg:block"> |
| 23 | <TableOfContents content={page.body} /> |
| 24 | </div> |
| 25 | <TextBodySection section={{ content: page.body }} /> |
| 26 | </div> |
| 27 | {page.sections?.map((section, i) => ( |
| 28 | <SectionRenderer key={i} section={section} customRenderers={customRenderers} /> |
| 29 | ))} |
| 30 | </div> |
| 31 | ) |
| 32 | } |