---
import InfoPageSections from "../../components/InfoPageSections.astro";
import SiteLayout from "../../layouts/SiteLayout.astro";
import { getInfoPage, infoPages } from "../../data/info";

export function getStaticPaths() {
  return infoPages.map((page) => ({
    params: { slug: page.slug },
  }));
}

const page = getInfoPage(Astro.params.slug!);

if (!page) {
  return Astro.redirect("/");
}
---

<SiteLayout title={page.title} description={page.title}>
  <section class="simple-hero simple-hero--info">
    <p class="eyebrow">Shared information</p>
    <h1>{page.title}</h1>
  </section>
  <div class="info-grid">
    <InfoPageSections page={page} />
  </div>
</SiteLayout>
