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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/program-enrollment) to this Pantheon Content Publisher (P1) Next.js project. Camp or youth program sign-up in labelled sections: weeks, guardian, camper, health, pickup, financial aid and photo release.

## Steps

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

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

/**
 * Program Enrollment — a camp or youth-program sign-up in labelled sections: weeks to attend,
 * parent or guardian, camper, health and pickup, then consent and photo release.
 * A plain HTML form that posts to your registration endpoint, no JavaScript.
 * Register: `ProgramEnrollmentBlock: programEnrollmentBlock` in puck.config.tsx.
 */

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

type Week = { name: string; dates: string; price: string; note: string };

export type ProgramEnrollmentProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  bringList: string;
  formAction: string;
  weeks: Week[];
  weeksHint: string;
  gradeOptions: string;
  shirtSizes: string;
  showFinancialAid: boolean;
  financialAidNote: string;
  consentText: string;
  submitLabel: string;
  footnote: string;
};

const inputClass =
  "block min-h-11 w-full rounded-lg border-0 bg-white px-3.5 py-2.5 text-base text-neutral-950 shadow-xs ring-1 ring-neutral-300 ring-inset placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none";
const labelClass = "block text-sm leading-6 font-medium text-neutral-900";
const checkboxClass = "size-5 rounded border-neutral-400 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

const lines = (s?: string) =>
  (s || "")
    .split("\n")
    .map((l) => l.trim())
    .filter(Boolean);

const Optional = () => <span className="font-normal text-neutral-600">(optional)</span>;

/** A form section: on wide screens the legend sits in a left column beside its fields. */
const Section = ({ title, description, children, first }: { title: string; description?: string; children: React.ReactNode; first?: boolean }) => (
  <fieldset className={`flow-root ${first ? "" : "mt-10 border-t border-neutral-200 pt-10"}`}>
    <legend className="text-base leading-7 font-semibold text-neutral-950 lg:float-left lg:w-1/3 lg:pr-10">{title}</legend>
    <div className="mt-1 lg:float-right lg:mt-0 lg:w-2/3">
      {description ? <p className="mb-6 text-sm leading-6 text-pretty text-neutral-600">{description}</p> : null}
      {children}
    </div>
  </fieldset>
);

export const programEnrollmentBlock: ComponentConfig<ProgramEnrollmentProps> = {
  label: "Program Enrollment",
  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" },
    bringList: { type: "textarea", label: "Have these ready", metadata: { help: "One item per line, shown beside the intro. Leave blank to hide the list." } },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: {
        help: "Where the form is sent with POST. Field names: weeks (one per checked week), guardian_first_name, guardian_last_name, relationship, guardian_email, guardian_phone, street, city, state, postal_code, camper_first_name, camper_last_name, birth_date, grade, school, shirt_size, health_notes, pickup_names, financial_aid, accommodations, guardian_consent and photo_release.",
      },
    },
    weeks: {
      type: "array",
      label: "Weeks or sessions",
      min: 1,
      max: 12,
      getItemSummary: (item) => [item?.name, item?.dates].filter(Boolean).join(" · ") || "Week",
      defaultItemProps: { name: "New week", dates: "", price: "", note: "" },
      arrayFields: {
        name: { type: "text", label: "Name", metadata: { help: "Such as \"Week 3: Pond Explorers\". Sent with the form." } },
        dates: { type: "text", label: "Dates" },
        price: { type: "text", label: "Price", metadata: { help: "Shown as typed, such as $185 or a data-source token." } },
        note: { type: "text", label: "Note", metadata: { help: "Optional, such as \"4 spots left\" or \"No camp July 4\"." } },
      },
    },
    weeksHint: { type: "text", label: "Weeks hint", metadata: { help: "Short guidance under the week choices. Leave blank to hide it." } },
    gradeOptions: { type: "textarea", label: "Grade options", metadata: { help: "One choice per line for the grade menu (the grade the camper enters in the fall)." } },
    shirtSizes: { type: "textarea", label: "T-shirt sizes", metadata: { help: "One size per line. Leave blank to hide the T-shirt question." } },
    showFinancialAid: {
      type: "radio",
      label: "Ask about financial aid",
      options: [
        { label: "Yes", value: true },
        { label: "No", value: false },
      ],
    },
    financialAidNote: { type: "text", label: "Financial aid note", metadata: { help: "Shown under the financial aid checkbox." } },
    consentText: { type: "textarea", label: "Consent statement", metadata: { help: "What the parent or guardian agrees to by checking the required box." } },
    submitLabel: { type: "text", label: "Button text" },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Small print under the button, such as the refund policy. Leave blank to hide it." } },
  },
  defaultProps: {
    eyebrow: "Summer 2027 · Ages 6–12",
    heading: "Enroll your camper in Nature Day Camp",
    headingLevel: "h2",
    intro: "Each week runs Monday through Friday, 9 a.m. to 3:30 p.m., at the Cherokee Park Nature Center. Before and after care is available at drop-off.",
    bringList: "Your camper's date of birth and fall grade\nNames of adults allowed to pick up\nAny allergies or medications\nAbout 10 minutes",
    formAction: "/camps/enroll",
    weeks: [
      { name: "Week 1: Creek Critters", dates: "June 7 – 11", price: "$185", note: "" },
      { name: "Week 2: Tree Detectives", dates: "June 14 – 18", price: "$185", note: "4 spots left" },
      { name: "Week 3: Night Sky Week", dates: "June 21 – 25", price: "$185", note: "" },
      { name: "Week 4: Pond Explorers", dates: "July 5 – 9", price: "$148", note: "4-day week, no camp July 5" },
    ],
    weeksHint: "Pick as many weeks as you like. Spot counts are sample data.",
    gradeOptions: "Entering 1st grade\nEntering 2nd grade\nEntering 3rd grade\nEntering 4th grade\nEntering 5th grade\nEntering 6th grade",
    shirtSizes: "Youth XS\nYouth S\nYouth M\nYouth L\nAdult S\nAdult M",
    showFinancialAid: true,
    financialAidNote: "We'll email the short scholarship form. No family is turned away for inability to pay.",
    consentText: "I am this camper's parent or legal guardian. I give permission for them to take part in camp activities, including hikes and creek play, and for staff to seek emergency medical care if I can't be reached.",
    submitLabel: "Continue to payment",
    footnote: "Full refunds until May 15, minus a $15 processing fee. After that, we refund only if we can fill the spot.",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, bringList, formAction, weeks, weeksHint, gradeOptions, shirtSizes, showFinancialAid, financialAidNote, consentText, submitLabel, footnote }) => {
    const H = headingLevel || "h2";
    const uid = `pe-${id || "enroll"}`;
    const weekList = (weeks ?? []).filter((w) => w?.name);
    const grades = lines(gradeOptions);
    const sizes = lines(shirtSizes);
    const bring = lines(bringList);
    const hasHeader = Boolean(eyebrow || heading || intro || bring.length);

    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-5xl">
          {hasHeader ? (
            <div className="grid grid-cols-1 gap-8 lg:grid-cols-3 lg:gap-10">
              <div className={bring.length ? "lg:col-span-2" : "lg:col-span-3"}>
                {eyebrow ? <p className="text-sm font-semibold tracking-wide 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 max-w-2xl text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
              </div>
              {bring.length ? (
                <div className="rounded-2xl bg-indigo-50 p-6 ring-1 ring-indigo-100">
                  <p className="text-sm leading-6 font-semibold text-neutral-950">Have these ready</p>
                  <ul role="list" className="mt-3 space-y-2 text-sm leading-6 text-neutral-700">
                    {bring.map((b, i) => (
                      <li key={i} className="flex gap-2.5">
                        <span aria-hidden="true" className="mt-2.5 size-1.5 shrink-0 rounded-full bg-indigo-600" />
                        {b}
                      </li>
                    ))}
                  </ul>
                </div>
              ) : null}
            </div>
          ) : null}

          <form action={formAction || undefined} method="post" className={`rounded-3xl bg-neutral-50 p-6 ring-1 ring-neutral-200 sm:p-10 ${hasHeader ? "mt-12 sm:mt-16" : ""}`}>
            <p className="mb-10 text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

            {weekList.length ? (
              <Section title="Weeks" description={weeksHint || undefined} first>
                <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
                  {weekList.map((w, i) => (
                    <label
                      key={`${w.name}-${i}`}
                      className="flex min-h-11 cursor-pointer gap-3 rounded-xl bg-white p-4 ring-1 ring-neutral-300 transition select-none ring-inset hover:ring-indigo-400 has-checked:bg-indigo-50 has-checked:ring-2 has-checked:ring-indigo-600 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-indigo-600"
                    >
                      <span className="flex h-6 shrink-0 items-center">
                        <input type="checkbox" name="weeks" value={w.name} className="size-5 rounded accent-indigo-600 focus-visible:outline-none" />
                      </span>
                      <span className="min-w-0 flex-1">
                        <span className="flex flex-wrap items-baseline justify-between gap-x-3">
                          <span className="text-base leading-6 font-semibold text-neutral-950">{w.name}</span>
                          {w.price ? <span className="text-base leading-6 font-semibold text-neutral-950 tabular-nums">{w.price}</span> : null}
                        </span>
                        {w.dates ? <span className="mt-0.5 block text-sm leading-6 text-neutral-600">{w.dates}</span> : null}
                        {w.note ? <span className="mt-1 block text-sm leading-6 font-medium text-indigo-700">{w.note}</span> : null}
                      </span>
                    </label>
                  ))}
                </div>
              </Section>
            ) : null}

            <Section title="Parent or guardian" description="We send confirmations, forms and camp-day updates here." first={!weekList.length}>
              <div className="grid grid-cols-1 gap-x-6 gap-y-6 sm:grid-cols-2">
                <div>
                  <label htmlFor={`${uid}-gfirst`} className={labelClass}>First name</label>
                  <input id={`${uid}-gfirst`} name="guardian_first_name" type="text" required autoComplete="given-name" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-glast`} className={labelClass}>Last name</label>
                  <input id={`${uid}-glast`} name="guardian_last_name" type="text" required autoComplete="family-name" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-rel`} className={labelClass}>Relationship to camper</label>
                  <select id={`${uid}-rel`} name="relationship" required defaultValue="" className={`mt-2 ${inputClass}`}>
                    <option value="" disabled>
                      Choose one
                    </option>
                    <option>Parent</option>
                    <option>Legal guardian</option>
                    <option>Grandparent with custody</option>
                    <option>Foster parent</option>
                    <option>Other legal caregiver</option>
                  </select>
                </div>
                <div>
                  <label htmlFor={`${uid}-gemail`} className={labelClass}>Email</label>
                  <input id={`${uid}-gemail`} name="guardian_email" type="email" required autoComplete="email" inputMode="email" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-gphone`} className={labelClass}>Mobile phone</label>
                  <input id={`${uid}-gphone`} name="guardian_phone" type="tel" required autoComplete="tel" inputMode="tel" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-street`} className={labelClass}>Street address</label>
                  <input id={`${uid}-street`} name="street" type="text" required autoComplete="street-address" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="grid grid-cols-1 gap-x-4 gap-y-6 sm:col-span-2 sm:grid-cols-6">
                  <div className="sm:col-span-3">
                    <label htmlFor={`${uid}-city`} className={labelClass}>City</label>
                    <input id={`${uid}-city`} name="city" type="text" required autoComplete="address-level2" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div className="sm:col-span-1">
                    <label htmlFor={`${uid}-state`} className={labelClass}>State</label>
                    <input id={`${uid}-state`} name="state" type="text" required autoComplete="address-level1" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div className="sm:col-span-2">
                    <label htmlFor={`${uid}-zip`} className={labelClass}>ZIP code</label>
                    <input id={`${uid}-zip`} name="postal_code" type="text" required autoComplete="postal-code" inputMode="numeric" className={`mt-2 ${inputClass}`} />
                  </div>
                </div>
              </div>
            </Section>

            <Section title="Camper">
              <div className="grid grid-cols-1 gap-x-6 gap-y-6 sm:grid-cols-2">
                <div>
                  <label htmlFor={`${uid}-cfirst`} className={labelClass}>First name</label>
                  <input id={`${uid}-cfirst`} name="camper_first_name" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-clast`} className={labelClass}>Last name</label>
                  <input id={`${uid}-clast`} name="camper_last_name" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-dob`} className={labelClass}>Date of birth</label>
                  <input id={`${uid}-dob`} name="birth_date" type="date" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                </div>
                {grades.length ? (
                  <div>
                    <label htmlFor={`${uid}-grade`} className={labelClass}>Grade this fall</label>
                    <select id={`${uid}-grade`} name="grade" required defaultValue="" className={`mt-2 ${inputClass}`}>
                      <option value="" disabled>
                        Choose a grade
                      </option>
                      {grades.map((g, i) => (
                        <option key={`${g}-${i}`} value={g}>
                          {g}
                        </option>
                      ))}
                    </select>
                  </div>
                ) : null}
                <div>
                  <label htmlFor={`${uid}-school`} className={labelClass}>
                    School <Optional />
                  </label>
                  <input id={`${uid}-school`} name="school" type="text" autoComplete="off" className={`mt-2 ${inputClass}`} />
                </div>
                {sizes.length ? (
                  <div>
                    <label htmlFor={`${uid}-shirt`} className={labelClass}>T-shirt size</label>
                    <select id={`${uid}-shirt`} name="shirt_size" required defaultValue="" className={`mt-2 ${inputClass}`}>
                      <option value="" disabled>
                        Choose a size
                      </option>
                      {sizes.map((s, i) => (
                        <option key={`${s}-${i}`} value={s}>
                          {s}
                        </option>
                      ))}
                    </select>
                  </div>
                ) : null}
              </div>
            </Section>

            <Section title="Health and pickup" description="Shared only with your camper's counselors and our camp nurse.">
              <div className="space-y-6">
                <div>
                  <label htmlFor={`${uid}-health`} className={labelClass}>
                    Allergies, medications or health notes <Optional />
                  </label>
                  <textarea id={`${uid}-health`} name="health_notes" rows={3} aria-describedby={`${uid}-health-hint`} className={`mt-2 ${inputClass}`} />
                  <p id={`${uid}-health-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                    Include EpiPens or inhalers your camper will bring each day.
                  </p>
                </div>
                <div>
                  <label htmlFor={`${uid}-pickup`} className={labelClass}>Adults allowed to pick up</label>
                  <textarea id={`${uid}-pickup`} name="pickup_names" rows={2} required aria-describedby={`${uid}-pickup-hint`} className={`mt-2 ${inputClass}`} />
                  <p id={`${uid}-pickup-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                    Full names, one per line. They&rsquo;ll show a photo ID at pickup.
                  </p>
                </div>
                <div>
                  <label htmlFor={`${uid}-access`} className={labelClass}>
                    Accessibility accommodations <Optional />
                  </label>
                  <textarea id={`${uid}-access`} name="accommodations" rows={3} aria-describedby={`${uid}-access-hint`} className={`mt-2 ${inputClass}`} />
                  <p id={`${uid}-access-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                    Such as a one-on-one aide, quiet breaks, a sensory kit or mobility support. Our inclusion coordinator will call you before camp starts.
                  </p>
                </div>
                {showFinancialAid !== false ? (
                  <div className="flex gap-3">
                    <div className="flex h-11 shrink-0 items-center">
                      <input
                        id={`${uid}-aid`}
                        name="financial_aid"
                        type="checkbox"
                        value="yes"
                        aria-describedby={financialAidNote ? `${uid}-aid-hint` : undefined}
                        className={checkboxClass}
                      />
                    </div>
                    <div className="flex min-h-11 flex-col justify-center text-sm leading-6">
                      <label htmlFor={`${uid}-aid`} className="cursor-pointer font-medium text-neutral-900">
                        I&rsquo;d like information about financial aid
                      </label>
                      {financialAidNote ? (
                        <p id={`${uid}-aid-hint`} className="text-neutral-600">
                          {financialAidNote}
                        </p>
                      ) : null}
                    </div>
                  </div>
                ) : null}
              </div>
            </Section>

            <Section title="Permissions">
              <div className="space-y-8">
                <div className="flex gap-3 rounded-xl bg-white p-4 ring-1 ring-neutral-200">
                  <div className="flex h-11 shrink-0 items-center">
                    <input id={`${uid}-consent`} name="guardian_consent" type="checkbox" value="yes" required className={checkboxClass} />
                  </div>
                  <label htmlFor={`${uid}-consent`} className="flex min-h-11 cursor-pointer items-center text-sm leading-6 text-pretty text-neutral-900">
                    {consentText || "I am this camper's parent or legal guardian and I give permission for them to take part."}
                  </label>
                </div>
                <fieldset>
                  <legend className="text-sm leading-6 font-medium text-neutral-900">Photo release</legend>
                  <p id={`${uid}-photo-hint`} className="mt-1 text-sm leading-6 text-neutral-600">
                    May we use photos of your camper in our newsletters and website? We never print last names.
                  </p>
                  <div className="mt-3 flex flex-col gap-2 sm:flex-row sm:gap-6">
                    {[
                      { value: "yes", label: "Yes, photos are fine" },
                      { value: "no", label: "No photos, please" },
                    ].map((o) => (
                      <label key={o.value} className="flex min-h-11 cursor-pointer items-center gap-3 text-sm leading-6 text-neutral-900">
                        <input
                          type="radio"
                          name="photo_release"
                          value={o.value}
                          required
                          aria-describedby={`${uid}-photo-hint`}
                          className="size-5 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                        />
                        {o.label}
                      </label>
                    ))}
                  </div>
                </fieldset>
              </div>
            </Section>

            <div className="mt-10 flex flex-col gap-4 border-t border-neutral-200 pt-8 sm:flex-row sm:items-center sm:justify-end sm:gap-6">
              {footnote ? <p className="text-sm leading-6 text-pretty text-neutral-600 sm:mr-auto sm:max-w-md">{footnote}</p> : null}
              <button
                type="submit"
                className="inline-flex min-h-12 shrink-0 items-center justify-center gap-2 rounded-lg bg-indigo-600 px-6 py-3 text-base font-semibold text-white shadow-xs transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
              >
                {submitLabel || "Continue"}
                <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>
              </button>
            </div>
          </form>
        </div>
      </section>
    );
  },
};
```
