# Add the "CTA Dual Path" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/cta-dual-path) to this Pantheon Content Publisher (P1) Next.js project. Light and dark side-by-side panels for two ways to act, such as volunteer or donate, each with a checklist and button.

## Steps

1. Create `components/puck/cta-dual-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 { ctaDualPathBlock } from "./components/puck/cta-dual-path-block";`
3. Register it under `components` as `CtaDualPathBlock: ctaDualPathBlock`.
4. Add `"CtaDualPathBlock"` 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/cta-dual-path-block.tsx`

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

/**
 * CTA Dual Path — a two-panel diptych for two ways to act (such as volunteer or donate):
 * one light half and one dark half, each with its own heading, checklist and button.
 * Register: `CtaDualPathBlock: ctaDualPathBlock` in puck.config.tsx.
 */

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

type Path = { eyebrow: string; heading: string; body: string; checklist: string; ctaLabel: string; ctaHref: string };

export type CtaDualPathProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  first: Path;
  second: Path;
  darkSide: "first" | "second";
};

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

const pathFields = {
  eyebrow: { type: "text" as const, label: "Eyebrow", metadata: { help: "A word or two above the heading, such as \"Give time\". Leave blank to hide it." } },
  heading: { type: "text" as const, label: "Heading" },
  body: { type: "textarea" as const, label: "Body" },
  checklist: { type: "textarea" as const, label: "Checklist", metadata: { help: "One item per line. Three or four short lines read best. Leave blank to hide it." } },
  ctaLabel: { type: "text" as const, label: "Button text", metadata: { help: "Leave blank to hide the button." } },
  ctaHref: { type: "text" as const, label: "Button link" },
};

export const ctaDualPathBlock: ComponentConfig<CtaDualPathProps> = {
  label: "CTA Dual Path",
  fields: {
    heading: { type: "text", label: "Intro heading", metadata: { help: "Optional heading above both panels. Leave blank to hide it." } },
    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. Panel headings sit one level below; with no intro heading they use this level.",
      },
    },
    intro: { type: "textarea", label: "Intro", metadata: { help: "A sentence under the intro heading. Leave blank to hide it." } },
    first: { type: "object", label: "First path", objectFields: pathFields },
    second: { type: "object", label: "Second path", objectFields: pathFields },
    darkSide: {
      type: "radio",
      label: "Dark panel",
      options: [
        { label: "First", value: "first" },
        { label: "Second", value: "second" },
      ],
      metadata: { help: "Put the action you most want people to take on the dark panel." },
    },
  },
  defaultProps: {
    heading: "Two ways to fight hunger this winter",
    headingLevel: "h2",
    intro: "Whether you have a Saturday morning or a few dollars a month, there's a place for you at the Tri-County Food Bank.",
    first: {
      eyebrow: "Give time",
      heading: "Sort, pack and deliver",
      body: "Join a three-hour shift in our warehouse or ride along on a Saturday grocery route. No experience needed.",
      checklist: "Shifts six days a week, mornings and evenings\nGroups of up to 20 welcome\nService hours signed for students",
      ctaLabel: "Find a volunteer shift",
      ctaHref: "/volunteer",
    },
    second: {
      eyebrow: "Give money",
      heading: "Stock the shelves all year",
      body: "Our buying power with regional growers turns each dollar you give into far more food than you could buy at the store.",
      checklist: "Monthly gifts keep trucks on the road\nGifts are tax-deductible\nCancel or change any time",
      ctaLabel: "Donate monthly",
      ctaHref: "/donate?frequency=monthly",
    },
    darkSide: "second",
  },
  render: ({ heading, headingLevel, intro, first, second, darkSide }) => {
    const H = headingLevel || "h2";
    const Sub = heading ? childHeading[H] || "h3" : H;
    const paths = [first, second].map((p, i) => ({ ...(p ?? {}), dark: (darkSide === "first" ? 0 : 1) === i })) as (Partial<Path> & { dark: boolean })[];
    const shown = paths.filter((p) => p.heading || p.body || p.ctaLabel);
    if (!heading && !intro && !shown.length) return <></>;

    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">
          {heading || intro ? (
            <div className="max-w-3xl">
              {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl lg:text-5xl">{heading}</H> : null}
              {intro ? <p className={`text-lg leading-8 text-pretty text-neutral-600 ${heading ? "mt-5" : ""}`}>{intro}</p> : null}
            </div>
          ) : null}
          {shown.length ? (
            <div
              className={`grid grid-cols-1 overflow-hidden rounded-3xl ring-1 ring-neutral-200 ${shown.length > 1 ? "lg:grid-cols-2" : ""} ${heading || intro ? "mt-12 sm:mt-16" : ""}`}
            >
              {shown.map((p, i) => {
                const items = (p.checklist || "")
                  .split("\n")
                  .map((l) => l.trim())
                  .filter(Boolean);
                return (
                  <div key={i} className={`relative isolate flex flex-col p-8 sm:p-12 lg:p-14 ${p.dark ? "bg-neutral-950 text-white" : "bg-neutral-50 text-neutral-950"}`}>
                    <span
                      aria-hidden="true"
                      className={`pointer-events-none absolute top-4 right-6 -z-10 text-8xl leading-none font-semibold tracking-tighter tabular-nums sm:text-9xl ${p.dark ? "text-white/5" : "text-neutral-950/5"}`}
                    >
                      {String(i + 1).padStart(2, "0")}
                    </span>
                    {p.eyebrow ? (
                      <p className={`text-sm font-semibold tracking-widest uppercase ${p.dark ? "text-indigo-300" : "text-indigo-700"}`}>{p.eyebrow}</p>
                    ) : null}
                    {p.heading ? (
                      <Sub className={`text-2xl font-semibold tracking-tight text-balance sm:text-3xl ${p.eyebrow ? "mt-3" : ""} ${p.dark ? "text-white" : "text-neutral-950"}`}>
                        {p.heading}
                      </Sub>
                    ) : null}
                    {p.body ? <p className={`mt-4 max-w-md text-base leading-7 text-pretty ${p.dark ? "text-neutral-300" : "text-neutral-600"}`}>{p.body}</p> : null}
                    {items.length ? (
                      <ul role="list" className={`mt-8 space-y-3 border-t pt-8 text-sm leading-6 ${p.dark ? "border-white/15 text-neutral-200" : "border-neutral-200 text-neutral-700"}`}>
                        {items.map((item, j) => (
                          <li key={j} className="flex gap-x-3">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className={`h-6 w-5 flex-none ${p.dark ? "text-indigo-300" : "text-indigo-600"}`}>
                              <path fillRule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clipRule="evenodd" />
                            </svg>
                            {item}
                          </li>
                        ))}
                      </ul>
                    ) : null}
                    {p.ctaLabel ? (
                      <div className="mt-auto pt-10">
                        <a
                          href={p.ctaHref || "#"}
                          className={`inline-flex min-h-12 w-full items-center justify-center gap-2 rounded-lg px-6 py-3 text-base font-semibold transition focus-visible:outline-2 focus-visible:outline-offset-2 sm:w-auto ${
                            p.dark
                              ? "bg-white text-neutral-950 hover:bg-indigo-50 focus-visible:outline-white"
                              : "bg-indigo-600 text-white hover:bg-indigo-700 focus-visible:outline-indigo-600"
                          }`}
                        >
                          {p.ctaLabel}
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-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>
                      </div>
                    ) : null}
                  </div>
                );
              })}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
