# Add the "CTA with Stats" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/cta-stats) to this Pantheon Content Publisher (P1) Next.js project. Oversized ask with two actions above a ruled strip of two to four key figures and a visible source or sample-data note.

## Steps

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

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

/**
 * CTA with Stats — a call to action whose case is made by numbers: heading, body and two
 * buttons above a ruled strip of two to four figures, with a visible source or sample note.
 * Register: `CtaStatsBlock: ctaStatsBlock` in puck.config.tsx.
 */

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

type Stat = { value: string; label: string };

export type CtaStatsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  primaryLabel: string;
  primaryHref: string;
  secondaryLabel: string;
  secondaryHref: string;
  stats: Stat[];
  statsNote: string;
};

const colsFor: Record<number, string> = { 1: "sm:grid-cols-1", 2: "sm:grid-cols-2", 3: "sm:grid-cols-3", 4: "sm:grid-cols-2 lg:grid-cols-4" };

export const ctaStatsBlock: ComponentConfig<CtaStatsProps> = {
  label: "CTA with Stats",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    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" },
    primaryLabel: { type: "text", label: "Primary button text", metadata: { help: "Leave blank to hide the button." } },
    primaryHref: { type: "text", label: "Primary button link" },
    secondaryLabel: { type: "text", label: "Secondary link text", metadata: { help: "Leave blank to hide the link." } },
    secondaryHref: { type: "text", label: "Secondary link" },
    stats: {
      type: "array",
      label: "Figures",
      min: 0,
      max: 4,
      getItemSummary: (item) => [item?.value, item?.label].filter(Boolean).join(" ") || "Figure",
      defaultItemProps: { value: "100", label: "What this number counts" },
      arrayFields: {
        value: { type: "text", label: "Figure", metadata: { help: "Type it as it should read, such as 1,240 or 92%. Can be bound to a data source." } },
        label: { type: "text", label: "Label", metadata: { help: "A few words saying what the figure counts." } },
      },
      metadata: { help: "Two to four figures read best." },
    },
    statsNote: {
      type: "text",
      label: "Figures note",
      metadata: { help: "Where the numbers come from, such as \"FY2025 annual report\". Required for real claims; leave the sample note until you replace the figures." },
    },
  },
  defaultProps: {
    eyebrow: "Riverfront Parks Foundation",
    heading: "Every acre we restore stays open to everyone, forever",
    headingLevel: "h2",
    body: "Members fund trail crews, native plantings and free summer programs in 14 city parks. Join this spring and your first year is matched by our board.",
    primaryLabel: "Become a member",
    primaryHref: "/membership",
    secondaryLabel: "See where the money goes",
    secondaryHref: "/annual-report",
    stats: [
      { value: "312", label: "acres of riverbank restored since 2015" },
      { value: "48 mi", label: "of trail maintained by volunteer crews" },
      { value: "9,600", label: "kids in free summer nature camps" },
      { value: "$0.89", label: "of every dollar spent on parks, not overhead" },
    ],
    statsNote: "Sample figures. Replace with your own and cite them, for example your annual report.",
  },
  render: ({ eyebrow, heading, headingLevel, body, primaryLabel, primaryHref, secondaryLabel, secondaryHref, stats, statsNote }) => {
    const H = headingLevel || "h2";
    const list = (stats ?? []).filter((s) => s?.value || s?.label);
    const hasIntro = Boolean(eyebrow || heading || body);
    const hasActions = Boolean(primaryLabel || secondaryLabel);
    if (!hasIntro && !hasActions && !list.length) 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="grid grid-cols-1 gap-10 lg:grid-cols-12 lg:items-end lg:gap-16">
            {hasIntro ? (
              <div className="lg:col-span-8">
                {eyebrow ? <p className="text-sm font-semibold tracking-widest text-indigo-700 uppercase">{eyebrow}</p> : null}
                {heading ? (
                  <H className={`text-4xl leading-tight font-semibold tracking-tight text-balance text-neutral-950 sm:text-5xl lg:text-6xl ${eyebrow ? "mt-4" : ""}`}>{heading}</H>
                ) : null}
                {body ? <p className="mt-6 max-w-2xl text-lg leading-8 text-pretty text-neutral-600">{body}</p> : null}
              </div>
            ) : null}
            {hasActions ? (
              <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 lg:col-span-4 lg:flex-col lg:items-start lg:gap-4">
                {primaryLabel ? (
                  <a
                    href={primaryHref || "#"}
                    className="inline-flex min-h-12 items-center justify-center rounded-full bg-indigo-600 px-7 py-3 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                  >
                    {primaryLabel}
                  </a>
                ) : null}
                {secondaryLabel ? (
                  <a
                    href={secondaryHref || "#"}
                    className="group inline-flex min-h-11 items-center justify-center gap-1.5 rounded px-1 text-base font-semibold text-neutral-950 underline decoration-neutral-300 underline-offset-4 transition hover:decoration-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                  >
                    {secondaryLabel}
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 text-indigo-600 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>

          {list.length ? (
            <div className={hasIntro || hasActions ? "mt-14 sm:mt-20" : ""}>
              <dl className={`grid grid-cols-1 border-t-2 border-neutral-950 ${colsFor[list.length] ?? colsFor[4]}`}>
                {list.map((s, i) => (
                  <div key={`${s.value}-${i}`} className="flex flex-col-reverse gap-2 border-b border-neutral-200 py-6 sm:border-b-0 sm:py-8 sm:pr-6 lg:border-l lg:pl-6 lg:first:border-l-0 lg:first:pl-0">
                    {s.label ? <dt className="max-w-xs text-sm leading-6 text-pretty text-neutral-600">{s.label}</dt> : null}
                    {s.value ? <dd className="text-4xl font-semibold tracking-tight text-neutral-950 tabular-nums sm:text-5xl">{s.value}</dd> : null}
                  </div>
                ))}
              </dl>
              {statsNote ? <p className="mt-4 text-xs leading-5 text-neutral-600">{statsNote}</p> : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
