# Add the "CTA Closing Statement" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/cta-closing-statement) to this Pantheon Content Publisher (P1) Next.js project. End-of-page dark band with a monumental statement, one accent phrase, a single button and an optional phone and email line.

## Steps

1. Create `components/puck/cta-closing-statement-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 { ctaClosingStatementBlock } from "./components/puck/cta-closing-statement-block";`
3. Register it under `components` as `CtaClosingStatementBlock: ctaClosingStatementBlock`.
4. Add `"CtaClosingStatementBlock"` 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/cta-closing-statement-block.tsx`

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

/**
 * CTA Closing Statement — an end-of-page band: a monumental statement on near-black with one
 * phrase in the accent color (wrap it in *asterisks*), one button and an optional contact line.
 * Register: `CtaClosingStatementBlock: ctaClosingStatementBlock` in puck.config.tsx.
 */

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

export type CtaClosingStatementProps = {
  kicker: string;
  statement: string;
  headingLevel: Heading;
  body: string;
  ctaLabel: string;
  ctaHref: string;
  contactLabel: string;
  phone: string;
  email: string;
};

function renderHighlighted(text: string) {
  return text.split(/(\*[^*]+\*)/g).map((part, i) =>
    part.length > 2 && part.startsWith("*") && part.endsWith("*") ? (
      <em key={i} className="font-serif font-normal text-indigo-300 italic">
        {part.slice(1, -1)}
      </em>
    ) : (
      part
    ),
  );
}

export const ctaClosingStatementBlock: ComponentConfig<CtaClosingStatementProps> = {
  label: "CTA Closing Statement",
  fields: {
    kicker: { type: "text", label: "Kicker", metadata: { help: "Small line above the statement. Leave blank to hide it." } },
    statement: {
      type: "textarea",
      label: "Statement",
      metadata: { help: "Keep it under about 14 words. Wrap one phrase in *asterisks* to set it in the accent color." },
    },
    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", metadata: { help: "One or two sentences under the statement. Leave blank to hide it." } },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    ctaHref: { type: "text", label: "Button link" },
    contactLabel: { type: "text", label: "Contact line label", metadata: { help: "Such as \"Questions? Talk to our membership team\". Leave it, the phone and the email blank to hide the line." } },
    phone: { type: "text", label: "Phone", metadata: { help: "Shown as typed and linked for tap-to-call." } },
    email: { type: "text", label: "Email" },
  },
  defaultProps: {
    kicker: "Northfield Museum of Art & History",
    statement: "The collection belongs to the city. *Come see what's yours.*",
    headingLevel: "h2",
    body: "Admission is free every Thursday evening and always free for Northfield students, teachers and members.",
    ctaLabel: "Plan your visit",
    ctaHref: "/visit",
    contactLabel: "Bringing a group? Talk to our visitor services team",
    phone: "(608) 555-0172",
    email: "visit@northfieldmuseum.org",
  },
  render: ({ kicker, statement, headingLevel, body, ctaLabel, ctaHref, contactLabel, phone, email }) => {
    const H = headingLevel || "h2";
    const tel = (phone || "").replace(/[^\d+]/g, "");
    const hasContact = Boolean(contactLabel || phone || email);
    if (!kicker && !statement && !body && !ctaLabel && !hasContact) return <></>;
    const linkClass =
      "inline-flex min-h-11 items-center rounded px-1 font-semibold break-all text-white underline decoration-white/30 underline-offset-4 transition hover:decoration-indigo-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white";

    return (
      <section className="relative isolate overflow-hidden bg-neutral-950 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div aria-hidden="true" className="absolute inset-x-0 top-0 -z-10 h-px bg-linear-to-r from-transparent via-indigo-400/50 to-transparent" />
        <div className="mx-auto max-w-7xl">
          {kicker ? (
            <p className="flex items-center gap-3 text-sm font-semibold tracking-widest text-neutral-300 uppercase">
              <span aria-hidden="true" className="h-px w-10 bg-indigo-400" />
              {kicker}
            </p>
          ) : null}
          {statement ? (
            <H className={`max-w-5xl text-4xl leading-none font-semibold tracking-tighter text-balance text-white sm:text-6xl lg:text-7xl xl:text-8xl ${kicker ? "mt-8" : ""}`}>
              {renderHighlighted(statement)}
            </H>
          ) : null}

          {body || ctaLabel ? (
            <div className={`flex flex-col gap-8 lg:flex-row lg:items-end lg:justify-between lg:gap-16 ${kicker || statement ? "mt-10 sm:mt-14" : ""}`}>
              {body ? <p className="max-w-xl text-lg leading-8 text-pretty text-neutral-300">{body}</p> : <span className="hidden lg:block" />}
              {ctaLabel ? (
                <a
                  href={ctaHref || "#"}
                  className="group inline-flex min-h-14 shrink-0 items-center justify-center gap-3 self-start rounded-full bg-white py-3 pr-3 pl-7 text-lg font-semibold text-neutral-950 transition hover:bg-indigo-100 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-white lg:self-auto"
                >
                  {ctaLabel}
                  <span aria-hidden="true" className="flex size-10 items-center justify-center rounded-full bg-indigo-600 text-white transition group-hover:translate-x-1">
                    <svg viewBox="0 0 20 20" fill="currentColor" className="size-5">
                      <path fillRule="evenodd" d="M3 10a.75.75 0 0 1 .75-.75h10.64l-3.22-3.22a.75.75 0 1 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.75A.75.75 0 0 1 3 10Z" clipRule="evenodd" />
                    </svg>
                  </span>
                </a>
              ) : null}
            </div>
          ) : null}

          {hasContact ? (
            <p className="mt-12 flex flex-col gap-x-6 gap-y-1 border-t border-white/15 pt-6 text-base leading-7 text-neutral-300 sm:mt-16 sm:flex-row sm:flex-wrap sm:items-center">
              {contactLabel ? <span>{contactLabel}</span> : null}
              {phone ? (
                <a href={`tel:${tel}`} className={`-mx-1 ${linkClass}`}>
                  {phone}
                </a>
              ) : null}
              {email ? (
                <a href={`mailto:${email}`} className={`-mx-1 ${linkClass}`}>
                  {email}
                </a>
              ) : null}
            </p>
          ) : null}
        </div>
      </section>
    );
  },
};
```
