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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/hero-donate) to this Pantheon Content Publisher (P1) Next.js project. Mission line beside a no-JS donation form with preset amount cards, an other-amount field and one-time or monthly choice.

## Steps

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

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

/**
 * Hero (Donate) — mission line beside a real donation form: preset amount cards with what
 * each gift does, an "other amount" field, and one-time / monthly choice. Posts to your
 * donation processor; no JavaScript. Register: `HeroDonateBlock: heroDonateBlock` in puck.config.tsx.
 */

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

export type HeroDonateProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  proofLine: string;
  imageUrl: string;
  imageAlt: string;
  formTitle: string;
  formAction: string;
  currencySymbol: string;
  amountFieldName: string;
  otherFieldName: string;
  frequencyFieldName: string;
  amounts: { amount: string; impact: string }[];
  defaultFrequency: "once" | "monthly";
  onceLabel: string;
  monthlyLabel: string;
  otherLabel: string;
  buttonLabel: string;
  secureNote: string;
};

export const heroDonateBlock: ComponentConfig<HeroDonateProps> = {
  label: "Hero (Donate)",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    heading: { type: "textarea", label: "Mission line" },
    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" },
    proofLine: { type: "text", label: "Proof line", metadata: { help: "A credibility point with its source, like a charity rating or program spending ratio. Leave blank to hide it." } },
    imageUrl: { type: "text", label: "Image URL", metadata: { help: "Shown under the copy on large screens. Leave blank to hide it." } },
    imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for screen reader users. Leave blank only if it's purely decorative." } },
    formTitle: { type: "text", label: "Form title", metadata: { help: "Shown at the top of the donation card and used as the form's accessible name." } },
    formAction: { type: "text", label: "Form action URL", metadata: { help: "Your donation processor's checkout URL that accepts a posted amount (the form's action attribute)." } },
    currencySymbol: { type: "text", label: "Currency symbol" },
    amountFieldName: { type: "text", label: "Amount field name", metadata: { help: "The name your processor expects for the preset amount, like amount." } },
    otherFieldName: { type: "text", label: "Other amount field name", metadata: { help: "The name for a typed-in amount, like other_amount. Your processor should prefer it when filled." } },
    frequencyFieldName: { type: "text", label: "Frequency field name", metadata: { help: "Sent as once or monthly. Use the name your processor expects, like frequency." } },
    amounts: {
      type: "array",
      label: "Preset amounts",
      min: 2,
      max: 6,
      getItemSummary: (item) => (item?.amount ? `${item.amount}${item.impact ? ` · ${item.impact.slice(0, 32)}` : ""}` : "Amount"),
      defaultItemProps: { amount: "100", impact: "What this gift makes possible" },
      arrayFields: {
        amount: { type: "text", label: "Amount", metadata: { help: "Number only, like 50. The first amount starts selected." } },
        impact: { type: "text", label: "What it does", metadata: { help: "A few words, shown under the amount. Leave blank to hide it." } },
      },
    },
    defaultFrequency: {
      type: "radio",
      label: "Starts selected",
      options: [
        { label: "One-time", value: "once" },
        { label: "Monthly", value: "monthly" },
      ],
    },
    onceLabel: { type: "text", label: "One-time label" },
    monthlyLabel: { type: "text", label: "Monthly label" },
    otherLabel: { type: "text", label: "Other amount label" },
    buttonLabel: { type: "text", label: "Button text" },
    secureNote: { type: "text", label: "Security note", metadata: { help: "Small reassurance under the button. Leave blank to hide it." } },
  },
  defaultProps: {
    eyebrow: "Give to Second Story Literacy",
    heading: "Every child deserves to leave third grade reading",
    headingLevel: "h1",
    body: "Trained volunteer tutors meet one-on-one with early readers twice a week in 38 public schools. Your gift buys books, trains tutors and keeps the program free for every family.",
    proofLine: "89% of spending goes directly to tutoring programs. Sample figure, FY2025 audited financials.",
    imageUrl: "https://picsum.photos/seed/storytime/1200/800",
    imageAlt: "A volunteer tutor reading a picture book with a young student",
    formTitle: "Choose your gift",
    formAction: "/donate/checkout",
    currencySymbol: "$",
    amountFieldName: "amount",
    otherFieldName: "other_amount",
    frequencyFieldName: "frequency",
    amounts: [
      { amount: "25", impact: "A take-home book bag" },
      { amount: "60", impact: "A month of tutoring" },
      { amount: "120", impact: "Trains a new tutor" },
      { amount: "250", impact: "Stocks a classroom library" },
    ],
    defaultFrequency: "monthly",
    onceLabel: "One-time",
    monthlyLabel: "Monthly",
    otherLabel: "Other amount",
    buttonLabel: "Continue to payment",
    secureNote: "Secure checkout. Second Story is a 501(c)(3); gifts are tax-deductible.",
  },
  render: ({
    id,
    eyebrow,
    heading,
    headingLevel,
    body,
    proofLine,
    imageUrl,
    imageAlt,
    formTitle,
    formAction,
    currencySymbol,
    amountFieldName,
    otherFieldName,
    frequencyFieldName,
    amounts,
    defaultFrequency,
    onceLabel,
    monthlyLabel,
    otherLabel,
    buttonLabel,
    secureNote,
  }) => {
    const H = headingLevel || "h1";
    const uid = `p1-hero-donate-${id}`;
    const cur = currencySymbol ?? "$";
    const presets = (amounts ?? []).filter((a) => a?.amount);
    const freqName = frequencyFieldName || "frequency";
    const monthlyFirst = defaultFrequency !== "once";
    const frequencies = [
      { value: "once", label: onceLabel || "One-time", checked: !monthlyFirst },
      { value: "monthly", label: monthlyLabel || "Monthly", checked: monthlyFirst },
    ];
    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 grid max-w-7xl grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-16">
          <div className="lg:col-span-6 lg:pt-6">
            {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}
            {body ? <p className="mt-6 max-w-xl text-lg leading-8 text-pretty text-neutral-600">{body}</p> : null}
            {proofLine ? (
              <p className="mt-6 flex max-w-xl items-start gap-2 text-sm leading-6 text-neutral-600">
                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-600">
                  <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>{proofLine}</span>
              </p>
            ) : null}
            {imageUrl ? <img src={imageUrl} alt={imageAlt || ""} className="mt-10 hidden aspect-3/2 w-full rounded-2xl bg-neutral-100 object-cover lg:block" /> : null}
          </div>

          <div className="lg:col-span-6">
            <form
              action={formAction || undefined}
              method="post"
              aria-labelledby={formTitle ? `${uid}-title` : undefined}
              className="rounded-3xl bg-neutral-950 p-5 text-white shadow-2xl sm:p-8"
            >
              {formTitle ? (
                <p id={`${uid}-title`} className="text-xl font-semibold tracking-tight">
                  {formTitle}
                </p>
              ) : null}

              <fieldset className={formTitle ? "mt-6" : ""}>
                <legend className="sr-only">Gift frequency</legend>
                <div className="grid grid-cols-2 gap-1 rounded-xl bg-white/10 p-1">
                  {frequencies.map((f) => (
                    <label
                      key={f.value}
                      className="flex min-h-11 cursor-pointer items-center justify-center rounded-lg px-3 text-sm font-semibold text-neutral-200 transition has-checked:bg-white has-checked:text-neutral-950 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-indigo-400"
                    >
                      <input type="radio" name={freqName} value={f.value} defaultChecked={f.checked} className="sr-only" />
                      {f.label}
                    </label>
                  ))}
                </div>
              </fieldset>

              {presets.length ? (
                <fieldset className="mt-6">
                  <legend className="text-sm font-medium text-neutral-300">Amount</legend>
                  <div className="mt-3 grid grid-cols-2 gap-3">
                    {presets.map((a, i) => (
                      <label
                        key={`${a.amount}-${i}`}
                        className="group flex min-h-11 cursor-pointer flex-col justify-center rounded-xl px-4 py-3 ring-1 ring-white/20 transition ring-inset hover:ring-white/40 has-checked:bg-indigo-600 has-checked:ring-2 has-checked:ring-indigo-300 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-indigo-400"
                      >
                        <input type="radio" name={amountFieldName || "amount"} value={a.amount} defaultChecked={i === 0} className="sr-only" />
                        <span className="text-2xl font-semibold tracking-tight tabular-nums">
                          {cur}
                          {a.amount}
                        </span>
                        {a.impact ? <span className="mt-0.5 text-sm leading-5 text-neutral-300 group-has-checked:text-indigo-50">{a.impact}</span> : null}
                      </label>
                    ))}
                  </div>
                </fieldset>
              ) : null}

              <div className="mt-4">
                <label htmlFor={`${uid}-other`} className="block text-sm font-medium text-neutral-300">
                  {otherLabel || "Other amount"}
                </label>
                <div className="relative mt-2">
                  {cur ? <span aria-hidden="true" className="pointer-events-none absolute top-1/2 left-4 -translate-y-1/2 text-base text-neutral-400">{cur}</span> : null}
                  <input
                    id={`${uid}-other`}
                    type="text"
                    inputMode="decimal"
                    name={otherFieldName || "other_amount"}
                    pattern="[0-9]+([.,][0-9]{1,2})?"
                    autoComplete="off"
                    className="block min-h-12 w-full rounded-xl border-0 bg-white/5 py-3 pr-4 pl-9 text-base text-white ring-1 ring-white/20 ring-inset placeholder:text-neutral-400 focus:ring-2 focus:ring-indigo-400 focus:outline-none"
                  />
                </div>
              </div>

              <button
                type="submit"
                className="mt-8 inline-flex min-h-12 w-full items-center justify-center gap-2 rounded-xl bg-indigo-600 px-5 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-400"
              >
                {buttonLabel || "Donate"}
                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                  <path d="m9.653 16.915-.005-.003-.019-.01a20.759 20.759 0 0 1-1.162-.682 22.045 22.045 0 0 1-2.582-1.9C4.045 12.733 2 10.352 2 7.5a4.5 4.5 0 0 1 8-2.828A4.5 4.5 0 0 1 18 7.5c0 2.852-2.044 5.233-3.885 6.82a22.049 22.049 0 0 1-3.744 2.582l-.019.01-.005.003h-.002a.739.739 0 0 1-.69.001l-.002-.001Z" />
                </svg>
              </button>
              {secureNote ? (
                <p className="mt-4 flex items-start justify-center gap-2 text-center text-sm leading-6 text-neutral-400">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0">
                    <path fillRule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clipRule="evenodd" />
                  </svg>
                  <span>{secureNote}</span>
                </p>
              ) : null}
            </form>
          </div>
        </div>
      </section>
    );
  },
};
```
