# Add the "Program Cards" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/program-cards) to this Pantheon Content Publisher (P1) Next.js project. Photo cards for each program showing who it serves, one sourced outcome figure and a link to learn more.

## Steps

1. Create `components/puck/program-cards-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 { programCardsBlock } from "./components/puck/program-cards-block";`
3. Register it under `components` as `ProgramCardsBlock: programCardsBlock`.
4. Add `"ProgramCardsBlock"` 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/program-cards-block.tsx`

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

/**
 * Program Cards — your programs as photo cards: who each one serves, one outcome figure
 * with its source, and a link to learn more.
 * Register: `ProgramCardsBlock: programCardsBlock` in puck.config.tsx.
 */

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

export type ProgramCardsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  programs: {
    name: string;
    description: string;
    audience: string;
    metricValue: string;
    metricLabel: string;
    imageUrl: string;
    imageAlt: string;
    href: string;
  }[];
  audienceLabel: string;
  linkLabel: string;
  source: string;
};

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

export const programCardsBlock: ComponentConfig<ProgramCardsProps> = {
  label: "Program Cards",
  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" },
    programs: {
      type: "array",
      label: "Programs",
      min: 1,
      max: 9,
      getItemSummary: (item) => item?.name || "Program",
      defaultItemProps: {
        name: "New program",
        description: "What this program does, in a sentence or two.",
        audience: "Who it serves",
        metricValue: "",
        metricLabel: "",
        imageUrl: "https://picsum.photos/seed/program/800/600",
        imageAlt: "",
        href: "/programs",
      },
      arrayFields: {
        name: { type: "text", label: "Program name" },
        description: { type: "textarea", label: "Description" },
        audience: { type: "text", label: "Who it serves", metadata: { help: "Like Middle school students, grades 6–8." } },
        metricValue: { type: "text", label: "Outcome figure", metadata: { help: "Like 92%. Leave blank to hide the outcome." } },
        metricLabel: { type: "text", label: "Outcome label", metadata: { help: "What the figure measures, like of mentees advanced a grade on time." } },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "Landscape works best. Leave blank for a text-only card." } },
        imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for people who can't see it. Leave blank only if it's decorative." } },
        href: { type: "text", label: "Link", metadata: { help: "The program's own page." } },
      },
    },
    audienceLabel: { type: "text", label: "Audience label", metadata: { help: "Shown before who each program serves, like Serves." } },
    linkLabel: { type: "text", label: "Card link text", metadata: { help: "Like Learn more. The program name is added for screen readers." } },
    source: { type: "text", label: "Source line", metadata: { help: "Where the outcome figures come from. Required if you show outcomes." } },
  },
  defaultProps: {
    eyebrow: "Our programs",
    heading: "Three ways we walk alongside young people",
    headingLevel: "h2",
    intro: "Bright Path Mentoring meets students where they are: in school, after school and on the path to their first job.",
    programs: [
      {
        name: "School-Based Mentoring",
        description: "Trained volunteer mentors meet one-on-one with the same student every week during the school day.",
        audience: "Students in grades 6–8",
        metricValue: "91%",
        metricLabel: "of mentees advanced to the next grade on time",
        imageUrl: "https://picsum.photos/seed/mentoring/800/600",
        imageAlt: "An adult and a middle school student working through a notebook together at a table",
        href: "/programs/school-based",
      },
      {
        name: "Study Hall",
        description: "A calm, staffed space four afternoons a week with tutors, snacks and quiet rooms for homework.",
        audience: "Students in grades 6–12",
        metricValue: "640",
        metricLabel: "students dropped in at least ten times",
        imageUrl: "https://picsum.photos/seed/studyhall/800/600",
        imageAlt: "Teenagers studying at long tables in a bright library room",
        href: "/programs/study-hall",
      },
      {
        name: "Next Step",
        description: "Résumé workshops, mock interviews and paid summer internships with local employers.",
        audience: "High school juniors and seniors",
        metricValue: "78%",
        metricLabel: "of graduates enrolled in college or training",
        imageUrl: "https://picsum.photos/seed/internship/800/600",
        imageAlt: "A young person in a collared shirt shaking hands across a desk",
        href: "/programs/next-step",
      },
    ],
    audienceLabel: "Serves",
    linkLabel: "Learn more",
    source: "Sample figures. Source: Bright Path Mentoring 2024–25 program evaluation.",
  },
  render: ({ eyebrow, heading, headingLevel, intro, programs, audienceLabel, linkLabel, source }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const list = (programs ?? []).filter((p) => p?.name);
    const cols = list.length >= 3 ? "lg:grid-cols-3" : "";
    const hasMetric = list.some((p) => p.metricValue);

    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 ${eyebrow ? "mt-3" : ""}`}>{heading}</H>
            ) : null}
            {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
          </div>

          {list.length ? (
            <ul role="list" className={`mt-12 grid grid-cols-1 gap-6 md:grid-cols-2 lg:mt-14 lg:gap-8 ${cols}`}>
              {list.map((p, i) => (
                <li key={`${p.name}-${i}`} className="flex">
                  <article className="group relative flex w-full flex-col overflow-hidden rounded-2xl bg-white shadow-sm ring-1 ring-neutral-200 transition hover:shadow-lg hover:ring-indigo-300">
                    {p.imageUrl ? (
                      <div className="relative aspect-16/10 overflow-hidden bg-neutral-100">
                        <img src={p.imageUrl} alt={p.imageAlt || ""} loading="lazy" className="size-full object-cover transition duration-500 group-hover:scale-103" />
                        {p.audience ? (
                          <p className="absolute bottom-3 left-3 right-3 w-fit rounded-full bg-white/95 px-3 py-1 text-sm font-medium text-neutral-950 shadow-sm">
                            {audienceLabel ? <span className="text-neutral-600">{audienceLabel}: </span> : null}
                            {p.audience}
                          </p>
                        ) : null}
                      </div>
                    ) : null}
                    <div className="flex flex-1 flex-col p-6 sm:p-7">
                      {!p.imageUrl && p.audience ? (
                        <p className="text-sm font-medium text-indigo-700">
                          {audienceLabel ? `${audienceLabel}: ` : ""}
                          {p.audience}
                        </p>
                      ) : null}
                      <Sub className={`text-xl font-semibold tracking-tight text-neutral-950 ${!p.imageUrl && p.audience ? "mt-2" : ""}`}>
                        {p.href ? (
                          <a href={p.href} className="focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-indigo-600">
                            <span aria-hidden="true" className="absolute inset-0" />
                            {p.name}
                          </a>
                        ) : (
                          p.name
                        )}
                      </Sub>
                      {p.description ? <p className="mt-3 text-base leading-7 text-pretty text-neutral-600">{p.description}</p> : null}

                      {p.metricValue ? (
                        <p className="mt-6 flex items-baseline gap-3 border-t border-neutral-200 pt-5">
                          <span className="text-3xl font-semibold tracking-tight text-indigo-700 tabular-nums">{p.metricValue}</span>
                          {p.metricLabel ? <span className="text-sm leading-5 text-neutral-600">{p.metricLabel}</span> : null}
                        </p>
                      ) : null}

                      {p.href && linkLabel ? (
                        <p aria-hidden="true" className="mt-auto inline-flex items-center gap-1.5 pt-6 text-sm font-semibold text-neutral-950 group-hover:text-indigo-700">
                          {linkLabel}
                          <svg 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>
                        </p>
                      ) : null}
                    </div>
                  </article>
                </li>
              ))}
            </ul>
          ) : null}

          {source && hasMetric ? <p className="mt-8 text-sm text-neutral-600">{source}</p> : null}
        </div>
      </section>
    );
  },
};
```
