# Add the "Ways to Give" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/ways-to-give) to this Pantheon Content Publisher (P1) Next.js project. Giving methods from monthly gifts to stock, DAFs and planned giving, with a gifts officer contact panel.

## Steps

1. Create `components/puck/ways-to-give-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 { waysToGiveBlock } from "./components/puck/ways-to-give-block";`
3. Register it under `components` as `WaysToGiveBlock: waysToGiveBlock`.
4. Add `"WaysToGiveBlock"` 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/ways-to-give-block.tsx`

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

/**
 * Ways to Give — every giving method in one place (monthly, employer match, stock, DAF,
 * planned gifts and more), with a direct line to your gifts officer.
 * Register: `WaysToGiveBlock: waysToGiveBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type IconName = "heart" | "repeat" | "gift" | "briefcase" | "chart" | "building" | "feather" | "box";

export type WaysToGiveProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  methods: { icon: IconName; title: string; description: string; linkLabel: string; linkHref: string }[];
  contactHeading: string;
  contactName: string;
  contactRole: string;
  contactEmail: string;
  contactPhone: string;
};

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

const iconPaths: Record<IconName, string> = {
  heart: "M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z",
  repeat: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99",
  gift: "M21 11.25v8.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 1 0 9.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1 1 14.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z",
  briefcase:
    "M20.25 14.15v4.25c0 1.094-.787 2.036-1.872 2.18-2.087.277-4.216.42-6.378.42s-4.291-.143-6.378-.42c-1.085-.144-1.872-1.086-1.872-2.18v-4.25m16.5 0a2.18 2.18 0 0 0 .75-1.661V8.706c0-1.081-.768-2.015-1.837-2.175a48.114 48.114 0 0 0-3.413-.387m4.5 8.006c-.194.165-.42.295-.673.38A23.978 23.978 0 0 1 12 15.75c-2.648 0-5.195-.429-7.577-1.22a2.016 2.016 0 0 1-.673-.38m0 0A2.18 2.18 0 0 1 3 12.489V8.706c0-1.081.768-2.015 1.837-2.175a48.111 48.111 0 0 1 3.413-.387m7.5 0V5.25A2.25 2.25 0 0 0 13.5 3h-3a2.25 2.25 0 0 0-2.25 2.25v.894m7.5 0a48.667 48.667 0 0 0-7.5 0M12 12.75h.008v.008H12v-.008Z",
  chart: "M2.25 18 9 11.25l4.306 4.306a11.95 11.95 0 0 1 5.814-5.518l2.74-1.22m0 0-5.94-2.281m5.94 2.28-2.28 5.941",
  building: "M12 21v-8.25M15.75 21v-8.25M8.25 21v-8.25M3 9l9-6 9 6m-1.5 12V10.332A48.36 48.36 0 0 0 12 9.75c-2.551 0-5.056.2-7.5.582V21M3 21h18M12 6.75h.008v.008H12V6.75Z",
  feather: "M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5ZM16 8 2 22M17.5 15H9",
  box: "m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z",
};

const initials = (name: string) =>
  name
    .split(/\s+/)
    .filter(Boolean)
    .map((w) => w[0])
    .filter((c) => /[A-Za-z]/.test(c))
    .slice(0, 2)
    .join("")
    .toUpperCase();

const linkClass =
  "inline-flex min-h-11 items-center gap-2 font-semibold text-neutral-950 underline decoration-neutral-300 underline-offset-4 hover:text-indigo-700 hover:decoration-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

export const waysToGiveBlock: ComponentConfig<WaysToGiveProps> = {
  label: "Ways to Give",
  fields: {
    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" },
    methods: {
      type: "array",
      label: "Giving methods",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.title || "Giving method",
      defaultItemProps: { icon: "heart", title: "New way to give", description: "How this kind of gift works and who it suits.", linkLabel: "Learn more", linkHref: "/give" },
      arrayFields: {
        icon: {
          type: "select",
          label: "Icon",
          options: [
            { label: "Heart (one-time gift)", value: "heart" },
            { label: "Repeat (monthly giving)", value: "repeat" },
            { label: "Gift (tribute or honor gift)", value: "gift" },
            { label: "Briefcase (employer match)", value: "briefcase" },
            { label: "Chart (stock and securities)", value: "chart" },
            { label: "Building (donor-advised fund)", value: "building" },
            { label: "Feather (planned giving)", value: "feather" },
            { label: "Box (in-kind donations)", value: "box" },
          ],
        },
        title: { type: "text", label: "Title" },
        description: { type: "textarea", label: "Description" },
        linkLabel: { type: "text", label: "Link text", metadata: { help: "Leave blank to hide the link." } },
        linkHref: { type: "text", label: "Link", metadata: { help: "A path (/give/monthly), full URL, mailto: or a PDF." } },
      },
    },
    contactHeading: { type: "text", label: "Contact heading", metadata: { help: "Like Questions about a gift? Leave the name blank to hide the whole contact panel." } },
    contactName: { type: "text", label: "Gifts officer name" },
    contactRole: { type: "text", label: "Gifts officer title" },
    contactEmail: { type: "text", label: "Email" },
    contactPhone: { type: "text", label: "Phone", metadata: { help: "Written the way you'd like it shown, like (502) 555-0142." } },
  },
  defaultProps: {
    heading: "More ways to keep the land wild",
    headingLevel: "h2",
    intro: "A card gift online is the quickest way to help, but it isn't the only one. Many of our most lasting gifts come through a paycheck, a portfolio or a will.",
    methods: [
      { icon: "repeat", title: "Give monthly", description: "Join the Stewards Circle. Steady monthly gifts let us plan restoration work seasons ahead.", linkLabel: "Start a monthly gift", linkHref: "/give/monthly" },
      { icon: "briefcase", title: "Employer matching", description: "Many employers match charitable gifts, sometimes two to one. Check whether yours does in about a minute.", linkLabel: "Find your employer", linkHref: "/give/matching" },
      { icon: "chart", title: "Stock and securities", description: "Giving appreciated stock can avoid capital gains tax. Our brokerage details make the transfer simple.", linkLabel: "Get transfer details", linkHref: "/give/stock" },
      { icon: "building", title: "Donor-advised funds", description: "Recommend a grant from your DAF using our legal name and EIN, or use the DAF Direct form on our site.", linkLabel: "Give from a DAF", linkHref: "/give/daf" },
      { icon: "feather", title: "Legacy and planned gifts", description: "Name the trust in your will, a retirement account or a life insurance policy and protect land for generations.", linkLabel: "Explore legacy giving", linkHref: "/give/legacy" },
      { icon: "gift", title: "Tribute gifts", description: "Honor a birthday or remember someone who loved these trails. We'll send a card to the person you name.", linkLabel: "Make a tribute gift", linkHref: "/give/tribute" },
    ],
    contactHeading: "Planning a larger or more complex gift?",
    contactName: "Dana Whitfield",
    contactRole: "Director of Philanthropy",
    contactEmail: "dana.whitfield@example.org",
    contactPhone: "(502) 555-0142",
  },
  render: ({ heading, headingLevel, intro, methods, contactHeading, contactName, contactRole, contactEmail, contactPhone }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const list = (methods ?? []).filter((m) => m?.title);
    const tel = (contactPhone || "").replace(/[^\d+]/g, "");

    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 gap-6 lg:grid-cols-12 lg:items-end lg:gap-16">
            {heading ? (
              <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl lg:col-span-7 lg:text-5xl">{heading}</H>
            ) : null}
            {intro ? <p className={`text-lg leading-8 text-pretty text-neutral-600 ${heading ? "lg:col-span-5" : "lg:col-span-8"}`}>{intro}</p> : null}
          </div>

          {list.length ? (
            <ul role="list" className="mt-12 grid sm:grid-cols-2 sm:gap-x-10 lg:mt-16 lg:grid-cols-3 lg:gap-x-14">
              {list.map((m, i) => (
                <li key={`${m.title}-${i}`} className="flex flex-col border-t border-neutral-200 pt-8 pb-10">
                  <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="size-8 text-indigo-700">
                    <path d={iconPaths[m.icon] ?? iconPaths.heart} />
                  </svg>
                  <Sub className="mt-5 text-lg font-semibold text-neutral-950">{m.title}</Sub>
                  {m.description ? <p className="mt-2 flex-1 text-base leading-7 text-pretty text-neutral-600">{m.description}</p> : <span className="flex-1" />}
                  {m.linkLabel ? (
                    <a href={m.linkHref || "#"} className={`group mt-4 self-start text-sm ${linkClass}`}>
                      {m.linkLabel}
                      <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>
                    </a>
                  ) : null}
                </li>
              ))}
            </ul>
          ) : null}

          {contactName ? (
            <aside aria-label={contactHeading || "Gifts contact"} className="mt-12 flex flex-col gap-6 rounded-2xl bg-neutral-950 p-6 sm:p-8 lg:mt-16 lg:flex-row lg:items-center lg:justify-between lg:gap-12">
              <div className="flex items-center gap-4">
                <span aria-hidden="true" className="grid size-14 shrink-0 place-items-center rounded-full bg-indigo-600 text-lg font-semibold text-white">
                  {initials(contactName)}
                </span>
                <div>
                  {contactHeading ? <p className="text-sm font-medium text-indigo-200">{contactHeading}</p> : null}
                  <p className="mt-1 text-lg font-semibold text-white">
                    {contactName}
                    {contactRole ? <span className="font-normal text-neutral-300">, {contactRole}</span> : null}
                  </p>
                </div>
              </div>
              {contactEmail || contactPhone ? (
                <div className="flex flex-col gap-1 sm:flex-row sm:flex-wrap sm:gap-x-8">
                  {contactEmail ? (
                    <a
                      href={`mailto:${contactEmail}`}
                      className="inline-flex min-h-11 items-center gap-2 font-semibold break-all text-white underline decoration-neutral-500 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-400"
                    >
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-300">
                        <path d="M3 4a2 2 0 0 0-2 2v1.161l8.441 4.221a1.25 1.25 0 0 0 1.118 0L19 7.162V6a2 2 0 0 0-2-2H3Z" />
                        <path d="m19 8.839-7.77 3.885a2.75 2.75 0 0 1-2.46 0L1 8.839V14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.839Z" />
                      </svg>
                      {contactEmail}
                    </a>
                  ) : null}
                  {contactPhone ? (
                    <a
                      href={`tel:${tel}`}
                      className="inline-flex min-h-11 items-center gap-2 font-semibold text-white tabular-nums underline decoration-neutral-500 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-400"
                    >
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-300">
                        <path fillRule="evenodd" d="M2 3.5A1.5 1.5 0 0 1 3.5 2h1.148a1.5 1.5 0 0 1 1.465 1.175l.716 3.223a1.5 1.5 0 0 1-1.052 1.767l-.933.267c-.41.117-.643.555-.48.95a11.542 11.542 0 0 0 6.254 6.254c.395.163.833-.07.95-.48l.267-.933a1.5 1.5 0 0 1 1.767-1.052l3.223.716A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15c-7.18 0-13-5.82-13-13V3.5Z" clipRule="evenodd" />
                      </svg>
                      {contactPhone}
                    </a>
                  ) : null}
                </div>
              ) : null}
            </aside>
          ) : null}
        </div>
      </section>
    );
  },
};
```
