# Add the "Hero — Centered" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/hero-centered) to this Pantheon Content Publisher (P1) Next.js project. Centered statement hero with an announcement pill, two calls to action and an optional patterned backdrop.

## Steps

1. Create `components/puck/hero-centered-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 { heroCenteredBlock } from "./components/puck/hero-centered-block";`
3. Register it under `components` as `HeroCenteredBlock: heroCenteredBlock`.
4. Add `"HeroCenteredBlock"` 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-centered-block.tsx`

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

/**
 * Hero (Centered) — announcement pill, headline, supporting copy and two calls to action,
 * centered over an optional soft grid backdrop drawn in inline SVG.
 * Register: `HeroCenteredBlock: heroCenteredBlock` in puck.config.tsx.
 */

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

export type HeroCenteredProps = {
  announcementText: string;
  announcementLabel: string;
  announcementHref: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  primaryLabel: string;
  primaryHref: string;
  secondaryLabel: string;
  secondaryHref: string;
  showBackground: boolean;
  trustLine: string;
};

export const heroCenteredBlock: ComponentConfig<HeroCenteredProps> = {
  label: "Hero (Centered)",
  fields: {
    announcementText: { type: "text", label: "Announcement", metadata: { help: "Short news line in a pill above the heading. Leave blank to hide the pill." } },
    announcementLabel: { type: "text", label: "Announcement link text", metadata: { help: "Leave blank to show the announcement without a link." } },
    announcementHref: { type: "text", label: "Announcement link" },
    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" },
    showBackground: {
      type: "radio",
      label: "Background pattern",
      options: [
        { label: "Show", value: true },
        { label: "Hide", value: false },
      ],
      metadata: { help: "A faint grid and glow behind the text. Hide it for a plain white section." },
    },
    trustLine: { type: "text", label: "Trust line", metadata: { help: "Small proof point under the buttons, like a rating or how many people you serve. Leave blank to hide it." } },
  },
  defaultProps: {
    announcementText: "Our 2025 community report is here",
    announcementLabel: "Read it",
    announcementHref: "/impact",
    heading: "Clean water, close to home, for every family in the valley",
    headingLevel: "h1",
    body: "Since 2009 we've partnered with local crews to build and maintain wells, filters and rain catchment systems that neighbors own and run themselves.",
    primaryLabel: "Give monthly",
    primaryHref: "/donate",
    secondaryLabel: "See where we work",
    secondaryHref: "/projects",
    showBackground: true,
    trustLine: "Backed by 4,200 monthly donors · 92¢ of every dollar goes to programs",
  },
  render: ({ id, announcementText, announcementLabel, announcementHref, heading, headingLevel, body, primaryLabel, primaryHref, secondaryLabel, secondaryHref, showBackground, trustLine }) => {
    // Puck gives each instance a unique id; scoping the SVG ids to it keeps two heroes on one page valid.
    const uid = `p1-hero-centered-${id}`;
    const H = headingLevel || "h1";
    const hasPill = Boolean(announcementText);
    const pillLinked = hasPill && Boolean(announcementLabel);
    return (
      <section className="relative isolate overflow-hidden bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        {showBackground ? (
          <div aria-hidden="true" className="pointer-events-none absolute inset-0 -z-10">
            <div className="absolute inset-x-0 top-0 h-full bg-radial-[at_50%_0%] from-indigo-100/70 via-white/0 to-white/0" />
            <svg className="absolute inset-0 size-full stroke-neutral-900/5" width="100%" height="100%">
              <defs>
                <pattern id={`${uid}-grid`} width="48" height="48" x="50%" y="-1" patternUnits="userSpaceOnUse">
                  <path d="M.5 48V.5H48" fill="none" />
                </pattern>
                <radialGradient id={`${uid}-fade`} cx="50%" cy="0%" r="75%">
                  <stop offset="0%" stopColor="white" />
                  <stop offset="100%" stopColor="white" stopOpacity="0" />
                </radialGradient>
                <mask id={`${uid}-mask`}>
                  <rect width="100%" height="100%" fill={`url(#${uid}-fade)`} />
                </mask>
              </defs>
              <rect width="100%" height="100%" strokeWidth="0" fill={`url(#${uid}-grid)`} mask={`url(#${uid}-mask)`} />
            </svg>
          </div>
        ) : null}

        <div className="mx-auto flex max-w-4xl flex-col items-center text-center">
          {hasPill ? (
            pillLinked ? (
              <a
                href={announcementHref || "#"}
                className="group inline-flex min-h-11 max-w-full items-center gap-x-3 rounded-full bg-white/80 py-1.5 pr-3 pl-4 text-sm text-neutral-700 shadow-sm ring-1 ring-neutral-900/10 transition hover:ring-neutral-900/20 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
              >
                <span className="truncate">{announcementText}</span>
                <span aria-hidden="true" className="h-4 w-px shrink-0 bg-neutral-900/15" />
                <span className="inline-flex shrink-0 items-center gap-1 font-semibold text-indigo-700">
                  {announcementLabel}
                  <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-4 transition group-hover:translate-x-0.5">
                    <path fillRule="evenodd" d="M2 8a.75.75 0 0 1 .75-.75h8.69L8.22 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H2.75A.75.75 0 0 1 2 8Z" clipRule="evenodd" />
                  </svg>
                </span>
              </a>
            ) : (
              <p className="inline-flex max-w-full items-center gap-2 rounded-full bg-indigo-50 px-4 py-1.5 text-sm font-medium text-indigo-700 ring-1 ring-indigo-600/15 ring-inset">
                <span aria-hidden="true" className="size-1.5 shrink-0 rounded-full bg-indigo-600" />
                {announcementText}
              </p>
            )
          ) : null}

          {heading ? (
            <H className={`${hasPill ? "mt-8" : ""} text-4xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-6xl lg:text-7xl`}>{heading}</H>
          ) : null}
          {body ? <p className="mt-6 max-w-2xl text-lg leading-8 text-pretty text-neutral-600 sm:text-xl sm:leading-9">{body}</p> : null}

          {primaryLabel || secondaryLabel ? (
            <div className="mt-10 flex w-full flex-col items-stretch gap-3 sm:w-auto sm:flex-row sm:items-center sm:justify-center sm:gap-6">
              {primaryLabel ? (
                <a
                  href={primaryHref || "#"}
                  className="inline-flex min-h-11 items-center justify-center rounded-lg bg-indigo-600 px-6 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="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}

          {trustLine ? (
            <p className="mt-10 inline-flex items-start gap-2 text-sm leading-6 text-pretty text-neutral-600 sm:items-center">
              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-600 sm:mt-0">
                <path fillRule="evenodd" d="M16.403 12.652a3 3 0 0 0 0-5.304 3 3 0 0 0-3.75-3.751 3 3 0 0 0-5.305 0 3 3 0 0 0-3.751 3.75 3 3 0 0 0 0 5.305 3 3 0 0 0 3.75 3.751 3 3 0 0 0 5.305 0 3 3 0 0 0 3.751-3.75Zm-2.546-4.46a.75.75 0 0 0-1.214-.883l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clipRule="evenodd" />
              </svg>
              <span>{trustLine}</span>
            </p>
          ) : null}
        </div>
      </section>
    );
  },
};
```
