# Add the "Footer — Newsletter" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/footer-newsletter) to this Pantheon Content Publisher (P1) Next.js project. Dark footer that leads with a large newsletter sign-up posting to your list provider, beside grouped link columns and a legal row.

## Steps

1. Create `components/puck/footer-newsletter-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 { footerNewsletterBlock } from "./components/puck/footer-newsletter-block";`
3. Register it under `components` as `FooterNewsletterBlock: footerNewsletterBlock`.
4. Add `"FooterNewsletterBlock"` 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-newsletter-block.tsx`

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

/**
 * Footer (Newsletter) — a dark footer that leads with a large newsletter sign-up beside grouped
 * link columns, then a legal row. The form is a plain POST to your list provider; no JavaScript.
 * Register: `FooterNewsletterBlock: footerNewsletterBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

export type FooterNewsletterProps = {
  heading: string;
  headingLevel: Heading;
  body: string;
  formAction: string;
  emailFieldName: string;
  emailLabel: string;
  buttonLabel: string;
  formNote: string;
  navLabel: string;
  groups: { label: string; links: { label: string; href: string }[] }[];
  orgName: string;
  copyrightYear: string;
  legalLinks: { label: string; href: string }[];
};

const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white";

export const footerNewsletterBlock: ComponentConfig<FooterNewsletterProps> = {
  label: "Footer (Newsletter)",
  fields: {
    heading: { type: "textarea", label: "Newsletter heading", metadata: { help: "Leave blank, with the form action, to hide the sign-up." } },
    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." },
    },
    body: { type: "textarea", label: "Newsletter text", metadata: { help: "What people get and how often. Leave blank to hide it." } },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: { help: "From your list provider's embed code (the form's action attribute). Always sent with POST. Leave blank to hide the form." },
    },
    emailFieldName: { type: "text", label: "Email field name", metadata: { help: "The name your provider expects, like email or EMAIL." } },
    emailLabel: { type: "text", label: "Email field label", metadata: { help: "Read by screen readers and shown as the placeholder." } },
    buttonLabel: { type: "text", label: "Button text" },
    formNote: { type: "text", label: "Note under the form", metadata: { help: "A privacy promise, like how to unsubscribe. Leave blank to hide it." } },
    navLabel: { type: "text", label: "Navigation name", metadata: { help: "Read by screen readers, like Footer." } },
    groups: {
      type: "array",
      label: "Link columns",
      min: 0,
      max: 3,
      getItemSummary: (item) => item?.label || "Column",
      defaultItemProps: { label: "New column", links: [{ label: "New link", href: "/" }] },
      arrayFields: {
        label: { type: "text", label: "Column label" },
        links: {
          type: "array",
          label: "Links",
          min: 1,
          max: 8,
          getItemSummary: (item) => item?.label || "Link",
          defaultItemProps: { label: "New link", href: "/" },
          arrayFields: {
            label: { type: "text", label: "Label" },
            href: { type: "text", label: "Link" },
          },
        },
      },
    },
    orgName: { type: "text", label: "Organization name", metadata: { help: "Used in the copyright line." } },
    copyrightYear: { type: "text", label: "Copyright year", metadata: { help: "Like 2026. Update it each January." } },
    legalLinks: {
      type: "array",
      label: "Legal links",
      min: 0,
      max: 5,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "/" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
    },
  },
  defaultProps: {
    heading: "The Watershed Weekly, in your inbox every Thursday",
    headingLevel: "h2",
    body: "River levels, volunteer cleanups and the policy votes that affect your water. Five minutes to read, written by our field staff.",
    formAction: "/newsletter/subscribe",
    emailFieldName: "email",
    emailLabel: "Email address",
    buttonLabel: "Subscribe",
    formNote: "One email a week. Unsubscribe with one click, any time.",
    navLabel: "Footer",
    groups: [
      {
        label: "Our work",
        links: [
          { label: "Water monitoring", href: "/monitoring" },
          { label: "Restoration", href: "/restoration" },
          { label: "Policy & advocacy", href: "/policy" },
          { label: "Annual report", href: "/report" },
        ],
      },
      {
        label: "Get involved",
        links: [
          { label: "Volunteer", href: "/volunteer" },
          { label: "River cleanups", href: "/cleanups" },
          { label: "Become a member", href: "/join" },
          { label: "Donate", href: "/donate" },
        ],
      },
      {
        label: "About",
        links: [
          { label: "Staff & board", href: "/team" },
          { label: "Careers", href: "/careers" },
          { label: "Press", href: "/press" },
          { label: "Contact", href: "/contact" },
        ],
      },
    ],
    orgName: "Green River Watershed Alliance",
    copyrightYear: "2026",
    legalLinks: [
      { label: "Privacy", href: "/privacy" },
      { label: "Accessibility", href: "/accessibility" },
      { label: "Terms", href: "/terms" },
    ],
  },
  render: ({ id, heading, headingLevel, body, formAction, emailFieldName, emailLabel, buttonLabel, formNote, navLabel, groups, orgName, copyrightYear, legalLinks }) => {
    const H = headingLevel || "h2";
    const uid = `footer-news-${id}`;
    const cols = (groups ?? []).filter((g) => g?.label || (g?.links ?? []).some((l) => l?.label));
    const legal = (legalLinks ?? []).filter((l) => l?.label);
    const action = (formAction || "").trim();
    const hasSignup = Boolean(heading || body || action);
    const colClass = cols.length >= 3 ? "sm:grid-cols-3" : cols.length === 2 ? "sm:grid-cols-2" : "";

    return (
      <footer className="bg-neutral-950 px-4 pt-16 pb-8 text-neutral-300 sm:px-6 sm:pt-20 lg:px-8 lg:pt-24">
        <div className="mx-auto max-w-7xl">
          {hasSignup || cols.length ? (
            <div className="grid grid-cols-1 gap-14 lg:grid-cols-12 lg:gap-8">
              {hasSignup ? (
                <div className={cols.length ? "lg:col-span-6 xl:col-span-5" : "lg:col-span-8"}>
                  {heading ? <H className="text-3xl leading-tight font-semibold tracking-tight text-balance text-white sm:text-4xl">{heading}</H> : null}
                  {body ? <p className={`${heading ? "mt-4" : ""} max-w-lg text-base leading-7 text-pretty text-neutral-400`}>{body}</p> : null}
                  {action ? (
                    <form action={action} method="post" className="mt-8 max-w-md">
                      <div className="flex flex-col gap-3 sm:flex-row">
                        <label htmlFor={`${uid}-email`} className="sr-only">
                          {emailLabel || "Email address"}
                        </label>
                        <input
                          id={`${uid}-email`}
                          type="email"
                          name={emailFieldName || "email"}
                          autoComplete="email"
                          required
                          placeholder={emailLabel || "Email address"}
                          aria-describedby={formNote ? `${uid}-note` : undefined}
                          className="block min-h-12 w-full min-w-0 flex-1 rounded-full border-0 bg-white/5 px-5 text-base text-white ring-1 ring-white/20 ring-inset placeholder:text-neutral-400 focus:ring-2 focus:ring-white focus:outline-none"
                        />
                        <button
                          type="submit"
                          className={`inline-flex min-h-12 shrink-0 items-center justify-center rounded-full bg-white px-6 text-base font-semibold text-neutral-950 transition hover:bg-indigo-100 ${focusRing}`}
                        >
                          {buttonLabel || "Subscribe"}
                        </button>
                      </div>
                      {formNote ? (
                        <p id={`${uid}-note`} className="mt-3 pl-1 text-sm text-neutral-400">
                          {formNote}
                        </p>
                      ) : null}
                    </form>
                  ) : null}
                </div>
              ) : null}

              {cols.length ? (
                <nav aria-label={navLabel || "Footer"} className={hasSignup ? "lg:col-span-6 xl:col-span-6 xl:col-start-7" : "lg:col-span-12"}>
                  <div className={`grid grid-cols-1 gap-10 ${colClass}`}>
                    {cols.map((g, i) => {
                      const gid = `${uid}-g${i}`;
                      return (
                        <div key={`${g.label}-${i}`}>
                          {g.label ? (
                            <p id={gid} className="text-sm font-semibold text-white">
                              {g.label}
                            </p>
                          ) : null}
                          <ul role="list" aria-labelledby={g.label ? gid : undefined} className={g.label ? "mt-3" : ""}>
                            {(g.links ?? [])
                              .filter((l) => l?.label)
                              .map((l, j) => (
                                <li key={`${l.label}-${j}`}>
                                  <a href={l.href || "#"} className={`inline-flex min-h-11 items-center rounded text-sm text-neutral-400 transition hover:text-white ${focusRing}`}>
                                    {l.label}
                                  </a>
                                </li>
                              ))}
                          </ul>
                        </div>
                      );
                    })}
                  </div>
                </nav>
              ) : null}
            </div>
          ) : null}

          {orgName || copyrightYear || legal.length ? (
            <div className={`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between ${hasSignup || cols.length ? "mt-16 border-t border-white/10 pt-6" : ""}`}>
              {orgName || copyrightYear ? (
                <p className="text-sm text-neutral-400">
                  © {copyrightYear ? `${copyrightYear} ` : ""}
                  {orgName}
                </p>
              ) : null}
              {legal.length ? (
                <ul role="list" aria-label="Legal" className="-mx-2 flex flex-wrap">
                  {legal.map((l, i) => (
                    <li key={`${l.label}-${i}`}>
                      <a href={l.href || "#"} className={`inline-flex min-h-11 items-center rounded px-2 text-sm text-neutral-400 transition hover:text-white ${focusRing}`}>
                        {l.label}
                      </a>
                    </li>
                  ))}
                </ul>
              ) : null}
            </div>
          ) : null}
        </div>
      </footer>
    );
  },
};
```
