# Add the "CTA Banner" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/cta-banner) to this Pantheon Content Publisher (P1) Next.js project. A focused call-to-action panel in three styles, left-aligned or centered.

## Steps

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

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

/**
 * CTA Banner — a rounded call-to-action panel with heading, short body and two links.
 * Indigo, dark or light-outline style; text left with buttons right, or centered.
 * Register: `CtaBannerBlock: ctaBannerBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type PanelStyle = "indigo" | "dark" | "light";

export type CtaBannerProps = {
  heading: string;
  headingLevel: Heading;
  body: string;
  primaryLabel: string;
  primaryHref: string;
  secondaryLabel: string;
  secondaryHref: string;
  style: PanelStyle;
  alignment: "split" | "center";
};

const themes: Record<PanelStyle, { panel: string; heading: string; body: string; primary: string; secondary: string; ring: string; decor: string }> = {
  indigo: {
    panel: "bg-indigo-700 shadow-xl",
    heading: "text-white",
    body: "text-indigo-100",
    primary: "bg-white text-indigo-700 shadow-sm hover:bg-indigo-50",
    secondary: "text-white",
    ring: "focus-visible:outline-white",
    decor: "text-white/10",
  },
  dark: {
    panel: "bg-neutral-950 shadow-xl",
    heading: "text-white",
    body: "text-neutral-300",
    primary: "bg-indigo-600 text-white shadow-sm hover:bg-indigo-500",
    secondary: "text-white",
    ring: "focus-visible:outline-white",
    decor: "text-white/10",
  },
  light: {
    panel: "bg-white ring-1 ring-neutral-200",
    heading: "text-neutral-950",
    body: "text-neutral-600",
    primary: "bg-indigo-600 text-white shadow-sm hover:bg-indigo-500",
    secondary: "text-neutral-900",
    ring: "focus-visible:outline-indigo-600",
    decor: "text-indigo-600/10",
  },
};

export const ctaBannerBlock: ComponentConfig<CtaBannerProps> = {
  label: "CTA Banner",
  fields: {
    heading: { type: "textarea", 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" },
    primaryLabel: { type: "text", label: "Primary button text" },
    primaryHref: { type: "text", label: "Primary button link", metadata: { help: "A path (/donate), full URL, #anchor, mailto: or tel:." } },
    secondaryLabel: { type: "text", label: "Secondary link text", metadata: { help: "Leave blank to hide it." } },
    secondaryHref: { type: "text", label: "Secondary link" },
    style: {
      type: "select",
      label: "Style",
      options: [
        { label: "Indigo panel", value: "indigo" },
        { label: "Dark panel", value: "dark" },
        { label: "Light outline", value: "light" },
      ],
      metadata: { help: "Use a solid panel to stand out from white sections, or the outline on colored pages." },
    },
    alignment: {
      type: "radio",
      label: "Layout",
      options: [
        { label: "Buttons right", value: "split" },
        { label: "Centered", value: "center" },
      ],
      metadata: { help: "On phones everything stacks; this sets the layout on wider screens." },
    },
  },
  defaultProps: {
    heading: "Help us plant 10,000 trees before the first frost",
    headingLevel: "h2",
    body: "Every $25 puts a native tree in the ground and pays for three years of watering by neighborhood stewards.",
    primaryLabel: "Plant a tree",
    primaryHref: "/donate",
    secondaryLabel: "Volunteer at a planting",
    secondaryHref: "/volunteer",
    style: "indigo",
    alignment: "split",
  },
  render: ({ heading, headingLevel, body, primaryLabel, primaryHref, secondaryLabel, secondaryHref, style, alignment }) => {
    const H = headingLevel || "h2";
    const t = themes[style] ?? themes.indigo;
    const centered = alignment === "center";
    const hasText = Boolean(heading || body);
    const hasActions = Boolean(primaryLabel || secondaryLabel);
    if (!hasText && !hasActions) return <></>;
    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-7xl">
          <div className={`relative isolate overflow-hidden rounded-3xl px-6 py-12 sm:px-12 sm:py-16 lg:px-16 ${t.panel}`}>
            <svg
              aria-hidden="true"
              viewBox="0 0 400 400"
              fill="none"
              stroke="currentColor"
              strokeWidth="1.5"
              className={`absolute -z-10 size-96 ${centered ? "-top-48 left-1/2 -translate-x-1/2" : "-right-32 -bottom-48 sm:-right-24"} ${t.decor}`}
            >
              <circle cx="200" cy="200" r="60" />
              <circle cx="200" cy="200" r="100" />
              <circle cx="200" cy="200" r="140" />
              <circle cx="200" cy="200" r="180" />
            </svg>

            <div className={centered ? "mx-auto flex max-w-2xl flex-col items-center text-center" : "flex flex-col gap-8 lg:flex-row lg:items-center lg:justify-between lg:gap-16"}>
              {hasText ? (
                <div className={centered ? "" : "max-w-2xl"}>
                  {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance sm:text-4xl ${t.heading}`}>{heading}</H> : null}
                  {body ? <p className={`${heading ? "mt-4" : ""} text-lg leading-8 text-pretty ${t.body}`}>{body}</p> : null}
                </div>
              ) : null}

              {hasActions ? (
                <div
                  className={`flex w-full flex-col gap-3 sm:w-auto sm:flex-row sm:items-center sm:gap-6 ${centered ? `${hasText ? "mt-10" : ""} sm:justify-center` : "lg:shrink-0"}`}
                >
                  {primaryLabel ? (
                    <a
                      href={primaryHref || "#"}
                      className={`inline-flex min-h-11 items-center justify-center rounded-lg px-6 py-3 text-base font-semibold transition focus-visible:outline-2 focus-visible:outline-offset-2 ${t.primary} ${t.ring}`}
                    >
                      {primaryLabel}
                    </a>
                  ) : null}
                  {secondaryLabel ? (
                    <a
                      href={secondaryHref || "#"}
                      className={`group inline-flex min-h-11 items-center justify-center gap-1.5 rounded-lg px-1 text-base font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 ${t.secondary} ${t.ring}`}
                    >
                      {secondaryLabel}
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 transition group-hover:translate-x-0.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>
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          </div>
        </div>
      </section>
    );
  },
};
```
