# Add the "Choose Path" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/choose-path) to this Pantheon Content Publisher (P1) Next.js project. Two or three large clickable cards for ways to help, such as give, volunteer and advocate, each with one action.

## Steps

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

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

/**
 * Choose Path — "How do you want to help?" with two or three large, fully clickable path cards
 * (give, volunteer, advocate), each with an icon, time or cost cue, short text and one action.
 * Register: `ChoosePathBlock: choosePathBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type IconName = "heart" | "hands" | "megaphone" | "leaf" | "book" | "home" | "calendar" | "users";

type Path = { icon: IconName; title: string; cue: string; description: string; ctaLabel: string; ctaHref: string };

export type ChoosePathProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  paths: Path[];
  highlight: "none" | "first" | "middle" | "last";
};

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",
  hands:
    "M10.05 4.575a1.575 1.575 0 1 0-3.15 0v3m3.15-3v-1.5a1.575 1.575 0 0 1 3.15 0v1.5m-3.15 0 .075 5.925m3.075.75V4.575m0 0a1.575 1.575 0 0 1 3.15 0V15M6.9 7.575a1.575 1.575 0 1 0-3.15 0v8.175a6.75 6.75 0 0 0 6.75 6.75h2.018a5.25 5.25 0 0 0 3.712-1.538l1.732-1.732a5.25 5.25 0 0 0 1.538-3.712l.003-2.024a.668.668 0 0 1 .198-.471 1.575 1.575 0 1 0-2.228-2.228 3.818 3.818 0 0 0-1.12 2.687M6.9 7.575V12m6.27 4.318A4.49 4.49 0 0 1 16.35 15m.002 0h-.002",
  megaphone:
    "M10.34 15.84c-.688-.06-1.386-.09-2.09-.09H7.5a4.5 4.5 0 1 1 0-9h.75c.704 0 1.402-.03 2.09-.09m0 9.18c.253.962.584 1.892.985 2.783.247.55.06 1.21-.463 1.511l-.657.38c-.551.318-1.26.117-1.527-.461a20.845 20.845 0 0 1-1.44-4.282m3.102.069a18.03 18.03 0 0 1-.59-4.59c0-1.586.205-3.124.59-4.59m0 9.18a23.848 23.848 0 0 1 8.835 2.535M10.34 6.66a23.847 23.847 0 0 0 8.835-2.535m0 0A23.74 23.74 0 0 0 18.795 3m.38 1.125a23.91 23.91 0 0 1 1.014 5.395m-1.014 8.855c-.118.38-.245.754-.38 1.125m.38-1.125a23.91 23.91 0 0 0 1.014-5.395m0-3.46c.495.413.811 1.035.811 1.73 0 .695-.316 1.317-.811 1.73m0-3.46a24.347 24.347 0 0 1 0 3.46",
  leaf: "M12 21c-4.5-2.25-7.5-6-7.5-10.5C4.5 6 8.25 3 12 3s7.5 3 7.5 7.5c0 4.5-3 8.25-7.5 10.5Zm0 0V9",
  book: "M12 6.042A8.967 8.967 0 0 0 6 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 0 1 6 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 0 1 6-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0 0 18 18a8.967 8.967 0 0 0-6 2.292m0-14.25v14.25",
  home: "m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25",
  calendar:
    "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5",
  users:
    "M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z",
};

const iconOptions = [
  { label: "Heart", value: "heart" },
  { label: "Helping hands", value: "hands" },
  { label: "Megaphone", value: "megaphone" },
  { label: "Leaf", value: "leaf" },
  { label: "Book", value: "book" },
  { label: "Home", value: "home" },
  { label: "Calendar", value: "calendar" },
  { label: "People", value: "users" },
];

export const choosePathBlock: ComponentConfig<ChoosePathProps> = {
  label: "Choose Path",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. Leave blank to hide it." } },
    heading: { type: "text", 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" },
    paths: {
      type: "array",
      label: "Paths",
      min: 2,
      max: 3,
      getItemSummary: (item) => item?.title || "Path",
      defaultItemProps: { icon: "heart", title: "New path", cue: "", description: "", ctaLabel: "Learn more", ctaHref: "#" },
      arrayFields: {
        icon: { type: "select", label: "Icon", options: iconOptions },
        title: { type: "text", label: "Title" },
        cue: { type: "text", label: "Commitment", metadata: { help: "What it takes, such as \"10 minutes\" or \"From $10\". Leave blank to hide it." } },
        description: { type: "textarea", label: "Description" },
        ctaLabel: { type: "text", label: "Action text" },
        ctaHref: { type: "text", label: "Action link", metadata: { help: "The whole card links here. A path (/give), full URL or #anchor." } },
      },
    },
    highlight: {
      type: "select",
      label: "Highlighted card",
      options: [
        { label: "None", value: "none" },
        { label: "First", value: "first" },
        { label: "Middle", value: "middle" },
        { label: "Last", value: "last" },
      ],
      metadata: { help: "Gives one path a solid indigo card to suggest where most people start." },
    },
  },
  defaultProps: {
    eyebrow: "Get involved",
    heading: "How do you want to help?",
    headingLevel: "h2",
    intro: "There's no wrong way in. Pick the one that fits your week. You can always add another later.",
    paths: [
      {
        icon: "heart",
        title: "Give",
        cue: "From $10",
        description: "Fund after-school tutoring, bus passes and warm meals for every kid in our program, all year long.",
        ctaLabel: "Make a gift",
        ctaHref: "/give",
      },
      {
        icon: "hands",
        title: "Volunteer",
        cue: "2 hours a week",
        description: "Read with a second grader, coach chess or help with homework. We train you and match you with one student.",
        ctaLabel: "Find a shift",
        ctaHref: "/volunteer",
      },
      {
        icon: "megaphone",
        title: "Advocate",
        cue: "5 minutes",
        description: "Tell your council member that youth programs belong in the city budget. We'll draft the message for you.",
        ctaLabel: "Send a letter",
        ctaHref: "/advocate",
      },
    ],
    highlight: "middle",
  },
  render: ({ eyebrow, heading, headingLevel, intro, paths, highlight }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const list = (paths ?? []).filter((p) => p?.title).slice(0, 3);
    const hi = highlight === "first" ? 0 : highlight === "last" ? list.length - 1 : highlight === "middle" ? Math.floor(list.length / 2) : -1;
    const cols = list.length === 3 ? "lg:grid-cols-3" : "md:grid-cols-2";

    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">
          {eyebrow || heading || intro ? (
            <div className="max-w-2xl">
              {eyebrow ? <p className="text-sm font-semibold text-indigo-700">{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>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-5 lg:gap-6 ${cols} ${eyebrow || heading || intro ? "mt-12 sm:mt-14" : ""} ${list.length === 2 ? "lg:max-w-5xl" : ""}`}>
              {list.map((p, i) => {
                const on = i === hi;
                const d = iconPaths[p.icon] ?? iconPaths.heart;
                return (
                  <li
                    key={`${p.title}-${i}`}
                    className={`group relative flex flex-col rounded-3xl p-7 transition sm:p-9 lg:min-h-104 ${
                      on ? "bg-indigo-700 text-white shadow-xl shadow-indigo-900/20" : "bg-neutral-50 ring-1 ring-neutral-200 hover:bg-white hover:shadow-lg hover:ring-neutral-300"
                    } has-focus-visible:outline-2 has-focus-visible:outline-offset-4 ${on ? "has-focus-visible:outline-indigo-700" : "has-focus-visible:outline-indigo-600"}`}
                  >
                    <div className="flex items-start justify-between gap-4">
                      <span className={`flex size-14 items-center justify-center rounded-full ${on ? "bg-white/10 ring-1 ring-white/20" : "bg-white ring-1 ring-neutral-200"}`}>
                        <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className={`size-7 ${on ? "text-white" : "text-indigo-600"}`}>
                          <path strokeLinecap="round" strokeLinejoin="round" d={d} />
                        </svg>
                      </span>
                      {p.cue ? (
                        <p className={`rounded-full px-3 py-1 text-xs leading-5 font-semibold ${on ? "bg-white/15 text-white" : "bg-white text-neutral-700 ring-1 ring-neutral-200"}`}>
                          <span className="sr-only">Commitment: </span>
                          {p.cue}
                        </p>
                      ) : null}
                    </div>
                    <Sub className={`mt-10 text-3xl font-semibold tracking-tight sm:text-4xl ${on ? "text-white" : "text-neutral-950"}`}>{p.title}</Sub>
                    {p.description ? <p className={`mt-4 text-base leading-7 text-pretty ${on ? "text-indigo-100" : "text-neutral-600"}`}>{p.description}</p> : null}
                    {p.ctaLabel ? (
                      <div className="mt-auto pt-10">
                        <a
                          href={p.ctaHref || "#"}
                          className={`inline-flex min-h-11 items-center gap-3 text-base font-semibold focus-visible:outline-none after:absolute after:inset-0 after:rounded-3xl ${on ? "text-white" : "text-neutral-950"}`}
                        >
                          {p.ctaLabel}
                          <span
                            aria-hidden="true"
                            className={`flex size-9 items-center justify-center rounded-full transition group-hover:translate-x-1 ${on ? "bg-white text-indigo-700" : "bg-indigo-600 text-white"}`}
                          >
                            <svg viewBox="0 0 20 20" fill="currentColor" className="size-4">
                              <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>
                        </a>
                      </div>
                    ) : null}
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
