# Add the "Gift Impact" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/gift-impact) to this Pantheon Content Publisher (P1) Next.js project. Donation amount cards that show what each gift buys, with one highlighted amount, linking to your form.

## Steps

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

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

/**
 * Gift Impact — "what your gift does": giving amounts paired with the concrete good each
 * one buys. Every card is a real link to your donation form with that amount preset.
 * Register: `GiftImpactBlock: giftImpactBlock` in puck.config.tsx.
 */

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

export type GiftImpactProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  gifts: { amount: string; frequency: string; impact: string; href: string; featured: boolean }[];
  featuredLabel: string;
  linkLabel: string;
  otherLabel: string;
  otherHref: string;
  note: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };

export const giftImpactBlock: ComponentConfig<GiftImpactProps> = {
  label: "Gift Impact",
  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", 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." },
    },
    intro: { type: "textarea", label: "Intro" },
    gifts: {
      type: "array",
      label: "Gift amounts",
      min: 1,
      max: 6,
      getItemSummary: (item) => [item?.amount, item?.impact?.slice(0, 32)].filter(Boolean).join(" · ") || "Gift",
      defaultItemProps: { amount: "$50", frequency: "", impact: "describe what this amount pays for", href: "/donate?amount=50", featured: false },
      arrayFields: {
        amount: { type: "text", label: "Amount", metadata: { help: "Include the symbol, like $35." } },
        frequency: { type: "text", label: "Frequency", metadata: { help: "Optional, like /month. Leave blank for a one-time gift." } },
        impact: { type: "textarea", label: "What it does", metadata: { help: "Finish the sentence \"Your gift…\", like: stocks a family's pantry for a week." } },
        href: { type: "text", label: "Link", metadata: { help: "Your donation form with this amount preset, if it supports that." } },
        featured: {
          type: "radio",
          label: "Highlight",
          options: [
            { label: "Yes", value: true },
            { label: "No", value: false },
          ],
          metadata: { help: "Emphasize one amount, usually the one most donors choose." },
        },
      },
    },
    featuredLabel: { type: "text", label: "Highlight badge", metadata: { help: "Badge on the highlighted amount, like Most chosen. Leave blank to hide it." } },
    linkLabel: { type: "text", label: "Card link text", metadata: { help: "Shown at the bottom of each card, like Give." } },
    otherLabel: { type: "text", label: "Other amount text", metadata: { help: "A link for donors who want to choose their own amount. Leave blank to hide it." } },
    otherHref: { type: "text", label: "Other amount link" },
    note: { type: "textarea", label: "Small print", metadata: { help: "Tax status, how impact figures are calculated, or matching-gift details." } },
  },
  defaultProps: {
    eyebrow: "Larkspur Valley Food Bank",
    heading: "What your gift puts on the table",
    headingLevel: "h2",
    intro: "Because we buy wholesale and rescue surplus from local growers, every dollar goes further here than it would at the grocery store.",
    gifts: [
      { amount: "$35", frequency: "", impact: "stocks a family's pantry with staples for a week", href: "/donate?amount=35", featured: false },
      { amount: "$75", frequency: "", impact: "sends a weekend backpack of meals home with a student for a month", href: "/donate?amount=75", featured: true },
      { amount: "$150", frequency: "", impact: "buys fresh produce for our mobile market's Saturday stop", href: "/donate?amount=150", featured: false },
      { amount: "$20", frequency: "/month", impact: "provides 60 meals every month, all year long", href: "/donate?amount=20&recurring=monthly", featured: false },
    ],
    featuredLabel: "Most chosen",
    linkLabel: "Give",
    otherLabel: "Give a different amount",
    otherHref: "/donate",
    note: "Larkspur Valley Food Bank is a 501(c)(3) nonprofit; gifts are tax-deductible to the extent allowed by law. Impact figures are sample estimates based on our FY2025 average cost of $1.00 per three meals.",
  },
  render: ({ eyebrow, heading, headingLevel, intro, gifts, featuredLabel, linkLabel, otherLabel, otherHref, note }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const list = (gifts ?? []).filter((g) => g?.amount);
    const cols = list.length >= 4 ? "lg:grid-cols-4" : list.length === 3 ? "lg:grid-cols-3" : "";

    return (
      <section className="bg-neutral-50 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="max-w-2xl">
            {eyebrow ? <p className="text-sm font-semibold tracking-widest text-indigo-700 uppercase">{eyebrow}</p> : null}
            {heading ? (
              <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl lg:text-5xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H>
            ) : null}
            {intro ? <p className="mt-5 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
          </div>

          {list.length ? (
            <ul role="list" className={`mt-12 grid gap-4 sm:grid-cols-2 lg:mt-14 lg:gap-5 ${cols}`}>
              {list.map((g, i) => {
                const featured = Boolean(g.featured);
                return (
                  <li key={`${g.amount}-${i}`} className="flex">
                    <a
                      href={g.href || otherHref || "#"}
                      className={`group relative flex w-full flex-col rounded-2xl p-6 transition hover:-translate-y-1 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-indigo-600 sm:p-7 ${
                        featured
                          ? "bg-white shadow-xl ring-2 shadow-indigo-900/10 ring-indigo-600"
                          : "bg-white shadow-sm ring-1 ring-neutral-200 hover:shadow-lg hover:ring-indigo-300"
                      }`}
                    >
                      <div className="flex items-start justify-between gap-4">
                        <Sub className="flex items-baseline gap-1">
                          <span className="text-4xl font-semibold tracking-tight text-neutral-950 tabular-nums sm:text-5xl">{g.amount}</span>
                          {g.frequency ? <span className="text-base font-medium text-neutral-600">{g.frequency}</span> : null}
                        </Sub>
                        <span
                          aria-hidden="true"
                          className={`mt-2 grid size-6 shrink-0 place-items-center rounded-full transition ${
                            featured ? "bg-indigo-600 text-white" : "text-transparent ring-2 ring-neutral-300 ring-inset group-hover:ring-indigo-600"
                          }`}
                        >
                          <svg viewBox="0 0 16 16" fill="currentColor" className="size-3.5">
                            <path fillRule="evenodd" d="M12.416 3.376a.75.75 0 0 1 .208 1.04l-5 7.5a.75.75 0 0 1-1.154.114l-3-3a.75.75 0 0 1 1.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 0 1 1.04-.207Z" clipRule="evenodd" />
                          </svg>
                        </span>
                      </div>
                      {featured && featuredLabel ? (
                        <span className="mt-3 inline-flex w-fit items-center rounded-full bg-indigo-50 px-2.5 py-0.5 text-xs font-semibold tracking-wide text-indigo-700 uppercase ring-1 ring-indigo-600/20 ring-inset">
                          {featuredLabel}
                        </span>
                      ) : null}
                      {g.impact ? <p className="mt-4 flex-1 text-base leading-7 text-pretty text-neutral-700">{g.impact}</p> : <span className="flex-1" />}
                      {linkLabel ? (
                        <span
                          className={`mt-6 inline-flex min-h-11 items-center justify-between gap-2 rounded-lg px-4 text-sm font-semibold transition ${
                            featured ? "bg-indigo-600 text-white group-hover:bg-indigo-700" : "bg-neutral-100 text-neutral-950 group-hover:bg-indigo-600 group-hover:text-white"
                          }`}
                        >
                          <span>
                            {linkLabel} {g.amount}
                            {g.frequency || ""}
                          </span>
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 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>
                        </span>
                      ) : null}
                    </a>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {otherLabel || note ? (
            <div className="mt-10 flex flex-col gap-6 border-t border-neutral-200 pt-8 lg:flex-row lg:items-start lg:justify-between lg:gap-16">
              {otherLabel ? (
                <a
                  href={otherHref || "#"}
                  className="inline-flex min-h-11 shrink-0 items-center gap-1.5 self-start font-semibold text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                >
                  {otherLabel}
                </a>
              ) : null}
              {note ? <p className="max-w-3xl text-sm leading-6 text-pretty text-neutral-600 lg:text-right">{note}</p> : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
