# Add the "Volunteer Application" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/volunteer-application) to this Pantheon Content Publisher (P1) Next.js project. Interest cards, day and time availability, a reference and age and background-check consent beside a what-happens-next rail.

## Steps

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

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

/**
 * Volunteer Application — interests, weekly availability, experience, a reference and the
 * age and background-check acknowledgements, beside a "what happens next" rail. Posts to any form endpoint.
 * Register: `VolunteerApplicationBlock: volunteerApplicationBlock` in puck.config.tsx.
 */

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

export type VolunteerApplicationProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  formAction: string;
  interests: { label: string; detail: string }[];
  requireAdult: boolean;
  backgroundCheckNote: string;
  askReference: boolean;
  submitLabel: string;
  stepsHeading: string;
  steps: { title: string; body: string }[];
  contactNote: string;
};

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

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 legendClass = "text-base leading-7 font-semibold text-neutral-950";
const checkClass = "size-5 rounded border-neutral-400 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";
const pillClass =
  "relative flex min-h-11 min-w-14 flex-1 cursor-pointer items-center justify-center rounded-lg bg-white px-3 text-sm font-semibold text-neutral-700 ring-1 ring-neutral-300 transition select-none ring-inset hover:ring-indigo-400 has-checked:bg-indigo-50 has-checked:text-indigo-900 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";
const optional = <span className="font-normal text-neutral-600">(optional)</span>;

const DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
const DAY_NAMES: Record<string, string> = { Mon: "Monday", Tue: "Tuesday", Wed: "Wednesday", Thu: "Thursday", Fri: "Friday", Sat: "Saturday", Sun: "Sunday" };
const TIMES = [
  { value: "mornings", label: "Mornings" },
  { value: "afternoons", label: "Afternoons" },
  { value: "evenings", label: "Evenings" },
  { value: "flexible", label: "I'm flexible" },
];

export const volunteerApplicationBlock: ComponentConfig<VolunteerApplicationProps> = {
  label: "Volunteer Application",
  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." },
    },
    intro: { type: "textarea", label: "Intro" },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: {
        help: "Where the form is sent with POST. Field names: first_name, last_name, email, phone, postal_code, interests (one per checked box), days (one per checked day), times, experience, reference_name, reference_contact, adult, background_check.",
      },
    },
    interests: {
      type: "array",
      label: "Areas of interest",
      min: 1,
      max: 10,
      getItemSummary: (item) => item?.label || "Area",
      defaultItemProps: { label: "New area", detail: "" },
      arrayFields: {
        label: { type: "text", label: "Area" },
        detail: { type: "text", label: "Short description", metadata: { help: "One line about the work. Leave blank to hide it." } },
      },
      metadata: { help: "Applicants can pick as many as they like." },
    },
    requireAdult: {
      type: "radio",
      label: "Ask to confirm age 18+",
      options: [
        { label: "Yes", value: true },
        { label: "No", value: false },
      ],
      metadata: { help: "Adds a required checkbox. Turn it off if teens can apply on this form." },
    },
    backgroundCheckNote: {
      type: "textarea",
      label: "Background check statement",
      metadata: { help: "What applicants agree to. Leave blank if your roles don't need a check." },
    },
    askReference: {
      type: "radio",
      label: "Ask for a reference",
      options: [
        { label: "Yes", value: true },
        { label: "No", value: false },
      ],
    },
    submitLabel: { type: "text", label: "Button text" },
    stepsHeading: { type: "text", label: "Sidebar heading", metadata: { help: "Leave the heading and steps blank to hide the sidebar." } },
    steps: {
      type: "array",
      label: "What happens next",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.title || "Step",
      defaultItemProps: { title: "New step", body: "" },
      arrayFields: {
        title: { type: "text", label: "Step" },
        body: { type: "textarea", label: "Detail" },
      },
    },
    contactNote: { type: "textarea", label: "Contact note", metadata: { help: "Small print at the bottom of the sidebar. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Apply to volunteer",
    headingLevel: "h2",
    intro: "Tell us a little about yourself and when you're free. There's no wrong answer — we'll match you with a role that fits your week.",
    formAction: "/volunteer/apply",
    interests: [
      { label: "Food pantry", detail: "Sort donations and pack grocery boxes" },
      { label: "Youth tutoring", detail: "Reading and math help, grades 2–6" },
      { label: "Meal delivery", detail: "Drive a route to homebound seniors" },
      { label: "Front desk", detail: "Welcome visitors and answer phones" },
      { label: "Special events", detail: "Set up, greet and clean up" },
      { label: "Skilled help", detail: "Legal, IT, design, translation and more" },
    ],
    requireAdult: true,
    backgroundCheckNote: "Roles working with children or delivering to homes require a background check, which we pay for. I agree to complete one if my role needs it.",
    askReference: true,
    submitLabel: "Submit application",
    stepsHeading: "What happens next",
    steps: [
      { title: "We review your application", body: "Our volunteer coordinator reads every application within five business days." },
      { title: "A short phone chat", body: "Fifteen minutes to talk through roles and answer your questions." },
      { title: "Orientation", body: "A 90-minute session, offered the first Saturday of each month." },
      { title: "Your first shift", body: "You'll work alongside an experienced volunteer until you're comfortable." },
    ],
    contactNote: "Questions? Call Dana Whitfield, Volunteer Coordinator, at (502) 555-0193.",
  },
  render: ({ id, heading, headingLevel, intro, formAction, interests, requireAdult, backgroundCheckNote, askReference, submitLabel, stepsHeading, steps, contactNote }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const uid = `va-${id || "form"}`;
    const areas = (interests ?? []).filter((a) => a?.label?.trim());
    const stepList = (steps ?? []).filter((s) => s?.title?.trim());
    const hasAside = Boolean(stepsHeading || stepList.length || contactNote);
    const hasAck = requireAdult !== false || Boolean(backgroundCheckNote);

    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 grid grid-cols-1 gap-12 lg:gap-16 ${hasAside ? "max-w-6xl lg:grid-cols-12" : "max-w-3xl"}`}>
          <div className={hasAside ? "lg:col-span-8" : ""}>
            {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 max-w-2xl text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}

            <form action={formAction || undefined} method="post" className={`space-y-12 ${heading || intro ? "mt-10" : ""}`}>
              <p className="text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

              <fieldset>
                <legend className={legendClass}>About you</legend>
                <div className="mt-4 grid grid-cols-1 gap-6 sm:grid-cols-2">
                  <div>
                    <label htmlFor={`${uid}-first`} className={labelClass}>First name</label>
                    <input id={`${uid}-first`} name="first_name" type="text" required autoComplete="given-name" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-last`} className={labelClass}>Last name</label>
                    <input id={`${uid}-last`} name="last_name" type="text" required autoComplete="family-name" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-email`} className={labelClass}>Email</label>
                    <input id={`${uid}-email`} name="email" type="email" required autoComplete="email" inputMode="email" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-phone`} className={labelClass}>Phone</label>
                    <input id={`${uid}-phone`} name="phone" type="tel" required autoComplete="tel" inputMode="tel" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-zip`} className={labelClass}>ZIP code</label>
                    <input
                      id={`${uid}-zip`}
                      name="postal_code"
                      type="text"
                      required
                      autoComplete="postal-code"
                      inputMode="numeric"
                      aria-describedby={`${uid}-zip-hint`}
                      className={`mt-2 ${inputClass}`}
                    />
                    <p id={`${uid}-zip-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                      Helps us suggest the site closest to you.
                    </p>
                  </div>
                </div>
              </fieldset>

              {areas.length ? (
                <fieldset aria-describedby={`${uid}-areas-hint`}>
                  <legend className={legendClass}>Where would you like to help?</legend>
                  <p id={`${uid}-areas-hint`} className="mt-1 text-sm leading-6 text-neutral-600">
                    Choose any that interest you.
                  </p>
                  <div className="mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2">
                    {areas.map((a, i) => (
                      <label
                        key={`${a.label}-${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"
                      >
                        <input type="checkbox" name="interests" value={a.label} className={`mt-0.5 shrink-0 ${checkClass}`} />
                        <span className="text-sm leading-6">
                          <span className="block font-semibold text-neutral-950">{a.label}</span>
                          {a.detail ? <span className="block text-neutral-600">{a.detail}</span> : null}
                        </span>
                      </label>
                    ))}
                  </div>
                </fieldset>
              ) : null}

              <div className="space-y-8">
                <fieldset>
                  <legend className={legendClass}>Which days are you usually free?</legend>
                  <div className="mt-4 flex flex-wrap gap-2">
                    {DAYS.map((d) => (
                      <label key={d} className={pillClass}>
                        <input type="checkbox" name="days" value={d} className="sr-only" />
                        <span aria-hidden="true">{d}</span>
                        <span className="sr-only">{DAY_NAMES[d]}</span>
                      </label>
                    ))}
                  </div>
                </fieldset>
                <fieldset>
                  <legend className={legendClass}>What time of day works best?</legend>
                  <div className="mt-4 flex flex-wrap gap-2">
                    {TIMES.map((t, i) => (
                      <label key={t.value} className={pillClass}>
                        <input type="radio" name="times" value={t.value} required={i === 0} className="sr-only" />
                        {t.label}
                      </label>
                    ))}
                  </div>
                </fieldset>
              </div>

              <div>
                <label htmlFor={`${uid}-exp`} className={labelClass}>Relevant experience or skills {optional}</label>
                <textarea
                  id={`${uid}-exp`}
                  name="experience"
                  rows={4}
                  aria-describedby={`${uid}-exp-hint`}
                  className={`mt-2 ${inputClass}`}
                />
                <p id={`${uid}-exp-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                  Past volunteering, languages you speak, a commercial driver&rsquo;s license — anything that helps.
                </p>
              </div>

              {askReference !== false ? (
                <fieldset>
                  <legend className={legendClass}>One reference</legend>
                  <p className="mt-1 text-sm leading-6 text-neutral-600">A teacher, employer or community leader who isn&rsquo;t a relative.</p>
                  <div className="mt-4 grid grid-cols-1 gap-6 sm:grid-cols-2">
                    <div>
                      <label htmlFor={`${uid}-ref-name`} className={labelClass}>Their name</label>
                      <input id={`${uid}-ref-name`} name="reference_name" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                    </div>
                    <div>
                      <label htmlFor={`${uid}-ref-contact`} className={labelClass}>Phone or email</label>
                      <input id={`${uid}-ref-contact`} name="reference_contact" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                    </div>
                  </div>
                </fieldset>
              ) : null}

              {hasAck ? (
                <fieldset className="rounded-xl bg-neutral-50 p-4 ring-1 ring-neutral-200 sm:p-6">
                  <legend className="sr-only">Acknowledgements</legend>
                  <div className="space-y-4">
                    {requireAdult !== false ? (
                      <div className="flex gap-3">
                        <div className="flex h-11 shrink-0 items-center">
                          <input id={`${uid}-adult`} name="adult" type="checkbox" value="yes" required className={checkClass} />
                        </div>
                        <label htmlFor={`${uid}-adult`} className="flex min-h-11 cursor-pointer items-center text-sm leading-6 font-medium text-neutral-900">
                          I am 18 or older
                        </label>
                      </div>
                    ) : null}
                    {backgroundCheckNote ? (
                      <div className="flex gap-3">
                        <div className="flex h-11 shrink-0 items-center">
                          <input
                            id={`${uid}-bg`}
                            name="background_check"
                            type="checkbox"
                            value="agreed"
                            required
                            aria-describedby={`${uid}-bg-hint`}
                            className={checkClass}
                          />
                        </div>
                        <div className="text-sm leading-6">
                          <label htmlFor={`${uid}-bg`} className="flex min-h-11 cursor-pointer items-center font-medium text-neutral-900">
                            I agree to a background check if my role needs one
                          </label>
                          <p id={`${uid}-bg-hint`} className="text-pretty text-neutral-600">
                            {backgroundCheckNote}
                          </p>
                        </div>
                      </div>
                    ) : null}
                  </div>
                </fieldset>
              ) : null}

              <button
                type="submit"
                className="inline-flex min-h-12 w-full items-center justify-center 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 sm:w-auto"
              >
                {submitLabel || "Submit application"}
              </button>
            </form>
          </div>

          {hasAside ? (
            <aside aria-labelledby={stepsHeading ? `${uid}-next` : undefined} aria-label={stepsHeading ? undefined : "What happens next"} className="lg:col-span-4">
              <div className="rounded-2xl bg-neutral-950 p-6 text-white sm:p-8 lg:sticky lg:top-8">
                {stepsHeading ? (
                  <Sub id={`${uid}-next`} className="text-lg leading-7 font-semibold text-white">
                    {stepsHeading}
                  </Sub>
                ) : null}
                {stepList.length ? (
                  <ol role="list" className={`relative space-y-8 ${stepsHeading ? "mt-8" : ""}`}>
                    {stepList.map((s, i) => (
                      <li key={`${s.title}-${i}`} className="relative flex gap-4">
                        {i < stepList.length - 1 ? <span aria-hidden="true" className="absolute top-9 -bottom-6 left-4 w-px -translate-x-1/2 bg-white/15" /> : null}
                        <span aria-hidden="true" className="flex size-8 shrink-0 items-center justify-center rounded-full bg-indigo-600 text-sm font-semibold text-white tabular-nums">
                          {i + 1}
                        </span>
                        <div className="min-w-0 pt-1">
                          <p className="text-base leading-6 font-semibold text-white">
                            <span className="sr-only">Step {i + 1}: </span>
                            {s.title}
                          </p>
                          {s.body ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-300">{s.body}</p> : null}
                        </div>
                      </li>
                    ))}
                  </ol>
                ) : null}
                {contactNote ? <p className="mt-8 border-t border-white/10 pt-6 text-sm leading-6 text-pretty text-neutral-300">{contactNote}</p> : null}
              </div>
            </aside>
          ) : null}
        </div>
      </section>
    );
  },
};
```
