# Add the "Eligibility Check" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/eligibility-check) to this Pantheon Content Publisher (P1) Next.js project. Are-we-a-fit checklist of native checkboxes that reveals next steps via CSS :has() once every box is checked.

## Steps

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

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

/**
 * Eligibility Check — an "Are we a fit?" self-check. Applicants tick native checkboxes;
 * when every box is checked a next-steps panel appears via CSS :has(), no JavaScript.
 * Register: `EligibilityCheckBlock: eligibilityCheckBlock` in puck.config.tsx.
 */

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

export type EligibilityCheckProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  legend: string;
  criteria: { label: string; detail: string }[];
  fitHeading: string;
  fitBody: string;
  fitCtaLabel: string;
  fitCtaHref: string;
  noteHeading: string;
  noteBody: string;
  officerName: string;
  officerTitle: string;
  officerEmail: string;
  officerPhone: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

export const eligibilityCheckBlock: ComponentConfig<EligibilityCheckProps> = {
  label: "Eligibility Check",
  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" },
    legend: { type: "text", label: "Checklist label", metadata: { help: "Read aloud before the checkboxes, like Check each statement that is true for your organization." } },
    criteria: {
      type: "array",
      label: "Criteria",
      min: 1,
      max: 10,
      getItemSummary: (item) => item?.label || "Criterion",
      defaultItemProps: { label: "Our organization meets this requirement", detail: "" },
      arrayFields: {
        label: { type: "text", label: "Statement", metadata: { help: "Write it as a yes/no statement the applicant can agree with." } },
        detail: { type: "textarea", label: "Detail", metadata: { help: "Optional clarification in smaller text." } },
      },
      metadata: { help: "When every box is checked, the next-steps panel appears. Nothing is saved or sent." },
    },
    fitHeading: { type: "text", label: "Fit panel heading" },
    fitBody: { type: "textarea", label: "Fit panel text" },
    fitCtaLabel: { type: "text", label: "Fit panel button text", metadata: { help: "Leave blank to hide the button." } },
    fitCtaHref: { type: "text", label: "Fit panel button link" },
    noteHeading: { type: "text", label: "Note heading", metadata: { help: "Always visible, for applicants who can't check every box." } },
    noteBody: { type: "textarea", label: "Note text" },
    officerName: { type: "text", label: "Program officer name", metadata: { help: "Leave blank to hide the contact card." } },
    officerTitle: { type: "text", label: "Program officer title" },
    officerEmail: { type: "text", label: "Program officer email" },
    officerPhone: { type: "text", label: "Program officer phone" },
  },
  defaultProps: {
    eyebrow: "Before you apply",
    heading: "Are we a fit?",
    headingLevel: "h2",
    intro: "Most declined requests fall outside our guidelines. Take a minute with this checklist before writing a letter of inquiry. Nothing you check here is saved or sent.",
    legend: "Check each statement that is true for your organization",
    criteria: [
      { label: "We are a 501(c)(3) public charity, school or government agency", detail: "Groups without tax-exempt status may apply through a fiscal sponsor." },
      { label: "Our work serves residents of Harlow County", detail: "Regional organizations qualify when Harlow residents are a meaningful share of those served." },
      { label: "The request fits one of the foundation's four focus areas", detail: "Housing and neighborhoods, early learning, health access, or arts and culture." },
      { label: "We've filed a Form 990 or have audited financials from the last fiscal year", detail: "" },
      { label: "The funds are not for individuals, endowments, debt or political activity", detail: "" },
    ],
    fitHeading: "Looks like a fit — here's what's next",
    fitBody: "Submit a two-page letter of inquiry by the cycle deadline. A program officer will reply within three weeks, and promising requests are invited to send a full proposal.",
    fitCtaLabel: "Start a letter of inquiry",
    fitCtaHref: "/grants/letter-of-inquiry",
    noteHeading: "Not sure about one of these? Talk to us first.",
    noteBody: "Every year we fund organizations that didn't think they qualified. A 15-minute call can save you hours of writing.",
    officerName: "Renée Okafor",
    officerTitle: "Senior Program Officer",
    officerEmail: "grants@harlowfoundation.example.org",
    officerPhone: "(555) 555-0142",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, legend, criteria, fitHeading, fitBody, fitCtaLabel, fitCtaHref, noteHeading, noteBody, officerName, officerTitle, officerEmail, officerPhone }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const uid = `ec-${id || "check"}`;
    const list = (criteria ?? []).filter((c) => c?.label);
    const tel = (officerPhone || "").replace(/[^\d+]/g, "");
    const hasNote = Boolean(noteHeading || noteBody || officerName);

    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 grid max-w-6xl grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-16">
          <div className="lg:col-span-5">
            {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}

            {hasNote ? (
              <aside aria-labelledby={noteHeading ? `${uid}-note` : undefined} aria-label={noteHeading ? undefined : "Talk to a program officer"} className="mt-10 border-l-2 border-indigo-600 pl-5">
                {noteHeading ? <Sub id={`${uid}-note`} className="text-base leading-7 font-semibold text-neutral-950">{noteHeading}</Sub> : null}
                {noteBody ? <p className="mt-2 text-base leading-7 text-pretty text-neutral-600">{noteBody}</p> : null}
                {officerName ? (
                  <div className="mt-5 text-sm leading-6">
                    <p className="font-semibold text-neutral-950">{officerName}</p>
                    {officerTitle ? <p className="text-neutral-600">{officerTitle}</p> : null}
                    <ul role="list" className="mt-2">
                      {officerEmail ? (
                        <li>
                          <a href={`mailto:${officerEmail}`} className={`-mx-1 inline-flex min-h-11 items-center gap-2 rounded px-1 font-medium break-all text-indigo-700 hover:text-indigo-900 ${focusRing}`}>
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                              <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>
                            {officerEmail}
                          </a>
                        </li>
                      ) : null}
                      {officerPhone ? (
                        <li>
                          <a href={`tel:${tel}`} className={`-mx-1 inline-flex min-h-11 items-center gap-2 rounded px-1 font-medium text-indigo-700 tabular-nums hover:text-indigo-900 ${focusRing}`}>
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                              <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.513 2.31a1.5 1.5 0 0 1-1.002 1.75l-1.09.364a11.04 11.04 0 0 0 5.867 5.867l.364-1.09a1.5 1.5 0 0 1 1.75-1.002l2.31.513A1.5 1.5 0 0 1 18 13.352V14.5a1.5 1.5 0 0 1-1.5 1.5H15C7.82 16 2 10.18 2 3V3.5Z" clipRule="evenodd" />
                            </svg>
                            {officerPhone}
                          </a>
                        </li>
                      ) : null}
                    </ul>
                  </div>
                ) : null}
              </aside>
            ) : null}
          </div>

          {list.length ? (
            <div className="group/fit lg:col-span-7">
              <fieldset className="rounded-2xl bg-white p-5 shadow-xs ring-1 ring-neutral-200 sm:p-8">
                <legend className="sr-only">{legend || "Eligibility checklist"}</legend>
                {legend ? <p aria-hidden="true" className="text-sm font-semibold text-neutral-950">{legend}</p> : null}
                <ul role="list" className={`space-y-3 ${legend ? "mt-5" : ""}`}>
                  {list.map((c, i) => (
                    <li key={`${c.label}-${i}`}>
                      <label
                        htmlFor={`${uid}-c${i}`}
                        className="flex min-h-11 cursor-pointer items-start gap-4 rounded-xl px-4 py-3.5 ring-1 ring-neutral-200 transition ring-inset hover:bg-neutral-50 has-checked:bg-indigo-50 has-checked:ring-indigo-600/40 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-indigo-600"
                      >
                        <input
                          id={`${uid}-c${i}`}
                          type="checkbox"
                          data-fit-criterion=""
                          aria-describedby={c.detail ? `${uid}-d${i}` : undefined}
                          className="mt-0.5 size-5 shrink-0 cursor-pointer rounded accent-indigo-600 focus:outline-none"
                        />
                        <span className="min-w-0">
                          <span className="block text-base leading-6 font-medium text-pretty text-neutral-950">{c.label}</span>
                          {c.detail ? <span id={`${uid}-d${i}`} className="mt-1 block text-sm leading-6 text-pretty text-neutral-600">{c.detail}</span> : null}
                        </span>
                      </label>
                    </li>
                  ))}
                </ul>
              </fieldset>

              <div aria-live="polite" className="mt-6">
                <div className="group-has-[[data-fit-criterion]:not(:checked)]/fit:hidden">
                  <div className="rounded-2xl bg-indigo-950 p-6 text-white sm:p-8">
                    <div className="flex items-start gap-4">
                      <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="mt-0.5 size-7 shrink-0 text-indigo-300">
                        <path d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
                      </svg>
                      <div className="min-w-0">
                        <Sub className="text-lg leading-7 font-semibold text-balance">{fitHeading || "Looks like a fit"}</Sub>
                        {fitBody ? <p className="mt-2 text-base leading-7 text-pretty text-indigo-100">{fitBody}</p> : null}
                        {fitCtaLabel ? (
                          <a
                            href={fitCtaHref || "#"}
                            className="mt-5 inline-flex min-h-11 items-center justify-center gap-1.5 rounded-lg bg-white px-5 py-2.5 text-sm font-semibold text-indigo-950 transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                          >
                            {fitCtaLabel}
                            <svg aria-hidden="true" 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>
                          </a>
                        ) : null}
                      </div>
                    </div>
                  </div>
                </div>
                <p className="hidden text-sm leading-6 text-neutral-600 group-has-[[data-fit-criterion]:not(:checked)]/fit:block">
                  Check every statement that applies to see next steps.
                </p>
              </div>
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
