# Add the "Mega Footer" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/footer-mega) to this Pantheon Content Publisher (P1) Next.js project. Site footer with link columns, address and contact, social links, a newsletter form and a legal row.

## Steps

1. Create `components/puck/footer-mega-block.tsx` with the exact file contents below. If `components/puck/` doesn't exist, find the folder where this project keeps its Puck components (look at the imports in `puck.config.tsx`) and put it there.
2. In `puck.config.tsx`, import it: `import { footerMegaBlock } from "./components/puck/footer-mega-block";`
3. Register it under `components` as `FooterMegaBlock: footerMegaBlock`.
4. Add `"FooterMegaBlock"` to the best-fitting entry in `categories` (this block's library category is "Footers"). Create a category only if none fits.
5. Run the project's type check (usually `pnpm typecheck`) and resolve anything project-specific.
6. If `package.json` has a `sync:registry` script, tell the user it must run (or that CI will run it) before the new component appears in the P1 editor.

## Rules

- Do not add dependencies. The block is self-contained by design: one type-only import from `@puckeditor/core`, Tailwind v4 classes, no client JavaScript.
- Keep the files as-is unless the user asks for changes. The accent color is `indigo-*`; if the project has brand colors, offer to swap them with a find-and-replace on `indigo-`.
- Images are plain `imageUrl` + `imageAlt` text fields. If this project defines a P1 media-library field (search for `"p1-media"`), offer to switch to it.
- Don't change prop names in `defaultProps`. Content editors' saved pages depend on them.

## File: `components/puck/footer-mega-block.tsx`

```tsx
import type { ComponentConfig } from "@puckeditor/core";

/**
 * Footer (Mega) — site-wide footer with link columns, address and contact, social links,
 * a no-JavaScript newsletter form and a legal row. Register: `FooterMegaBlock: footerMegaBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Platform = "facebook" | "instagram" | "x" | "linkedin" | "youtube" | "other";

export type FooterMegaProps = {
  orgName: string;
  tagline: string;
  address: string;
  phone: string;
  email: string;
  headingLevel: Heading;
  groups: { heading: string; links: { label: string; href: string }[] }[];
  socials: { platform: Platform; label: string; href: string }[];
  newsletterHeading: string;
  newsletterBody: string;
  formAction: string;
  emailFieldName: string;
  buttonLabel: string;
  copyrightYear: string;
  copyrightHolder: string;
  legalLinks: { label: string; href: string }[];
};

const platformNames: Record<Platform, string> = {
  facebook: "Facebook",
  instagram: "Instagram",
  x: "X",
  linkedin: "LinkedIn",
  youtube: "YouTube",
  other: "Website",
};

function SocialIcon({ platform }: { platform: Platform }) {
  const cls = "size-5";
  switch (platform) {
    case "facebook":
      return (
        <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor" className={cls}>
          <path d="M14.5 8H13a1 1 0 0 0-1 1v2h2.5l-.4 3H12v7H9v-7H7v-3h2V8.6A3.6 3.6 0 0 1 12.6 5h1.9v3Z" />
        </svg>
      );
    case "instagram":
      return (
        <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" className={cls}>
          <rect x="3.5" y="3.5" width="17" height="17" rx="5" />
          <circle cx="12" cy="12" r="3.75" />
          <circle cx="17.25" cy="6.75" r="1" fill="currentColor" stroke="none" />
        </svg>
      );
    case "x":
      return (
        <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor" className={cls}>
          <path d="M4 4h4.6l11.4 16h-4.6L4 4Z" />
          <path d="M18.4 4h1.9l-6.4 7.3-1-1.4L18.4 4ZM10.9 13.2l1 1.4L5.6 20H3.7l7.2-6.8Z" />
        </svg>
      );
    case "linkedin":
      return (
        <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor" className={cls}>
          <path
            fillRule="evenodd"
            clipRule="evenodd"
            d="M4.5 3h15A1.5 1.5 0 0 1 21 4.5v15a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 19.5v-15A1.5 1.5 0 0 1 4.5 3Zm2.25 7v7.5h2.5V10h-2.5ZM8 5.9a1.4 1.4 0 1 0 0 2.8 1.4 1.4 0 0 0 0-2.8ZM11 10v7.5h2.5v-4c0-1 .6-1.6 1.4-1.6.8 0 1.3.6 1.3 1.6v4h2.5v-4.6c0-2.2-1.2-3.1-2.8-3.1-1.1 0-1.9.5-2.4 1.2V10H11Z"
          />
        </svg>
      );
    case "youtube":
      return (
        <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor" className={cls}>
          <path fillRule="evenodd" clipRule="evenodd" d="M5 5h14a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3Zm5 4v6l5.2-3L10 9Z" />
        </svg>
      );
    default:
      return (
        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className={cls}>
          <path d="M12.232 4.232a2.5 2.5 0 0 1 3.536 3.536l-1.225 1.224a.75.75 0 0 0 1.061 1.06l1.224-1.224a4 4 0 0 0-5.656-5.656l-3 3a4 4 0 0 0 .225 5.865.75.75 0 0 0 .977-1.138 2.5 2.5 0 0 1-.142-3.667l3-3Z" />
          <path d="M11.603 7.963a.75.75 0 0 0-.977 1.138 2.5 2.5 0 0 1 .142 3.667l-3 3a2.5 2.5 0 0 1-3.536-3.536l1.225-1.224a.75.75 0 0 0-1.061-1.06l-1.224 1.224a4 4 0 1 0 5.656 5.656l3-3a4 4 0 0 0-.225-5.865Z" />
        </svg>
      );
  }
}

const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";
const linkBase = `inline-flex min-h-11 items-center rounded text-sm transition hover:text-indigo-700 hover:underline hover:underline-offset-4 ${focusRing}`;
const textLink = `${linkBase} text-neutral-700`;

export const footerMegaBlock: ComponentConfig<FooterMegaProps> = {
  label: "Footer (Mega)",
  fields: {
    orgName: { type: "text", label: "Organization name" },
    tagline: { type: "textarea", label: "Tagline", metadata: { help: "One sentence about who you are. Leave blank to hide it." } },
    address: { type: "textarea", label: "Address", metadata: { help: "One line per row, exactly as it should appear." } },
    phone: { type: "text", label: "Phone", metadata: { help: "Shown as typed. The tap-to-call link is built from the digits." } },
    email: { type: "text", label: "Email" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Sets the page outline for screen readers and search. The look doesn't change. Applies to the column and newsletter headings." },
    },
    groups: {
      type: "array",
      label: "Link columns",
      min: 0,
      max: 5,
      getItemSummary: (item) => item?.heading || "Column",
      defaultItemProps: { heading: "New column", links: [{ label: "New link", href: "/" }] },
      arrayFields: {
        heading: { type: "text", label: "Heading" },
        links: {
          type: "array",
          label: "Links",
          min: 1,
          max: 10,
          getItemSummary: (item) => item?.label || "Link",
          defaultItemProps: { label: "New link", href: "/" },
          arrayFields: {
            label: { type: "text", label: "Label" },
            href: { type: "text", label: "Link" },
          },
        },
      },
    },
    socials: {
      type: "array",
      label: "Social links",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.label || platformNames[item?.platform as Platform] || "Social link",
      defaultItemProps: { platform: "facebook", label: "", href: "" },
      arrayFields: {
        platform: {
          type: "select",
          label: "Platform",
          options: [
            { label: "Facebook", value: "facebook" },
            { label: "Instagram", value: "instagram" },
            { label: "X", value: "x" },
            { label: "LinkedIn", value: "linkedin" },
            { label: "YouTube", value: "youtube" },
            { label: "Other", value: "other" },
          ],
        },
        label: { type: "text", label: "Screen reader label", metadata: { help: "Optional. Defaults to the platform name, like Facebook." } },
        href: { type: "text", label: "Profile link" },
      },
    },
    newsletterHeading: { type: "text", label: "Newsletter heading", metadata: { help: "Leave blank to hide the newsletter form." } },
    newsletterBody: { type: "textarea", label: "Newsletter text" },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: { help: "Where the form sends the email address, from your list provider's embed code (the form's action attribute). Always sent with POST." },
    },
    emailFieldName: { type: "text", label: "Email field name", metadata: { help: "The name your provider expects for the email input, like email or EMAIL." } },
    buttonLabel: { type: "text", label: "Button text" },
    copyrightYear: { type: "text", label: "Copyright year", metadata: { help: "Like 2026. Update it each January." } },
    copyrightHolder: { type: "text", label: "Copyright holder", metadata: { help: "Defaults to the organization name." } },
    legalLinks: {
      type: "array",
      label: "Legal links",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "/" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
    },
  },
  defaultProps: {
    orgName: "Riverbend Parks & Recreation",
    tagline: "Caring for 42 parks, 68 miles of trail and the people who use them since 1951.",
    address: "Riverbend Parks Administration\n500 Water Street, Suite 200\nRiverbend, OH 45202",
    phone: "(513) 555-0187",
    email: "hello@riverbendparks.org",
    headingLevel: "h2",
    groups: [
      {
        heading: "Visit",
        links: [
          { label: "Find a park", href: "/parks" },
          { label: "Trail conditions", href: "/parks/trails" },
          { label: "Shelter rentals", href: "/parks/shelters" },
          { label: "Park rules", href: "/parks/rules" },
        ],
      },
      {
        heading: "Programs",
        links: [
          { label: "Youth & teens", href: "/programs/youth" },
          { label: "Adults & seniors", href: "/programs/adults" },
          { label: "Adaptive recreation", href: "/programs/adaptive" },
          { label: "Financial aid", href: "/programs/aid" },
        ],
      },
      {
        heading: "Get involved",
        links: [
          { label: "Volunteer", href: "/volunteer" },
          { label: "Donate", href: "/donate" },
          { label: "Board meetings", href: "/board" },
          { label: "Jobs", href: "/jobs" },
        ],
      },
    ],
    socials: [
      { platform: "facebook", label: "", href: "https://facebook.com/" },
      { platform: "instagram", label: "", href: "https://instagram.com/" },
      { platform: "youtube", label: "", href: "https://youtube.com/" },
    ],
    newsletterHeading: "The monthly Trailhead",
    newsletterBody: "New programs, volunteer days and registration reminders. One email a month.",
    formAction: "/newsletter/subscribe",
    emailFieldName: "email",
    buttonLabel: "Subscribe",
    copyrightYear: "2026",
    copyrightHolder: "",
    legalLinks: [
      { label: "Accessibility", href: "/accessibility" },
      { label: "Privacy", href: "/privacy" },
      { label: "Public records", href: "/records" },
      { label: "Site map", href: "/sitemap" },
    ],
  },
  render: ({ id, orgName, tagline, address, phone, email, headingLevel, groups, socials, newsletterHeading, newsletterBody, formAction, emailFieldName, buttonLabel, copyrightYear, copyrightHolder, legalLinks }) => {
    const H = headingLevel || "h2";
    const lines = (address || "").split("\n").map((l) => l.trim()).filter(Boolean);
    const tel = (phone || "").replace(/[^\d+]/g, "");
    const mail = (email || "").trim();
    const cols = (groups ?? []).filter((g) => g?.heading || g?.links?.length);
    const social = (socials ?? []).filter((s) => s?.href);
    const legal = (legalLinks ?? []).filter((l) => l?.label);
    const holder = copyrightHolder || orgName;
    const newsId = `footer-news-${id}`;

    return (
      <footer className="border-t border-neutral-200 bg-neutral-50 px-4 pt-16 pb-8 sm:px-6 sm:pt-20 lg:px-8">
        <div className="mx-auto max-w-7xl">
          <div className="grid grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-8">
            <div className="lg:col-span-4">
              {orgName ? <p className="text-lg font-semibold tracking-tight text-neutral-950">{orgName}</p> : null}
              {tagline ? <p className="mt-3 max-w-sm text-sm leading-6 text-pretty text-neutral-600">{tagline}</p> : null}
              {lines.length ? (
                <address className="mt-6 text-sm leading-6 text-neutral-700 not-italic">
                  {lines.map((line, i) => (
                    <span key={i} className="block">
                      {line}
                    </span>
                  ))}
                </address>
              ) : null}
              {tel || mail ? (
                <ul role="list" className="mt-3">
                  {tel ? (
                    <li>
                      <a href={`tel:${tel}`} className={`${linkBase} font-semibold text-neutral-950 tabular-nums`}>
                        {phone}
                      </a>
                    </li>
                  ) : null}
                  {mail ? (
                    <li className="min-w-0">
                      <a href={`mailto:${mail}`} className={`${linkBase} font-semibold break-all text-neutral-950`}>
                        {mail}
                      </a>
                    </li>
                  ) : null}
                </ul>
              ) : null}
              {social.length ? (
                <ul role="list" className="mt-6 flex flex-wrap gap-2">
                  {social.map((s, i) => {
                    const platform: Platform = s.platform || "other";
                    return (
                      <li key={`${s.href}-${i}`}>
                        <a
                          href={s.href}
                          className={`grid size-11 place-items-center rounded-full bg-white text-neutral-600 ring-1 ring-neutral-200 transition hover:-translate-y-0.5 hover:text-indigo-700 hover:ring-indigo-200 ${focusRing}`}
                        >
                          <span className="sr-only">{s.label || platformNames[platform]}</span>
                          <SocialIcon platform={platform} />
                        </a>
                      </li>
                    );
                  })}
                </ul>
              ) : null}
            </div>

            {cols.length ? (
              <div className="grid grid-cols-1 gap-10 sm:grid-cols-2 md:grid-cols-3 lg:col-span-8">
                {cols.map((col, i) => {
                  const colLinks = (col.links ?? []).filter((l) => l?.label);
                  return (
                    <div key={`${col.heading}-${i}`}>
                      {col.heading ? <H className="text-sm font-semibold text-neutral-950">{col.heading}</H> : null}
                      {colLinks.length ? (
                        <ul role="list" className={col.heading ? "mt-3" : ""}>
                          {colLinks.map((l, j) => (
                            <li key={`${l.label}-${j}`}>
                              <a href={l.href || "#"} className={textLink}>
                                {l.label}
                              </a>
                            </li>
                          ))}
                        </ul>
                      ) : null}
                    </div>
                  );
                })}
              </div>
            ) : null}
          </div>

          {newsletterHeading ? (
            <div className="mt-14 grid grid-cols-1 items-center gap-6 rounded-2xl bg-white p-6 ring-1 ring-neutral-200 sm:p-8 lg:grid-cols-2 lg:gap-12">
              <div>
                <H id={newsId} className="text-base font-semibold text-neutral-950">
                  {newsletterHeading}
                </H>
                {newsletterBody ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-600">{newsletterBody}</p> : null}
              </div>
              <form action={formAction || undefined} method="post" aria-labelledby={newsId} className="flex w-full flex-col gap-3 sm:flex-row">
                <label className="min-w-0 flex-1">
                  <span className="sr-only">Email address</span>
                  <input
                    type="email"
                    name={emailFieldName || "email"}
                    required
                    autoComplete="email"
                    placeholder="you@example.org"
                    className="block min-h-11 w-full rounded-lg border-0 bg-white px-4 py-2.5 text-base text-neutral-950 ring-1 ring-neutral-300 ring-inset placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none sm:text-sm"
                  />
                </label>
                <button
                  type="submit"
                  className={`inline-flex min-h-11 shrink-0 items-center justify-center rounded-lg bg-indigo-600 px-5 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-700 ${focusRing}`}
                >
                  {buttonLabel || "Subscribe"}
                </button>
              </form>
            </div>
          ) : null}

          {holder || legal.length ? (
            <div className="mt-12 flex flex-col gap-4 border-t border-neutral-200 pt-6 sm:flex-row sm:items-center sm:justify-between">
              {holder ? (
                <p className="text-sm leading-6 text-neutral-600">
                  &copy; {copyrightYear ? `${copyrightYear} ` : ""}
                  {holder}
                </p>
              ) : (
                <span />
              )}
              {legal.length ? (
                <nav aria-label="Legal">
                  <ul role="list" className="flex flex-wrap gap-x-6">
                    {legal.map((l, i) => (
                      <li key={`${l.label}-${i}`}>
                        <a href={l.href || "#"} className={`${linkBase} text-neutral-600`}>
                          {l.label}
                        </a>
                      </li>
                    ))}
                  </ul>
                </nav>
              ) : null}
            </div>
          ) : null}
        </div>
      </footer>
    );
  },
};
```
