# Add the "Newsletter Signup" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/newsletter-signup) to this Pantheon Content Publisher (P1) Next.js project. An email signup that posts to any form endpoint, with a real labelled input and no JavaScript.

## Steps

1. Create `components/puck/newsletter-signup-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 { newsletterSignupBlock } from "./components/puck/newsletter-signup-block";`
3. Register it under `components` as `NewsletterSignupBlock: newsletterSignupBlock`.
4. Add `"NewsletterSignupBlock"` to the best-fitting entry in `categories` (this block's library category is "Conversion"). 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/newsletter-signup-block.tsx`

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

/**
 * Newsletter Signup — an email form that posts straight to your list provider's endpoint.
 * Plain HTML form, no JavaScript. Register: `NewsletterSignupBlock: newsletterSignupBlock` in puck.config.tsx.
 */

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

export type NewsletterSignupProps = {
  heading: string;
  headingLevel: Heading;
  body: string;
  formAction: string;
  emailFieldName: string;
  inputLabel: string;
  placeholder: string;
  buttonLabel: string;
  privacyNote: string;
  layout: "panel" | "centered";
};

export const newsletterSignupBlock: ComponentConfig<NewsletterSignupProps> = {
  label: "Newsletter Signup",
  fields: {
    heading: { type: "text", label: "Heading" },
    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: "Body" },
    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. Check its embed code." },
    },
    inputLabel: { type: "text", label: "Field label", metadata: { help: "Read by screen readers. It isn't shown on the page." } },
    placeholder: { type: "text", label: "Placeholder", metadata: { help: "Example text inside the empty field." } },
    buttonLabel: { type: "text", label: "Button text" },
    privacyNote: { type: "textarea", label: "Privacy note", metadata: { help: "Short line under the form. Leave blank to hide it." } },
    layout: {
      type: "radio",
      label: "Layout",
      options: [
        { label: "Panel", value: "panel" },
        { label: "Centered", value: "centered" },
      ],
      metadata: { help: "Panel puts copy and form side by side on a dark card. Centered stacks them on the page background." },
    },
  },
  defaultProps: {
    heading: "Stay in the loop",
    headingLevel: "h2",
    body: "One email a month with new programs, volunteer days and park updates. Registration reminders go out before spots fill up.",
    formAction: "/newsletter/subscribe",
    emailFieldName: "email",
    inputLabel: "Email address",
    placeholder: "you@example.org",
    buttonLabel: "Subscribe",
    privacyNote: "We never share your address. Unsubscribe any time with one click.",
    layout: "panel",
  },
  render: ({ heading, headingLevel, body, formAction, emailFieldName, inputLabel, placeholder, buttonLabel, privacyNote, layout }) => {
    const H = headingLevel || "h2";
    const panel = layout !== "centered";

    const form = (
      <form action={formAction || undefined} method="post" className={panel ? "w-full" : "mx-auto mt-8 w-full max-w-md"}>
        <div className="flex flex-col gap-3 sm:flex-row">
          <label className="min-w-0 flex-1">
            <span className="sr-only">{inputLabel || "Email address"}</span>
            <input
              type="email"
              name={emailFieldName || "email"}
              required
              autoComplete="email"
              placeholder={placeholder || undefined}
              className={
                panel
                  ? "block min-h-12 w-full rounded-lg border-0 bg-white/10 px-4 py-3 text-base text-white ring-1 ring-white/20 ring-inset placeholder:text-neutral-400 focus:ring-2 focus:ring-indigo-400 focus:outline-none"
                  : "block min-h-12 w-full rounded-lg border-0 bg-white px-4 py-3 text-base text-neutral-950 shadow-sm ring-1 ring-neutral-300 ring-inset placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none"
              }
            />
          </label>
          <button
            type="submit"
            className={`inline-flex min-h-12 shrink-0 items-center justify-center rounded-lg bg-indigo-600 px-5 py-3 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 ${panel ? "focus-visible:outline-indigo-400" : "focus-visible:outline-indigo-600"}`}
          >
            {buttonLabel || "Subscribe"}
          </button>
        </div>
        {privacyNote ? (
          <p className={`mt-4 flex items-start gap-2 text-sm leading-6 ${panel ? "text-neutral-300" : "justify-center text-neutral-600"}`}>
            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className={`mt-0.5 size-4 shrink-0 ${panel ? "text-neutral-400" : "text-neutral-500"}`}>
              <path fillRule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clipRule="evenodd" />
            </svg>
            <span>{privacyNote}</span>
          </p>
        ) : null}
      </form>
    );

    if (panel) {
      return (
        <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
          <div className="relative isolate mx-auto max-w-7xl overflow-hidden rounded-3xl bg-neutral-950 px-6 py-12 shadow-xl sm:px-12 sm:py-16 lg:px-16">
            <svg aria-hidden="true" viewBox="0 0 400 400" fill="none" className="absolute -top-24 -right-24 -z-10 size-96 text-indigo-500/25">
              <circle cx="200" cy="200" r="80" stroke="currentColor" strokeWidth="1.5" />
              <circle cx="200" cy="200" r="130" stroke="currentColor" strokeWidth="1.5" />
              <circle cx="200" cy="200" r="180" stroke="currentColor" strokeWidth="1.5" />
            </svg>
            <div className="grid items-center gap-8 lg:grid-cols-2 lg:gap-16">
              <div>
                {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-white sm:text-4xl">{heading}</H> : null}
                {body ? <p className="mt-4 max-w-xl text-base leading-7 text-pretty text-neutral-300 sm:text-lg sm:leading-8">{body}</p> : null}
              </div>
              {form}
            </div>
          </div>
        </section>
      );
    }

    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-2xl text-center">
          {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
          {body ? <p className="mx-auto mt-4 max-w-xl text-base leading-7 text-pretty text-neutral-600 sm:text-lg sm:leading-8">{body}</p> : null}
          {form}
        </div>
      </section>
    );
  },
};
```
