# Add the "Community Programs" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/community-programs) to this Pantheon Content Publisher (P1) Next.js project. Health programs with who they serve, cost, how to enroll and who to contact, in easy-to-scan rows.

## Steps

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

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

/**
 * Community Programs — health programs (nutrition help, prenatal care, diabetes education,
 * quitting tobacco) as rows: what it is, who it serves, cost, how to enroll and who to contact.
 * Register: `CommunityProgramsBlock: communityProgramsBlock` in puck.config.tsx.
 */

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

export type CommunityProgramsProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  programs: {
    name: string;
    tag: string;
    summary: string;
    whoFor: string;
    cost: string;
    enroll: string;
    phone: string;
    email: string;
    linkLabel: string;
    href: string;
  }[];
  footnote: string;
};

const childLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";
const phoneIcon =
  "M2 3.5A1.5 1.5 0 0 1 3.5 2h1.148a1.5 1.5 0 0 1 1.465 1.175l.513 2.31a1.5 1.5 0 0 1-1.02 1.745l-1.051.35a.5.5 0 0 0-.31.637 10.48 10.48 0 0 0 6.548 6.548.5.5 0 0 0 .637-.31l.35-1.05a1.5 1.5 0 0 1 1.745-1.021l2.31.513A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15C7.82 18 2 12.18 2 5V3.5Z";

export const communityProgramsBlock: ComponentConfig<CommunityProgramsProps> = {
  label: "Community Programs",
  fields: {
    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. Program names use the next level down." },
    },
    intro: { type: "textarea", label: "Intro" },
    programs: {
      type: "array",
      label: "Programs",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.name || "Program",
      defaultItemProps: { name: "New program", tag: "", summary: "", whoFor: "", cost: "", enroll: "", phone: "", email: "", linkLabel: "", href: "" },
      arrayFields: {
        name: { type: "text", label: "Program name" },
        tag: { type: "text", label: "Tag", metadata: { help: "A short category, like Nutrition or Family health. Leave blank to hide." } },
        summary: { type: "textarea", label: "What it is", metadata: { help: "One or two plain sentences." } },
        whoFor: { type: "textarea", label: "Who it serves" },
        cost: { type: "text", label: "Cost", metadata: { help: "Like Free, or $10 per class. Sliding fee available." } },
        enroll: { type: "textarea", label: "How to enroll" },
        phone: { type: "text", label: "Contact phone" },
        email: { type: "text", label: "Contact email" },
        linkLabel: { type: "text", label: "Link text", metadata: { help: "Leave blank to hide the link." } },
        href: { type: "text", label: "Link" },
      },
    },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Optional, like a note about interpreters or transportation help." } },
  },
  defaultProps: {
    heading: "Programs for a healthier community",
    headingLevel: "h2",
    intro: "Free and low-cost programs for families, parents-to-be and anyone working on a health goal. You do not need to be a patient to join most of them.",
    programs: [
      {
        name: "WIC nutrition help",
        tag: "Nutrition",
        summary: "Healthy food, breastfeeding support and nutrition tips for families with young children.",
        whoFor: "Pregnant people, new parents and children under 5 who meet income rules. Families on Medicaid or SNAP usually qualify.",
        cost: "Free",
        enroll: "Call to set up a visit. Bring ID, proof of address and proof of income.",
        phone: "(555) 010-2510",
        email: "wic@lakeshorehealth.example.org",
        linkLabel: "Check if you qualify",
        href: "/programs/wic",
      },
      {
        name: "Healthy Start prenatal program",
        tag: "Family health",
        summary: "Prenatal visits, classes and a nurse or community health worker who checks in with you through pregnancy and baby's first year.",
        whoFor: "Anyone who is pregnant and lives in Lakeshore County, with or without insurance.",
        cost: "Free. Prenatal visits use your insurance or the sliding fee scale.",
        enroll: "Call us or ask at any Lakeshore clinic. You can join at any point in your pregnancy.",
        phone: "(555) 010-2520",
        email: "healthystart@lakeshorehealth.example.org",
        linkLabel: "Learn about Healthy Start",
        href: "/programs/healthy-start",
      },
      {
        name: "Living Well with Diabetes",
        tag: "Classes",
        summary: "A six-week group class on meal planning, staying active, medicines and checking blood sugar. Family members are welcome.",
        whoFor: "Adults with diabetes or prediabetes, and the people who help care for them.",
        cost: "$10 for all six classes. No one is turned away for lack of funds.",
        enroll: "Sign up online or call. New classes start each month, in English and Spanish.",
        phone: "(555) 010-2530",
        email: "",
        linkLabel: "See class dates",
        href: "/programs/diabetes",
      },
      {
        name: "Quit tobacco coaching",
        tag: "Wellness",
        summary: "One-on-one coaching by phone or in person to help you quit smoking, vaping or chewing tobacco.",
        whoFor: "Adults and teens 13 and up who want to quit or cut back.",
        cost: "Free",
        enroll: "Call to talk with a coach. You can also ask your provider for a referral.",
        phone: "(555) 010-2540",
        email: "quit@lakeshorehealth.example.org",
        linkLabel: "",
        href: "",
      },
    ],
    footnote: "Need an interpreter or a ride? Let us know when you sign up. Both are free.",
  },
  render: ({ heading, headingLevel, intro, programs, footnote }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (programs ?? []).filter((p) => p?.name);

    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-2xl">
              {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className="mt-10 divide-y divide-neutral-200 border-y border-neutral-200 sm:mt-12">
              {list.map((p, i) => {
                const tel = (p.phone || "").replace(/[^\d+]/g, "");
                const mail = (p.email || "").trim();
                const facts = [
                  { label: "Who it serves", value: p.whoFor },
                  { label: "Cost", value: p.cost },
                  { label: "How to enroll", value: p.enroll },
                ].filter((f) => f.value);
                return (
                  <li key={`${p.name}-${i}`} className="grid grid-cols-1 gap-6 py-10 lg:grid-cols-12 lg:gap-12">
                    <div className="lg:col-span-5">
                      {p.tag ? <p className="text-xs font-semibold tracking-widest text-indigo-700 uppercase">{p.tag}</p> : null}
                      <Sub className={`text-2xl font-semibold tracking-tight text-balance text-neutral-950 ${p.tag ? "mt-2" : ""}`}>{p.name}</Sub>
                      {p.summary ? <p className="mt-3 text-base leading-7 text-pretty text-neutral-700">{p.summary}</p> : null}
                      {p.linkLabel ? (
                        <a
                          href={p.href || "#"}
                          className={`group mt-4 inline-flex min-h-11 items-center gap-2 rounded-lg text-sm font-semibold text-indigo-700 hover:text-indigo-900 ${focusRing}`}
                        >
                          {p.linkLabel}
                          <span className="sr-only">: {p.name}</span>
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition motion-safe: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}
                    </div>

                    <div className="lg:col-span-7">
                      {facts.length ? (
                        <dl className="grid grid-cols-1 gap-x-8 gap-y-5 sm:grid-cols-2">
                          {facts.map((f) => (
                            <div key={f.label} className={f.label === "How to enroll" ? "sm:col-span-2" : ""}>
                              <dt className="text-sm font-semibold text-neutral-950">{f.label}</dt>
                              <dd className="mt-1 text-sm leading-6 text-pretty text-neutral-700">{f.value}</dd>
                            </div>
                          ))}
                        </dl>
                      ) : null}
                      {tel || mail ? (
                        <div className={`flex flex-col gap-2 rounded-xl bg-neutral-50 px-4 py-2 ring-1 ring-neutral-950/5 ring-inset sm:flex-row sm:flex-wrap sm:items-center sm:gap-x-6 ${facts.length ? "mt-6" : ""}`}>
                          <span className="pt-2 text-xs font-semibold tracking-wider text-neutral-600 uppercase sm:pt-0">Contact</span>
                          {tel ? (
                            <a href={`tel:${tel}`} className={`inline-flex min-h-11 items-center gap-2 rounded text-sm font-semibold text-neutral-950 tabular-nums underline decoration-neutral-300 underline-offset-4 hover:decoration-indigo-600 ${focusRing}`}>
                              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 text-indigo-600">
                                <path fillRule="evenodd" d={phoneIcon} clipRule="evenodd" />
                              </svg>
                              {p.phone}
                              <span className="sr-only">, {p.name}</span>
                            </a>
                          ) : null}
                          {mail ? (
                            <a href={`mailto:${mail}`} className={`inline-flex min-h-11 min-w-0 items-center gap-2 rounded text-sm font-semibold break-all text-neutral-950 underline decoration-neutral-300 underline-offset-4 hover:decoration-indigo-600 ${focusRing}`}>
                              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 text-indigo-600">
                                <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>
                              <span className="min-w-0">{mail}</span>
                            </a>
                          ) : null}
                        </div>
                      ) : null}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {footnote ? <p className="mt-8 text-sm leading-6 text-pretty text-neutral-600">{footnote}</p> : null}
        </div>
      </section>
    );
  },
};
```
