# Add the "Stats Hero" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/hero-stats) to this Pantheon Content Publisher (P1) Next.js project. Headline and calls to action over a wide photo, with three or four sourced key figures docked on its bottom edge.

## Steps

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

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

/**
 * Hero (Stats) — headline, supporting copy and calls to action over a wide photo, with a
 * row of three or four key figures docked along the photo's bottom edge.
 * Register: `HeroStatsBlock: heroStatsBlock` in puck.config.tsx.
 */

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

export type HeroStatsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  primaryLabel: string;
  primaryHref: string;
  secondaryLabel: string;
  secondaryHref: string;
  imageUrl: string;
  imageAlt: string;
  stats: { value: string; label: string }[];
  source: string;
};

const ARROW = "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";

const STAT_COLS: 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 heroStatsBlock: ComponentConfig<HeroStatsProps> = {
  label: "Hero (Stats)",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    heading: { type: "textarea", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1 (page title)", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Use H1 when this hero is the top of the page. 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" },
    imageUrl: { type: "text", label: "Image URL", metadata: { help: "A wide photo. Leave blank and the figures sit on a plain band instead." } },
    imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for screen reader users. Leave blank only if it's purely decorative." } },
    stats: {
      type: "array",
      label: "Figures",
      min: 1,
      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: "Value", metadata: { help: "Keep it short: 12,400 or 94% or $2.1M." } },
        label: { type: "text", label: "Label" },
      },
    },
    source: { type: "text", label: "Source", metadata: { help: "Where the figures come from, shown under them. Required if the numbers are claims." } },
  },
  defaultProps: {
    eyebrow: "Northgate Community College",
    heading: "An education that pays off close to home",
    headingLevel: "h1",
    body: "Two-year degrees, short-term certificates and transfer pathways built with the employers and four-year universities in our region.",
    primaryLabel: "Apply for fall",
    primaryHref: "/apply",
    secondaryLabel: "Explore programs",
    secondaryHref: "/programs",
    imageUrl: "https://picsum.photos/seed/campusquad/2000/900",
    imageAlt: "Students crossing a sunny campus quad between brick buildings",
    stats: [
      { value: "14,200", label: "Students enrolled this year" },
      { value: "$4,180", label: "Average annual tuition, in-district" },
      { value: "92%", label: "Graduates employed or transferred" },
      { value: "70+", label: "Degree and certificate programs" },
    ],
    source: "Sample figures for illustration, not real data. Cite your own sources, such as your IPEDS submission or graduate survey.",
  },
  render: ({ eyebrow, heading, headingLevel, body, primaryLabel, primaryHref, secondaryLabel, secondaryHref, imageUrl, imageAlt, stats, source }) => {
    const H = headingLevel || "h1";
    const list = (stats ?? []).filter((s) => s?.value || s?.label).slice(0, 4);
    const cols = STAT_COLS[list.length] ?? STAT_COLS[4];
    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-8 lg:grid-cols-12 lg:items-end lg:gap-16">
            <div className="lg:col-span-7">
              {eyebrow ? <p className="text-sm font-semibold text-indigo-700">{eyebrow}</p> : null}
              {heading ? (
                <H className={`${eyebrow ? "mt-3" : ""} text-4xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-5xl lg:text-6xl`}>{heading}</H>
              ) : null}
            </div>
            <div className="lg:col-span-5">
              {body ? <p className="text-lg leading-8 text-pretty text-neutral-600">{body}</p> : null}
              {primaryLabel || secondaryLabel ? (
                <div className="mt-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6">
                  {primaryLabel ? (
                    <a
                      href={primaryHref || "#"}
                      className="inline-flex min-h-11 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-500 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-lg px-1 text-base font-semibold text-neutral-900 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 transition group-hover:translate-x-0.5">
                        <path fillRule="evenodd" d={ARROW} clipRule="evenodd" />
                      </svg>
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          </div>

          <div className="relative mt-12 sm:mt-16">
            {imageUrl ? (
              <img
                src={imageUrl}
                alt={imageAlt || ""}
                className="aspect-4/3 w-full rounded-2xl bg-neutral-100 object-cover sm:aspect-2/1 lg:aspect-21/9"
              />
            ) : null}
            {list.length ? (
              <div className={imageUrl ? "relative -mt-10 px-3 sm:-mt-20 sm:px-6 lg:px-10" : ""}>
                <dl className={`grid grid-cols-1 gap-px overflow-hidden rounded-2xl bg-neutral-200 shadow-xl ring-1 ring-neutral-950/5 ${cols}`}>
                  {list.map((s, i) => (
                    <div key={`${s.label}-${i}`} className="flex flex-col-reverse gap-1 bg-white px-6 py-6 lg:px-8 lg:py-8">
                      <dt className="text-sm leading-6 text-neutral-600">{s.label}</dt>
                      <dd className="text-3xl font-semibold tracking-tight text-neutral-950 tabular-nums lg:text-4xl">{s.value || "—"}</dd>
                    </div>
                  ))}
                </dl>
              </div>
            ) : null}
            {source ? <p className="mt-4 px-3 text-xs leading-5 text-neutral-500 sm:px-6 lg:px-10">{source}</p> : null}
          </div>
        </div>
      </section>
    );
  },
};
```
