# Add the "Form Hero" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/hero-form) to this Pantheon Content Publisher (P1) Next.js project. Headline and checklist beside a real sign-up form with name, email and interest dropdown that posts to your handler.

## Steps

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

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

/**
 * Hero (Form) — headline and a short checklist of what people get, beside a real sign-up
 * form (name, email, interest) that posts to your form handler. No JavaScript.
 * Register: `HeroFormBlock: heroFormBlock` in puck.config.tsx.
 */

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

export type HeroFormProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  body: string;
  points: { text: string }[];
  formTitle: string;
  formAction: string;
  nameLabel: string;
  emailLabel: string;
  interestLabel: string;
  interests: { label: string }[];
  buttonLabel: string;
  privacyNote: string;
};

export const heroFormBlock: ComponentConfig<HeroFormProps> = {
  label: "Hero (Form)",
  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 (page title)", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Use H1 when this hero is the top of the page. The look doesn't change." },
    },
    body: { type: "textarea", label: "Body" },
    points: {
      type: "array",
      label: "Checklist",
      min: 0,
      max: 5,
      getItemSummary: (item) => item?.text?.slice(0, 48) || "Point",
      defaultItemProps: { text: "Another reason to sign up" },
      arrayFields: { text: { type: "text", label: "Text" } },
      metadata: { help: "Short reasons to fill in the form, shown with check marks." },
    },
    formTitle: { type: "text", label: "Form title", metadata: { help: "Shown at the top of the form card and used as the form's accessible name." } },
    formAction: { type: "text", label: "Form action URL", metadata: { help: "Where the form is sent, from your form tool or CRM (the form's action attribute). Always sent with POST, as fields named name, email and interest." } },
    nameLabel: { type: "text", label: "Name field label" },
    emailLabel: { type: "text", label: "Email field label" },
    interestLabel: { type: "text", label: "Interest field label" },
    interests: {
      type: "array",
      label: "Interest options",
      min: 1,
      max: 10,
      getItemSummary: (item) => item?.label || "Option",
      defaultItemProps: { label: "New option" },
      arrayFields: { label: { type: "text", label: "Option" } },
      metadata: { help: "Choices in the dropdown. The text you type is what gets submitted." },
    },
    buttonLabel: { type: "text", label: "Button text" },
    privacyNote: { type: "textarea", label: "Privacy note", metadata: { help: "Short line under the button. Leave blank to hide it." } },
  },
  defaultProps: {
    eyebrow: "Volunteer with Harvest Commons",
    heading: "Two hours a month feeds a neighbor for a week",
    headingLevel: "h1",
    body: "Our pantries, gardens and delivery routes run on volunteers. Tell us what you're interested in and a coordinator will match you with a shift that fits your schedule.",
    points: [
      { text: "Weekday, evening and weekend shifts" },
      { text: "Training provided, no experience needed" },
      { text: "Group and corporate days available" },
    ],
    formTitle: "Get matched with a shift",
    formAction: "/volunteer/interest",
    nameLabel: "Full name",
    emailLabel: "Email",
    interestLabel: "I'm most interested in",
    interests: [
      { label: "Sorting and packing at the pantry" },
      { label: "Driving home deliveries" },
      { label: "Working in the community garden" },
      { label: "Office and event help" },
      { label: "Not sure yet" },
    ],
    buttonLabel: "Send my interest",
    privacyNote: "A coordinator replies within two business days. We never sell or share your information.",
  },
  render: ({ id, eyebrow, heading, headingLevel, body, points, formTitle, formAction, nameLabel, emailLabel, interestLabel, interests, buttonLabel, privacyNote }) => {
    const H = headingLevel || "h1";
    const uid = `p1-hero-form-${id}`;
    const checks = (points ?? []).filter((p) => p?.text);
    const options = (interests ?? []).filter((o) => o?.label);
    const field =
      "block min-h-12 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";
    return (
      <section className="relative isolate overflow-hidden bg-neutral-50 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div aria-hidden="true" className="absolute inset-y-0 right-0 -z-10 hidden w-1/3 bg-indigo-600 lg:block" />
        <div className="mx-auto grid max-w-7xl grid-cols-1 items-center gap-12 lg:grid-cols-12 lg:gap-16">
          <div className="lg:col-span-6">
            {eyebrow ? <p className="text-sm font-semibold text-indigo-700">{eyebrow}</p> : null}
            {heading ? (
              <H className={`${eyebrow ? "mt-3" : ""} text-4xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-5xl`}>{heading}</H>
            ) : null}
            {body ? <p className="mt-6 max-w-xl text-lg leading-8 text-pretty text-neutral-600">{body}</p> : null}
            {checks.length ? (
              <ul className="mt-8 space-y-3">
                {checks.map((p, i) => (
                  <li key={`${p.text}-${i}`} className="flex gap-3 text-base leading-7 text-neutral-800">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-1 size-5 shrink-0 text-indigo-600">
                      <path fillRule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clipRule="evenodd" />
                    </svg>
                    <span>{p.text}</span>
                  </li>
                ))}
              </ul>
            ) : null}
          </div>

          <div className="lg:col-span-6 lg:pl-8">
            <form
              action={formAction || undefined}
              method="post"
              aria-labelledby={formTitle ? `${uid}-title` : undefined}
              className="rounded-2xl bg-white p-6 shadow-xl ring-1 ring-neutral-950/5 sm:p-8"
            >
              {formTitle ? (
                <p id={`${uid}-title`} className="text-xl font-semibold tracking-tight text-neutral-950">
                  {formTitle}
                </p>
              ) : null}
              <div className={`${formTitle ? "mt-6" : ""} space-y-5`}>
                <div>
                  <label htmlFor={`${uid}-name`} className="block text-sm font-medium text-neutral-900">
                    {nameLabel || "Full name"}
                  </label>
                  <input id={`${uid}-name`} type="text" name="name" required autoComplete="name" className={`mt-2 ${field}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-email`} className="block text-sm font-medium text-neutral-900">
                    {emailLabel || "Email"}
                  </label>
                  <input id={`${uid}-email`} type="email" name="email" required autoComplete="email" className={`mt-2 ${field}`} />
                </div>
                {options.length ? (
                  <div>
                    <label htmlFor={`${uid}-interest`} className="block text-sm font-medium text-neutral-900">
                      {interestLabel || "I'm interested in"}
                    </label>
                    <div className="relative mt-2">
                      <select id={`${uid}-interest`} name="interest" className={`appearance-none pr-10 ${field}`}>
                        {options.map((o, i) => (
                          <option key={`${o.label}-${i}`} value={o.label}>
                            {o.label}
                          </option>
                        ))}
                      </select>
                      <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 text-neutral-500">
                        <path fillRule="evenodd" d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
                      </svg>
                    </div>
                  </div>
                ) : null}
              </div>
              <button
                type="submit"
                className="mt-8 inline-flex min-h-12 w-full items-center justify-center rounded-lg bg-indigo-600 px-5 py-3 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
              >
                {buttonLabel || "Submit"}
              </button>
              {privacyNote ? <p className="mt-4 text-sm leading-6 text-pretty text-neutral-600">{privacyNote}</p> : null}
            </form>
          </div>
        </div>
      </section>
    );
  },
};
```
