# Add the "Event Registration" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/event-registration) to this Pantheon Content Publisher (P1) Next.js project. Event summary card beside an RSVP form with party size, dietary needs and accessibility requests.

## Steps

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

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

/**
 * Event Registration — an event summary card (image, date, place, cost) beside an RSVP form
 * with party size, dietary needs and accessibility requests. Plain HTML form, no JavaScript.
 * Register: `EventRegistrationBlock: eventRegistrationBlock` in puck.config.tsx.
 */

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

export type EventRegistrationProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  eventName: string;
  imageUrl: string;
  imageAlt: string;
  date: string;
  time: string;
  location: string;
  cost: string;
  capacityNote: string;
  formAction: string;
  eventId: string;
  maxAttendees: number;
  dietaryOptions: { label: string }[];
  submitLabel: string;
  confirmationNote: 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 optional = <span className="font-normal text-neutral-600">(optional)</span>;

const icons = {
  calendar:
    "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5",
  clock: "M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z",
  pin: "M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z",
  ticket:
    "M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 0 1 0 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 0 1 0-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375Z",
};

export const eventRegistrationBlock: ComponentConfig<EventRegistrationProps> = {
  label: "Event Registration",
  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" },
    eventName: { type: "text", label: "Event name", metadata: { help: "Title on the summary card." } },
    imageUrl: { type: "text", label: "Image URL", metadata: { help: "Leave blank to hide the image." } },
    imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe what the photo shows. Leave blank only if it's purely decorative." } },
    date: { type: "text", label: "Date", metadata: { help: "Type it as it should appear, such as Saturday, November 14." } },
    time: { type: "text", label: "Time" },
    location: { type: "textarea", label: "Location", metadata: { help: "Venue on the first line, address after." } },
    cost: { type: "text", label: "Cost", metadata: { help: "Such as Free or $15 per person. Leave blank to hide it." } },
    capacityNote: { type: "text", label: "Capacity note", metadata: { help: "Such as \"40 seats, first come first served\". Leave blank to hide it." } },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: { help: "Where registrations are sent with POST. Fields: event_id, first_name, last_name, email, phone, attendees, dietary, accessibility." } },
    eventId: { type: "text", label: "Event ID", metadata: { help: "Sent as a hidden field so your system knows which event this is. Leave blank if the action URL already says." } },
    maxAttendees: { type: "number", label: "Max party size", min: 1, max: 20, metadata: { help: "The most people one registration can bring, including themselves." } },
    dietaryOptions: {
      type: "array",
      label: "Dietary options",
      min: 0,
      max: 10,
      getItemSummary: (item) => item?.label || "Option",
      defaultItemProps: { label: "New option" },
      arrayFields: { label: { type: "text", label: "Option" } },
      metadata: { help: "Choices in the dietary menu. Remove them all to hide the question, such as for events without food." },
    },
    submitLabel: { type: "text", label: "Button text" },
    confirmationNote: { type: "textarea", label: "Confirmation note", metadata: { help: "What happens after they register. Shown under the button." } },
  },
  defaultProps: {
    heading: "Save your seat",
    headingLevel: "h2",
    intro: "Registration is free and takes a minute. It helps us plan food, chairs and interpreters.",
    eventName: "Harvest Supper on the Green",
    imageUrl: "https://picsum.photos/seed/harvest/1200/800",
    imageAlt: "Long outdoor tables set with lanterns and sunflowers on a park lawn at dusk",
    date: "Saturday, November 14",
    time: "5:30 – 8:30 p.m.",
    location: "Shawnee Park Great Lawn\n4501 West Broadway, Louisville, KY",
    cost: "Free, donations welcome",
    capacityNote: "180 seats. Registration closes November 10.",
    formAction: "/events/register",
    eventId: "harvest-supper",
    maxAttendees: 6,
    dietaryOptions: [{ label: "No restrictions" }, { label: "Vegetarian" }, { label: "Vegan" }, { label: "Gluten-free" }, { label: "Halal" }, { label: "Nut allergy" }],
    submitLabel: "Register",
    confirmationNote: "You'll get a confirmation email right away and a reminder two days before.",
  },
  render: ({ id, heading, headingLevel, intro, eventName, imageUrl, imageAlt, date, time, location, cost, capacityNote, formAction, eventId, maxAttendees, dietaryOptions, submitLabel, confirmationNote }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const uid = `er-${id || "event"}`;
    const max = Math.max(1, Math.min(50, Number(maxAttendees) || 1));
    const diets = (dietaryOptions ?? []).map((d) => d?.label?.trim()).filter(Boolean) as string[];
    const locationLines = (location || "").split("\n").map((l) => l.trim()).filter(Boolean);
    const facts = [
      { icon: icons.calendar, label: "Date", value: date ? [date] : [] },
      { icon: icons.clock, label: "Time", value: time ? [time] : [] },
      { icon: icons.pin, label: "Location", value: locationLines },
      { icon: icons.ticket, label: "Cost", value: cost ? [cost] : [] },
    ].filter((f) => f.value.length);
    const hasCard = Boolean(eventName || imageUrl || facts.length || capacityNote);

    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-6xl">
          {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}

          <div className={`grid grid-cols-1 items-start gap-10 lg:gap-12 ${hasCard ? "lg:grid-cols-12" : ""} ${heading || intro ? "mt-10 sm:mt-12" : ""}`}>
            {hasCard ? (
              <article className="overflow-hidden rounded-2xl bg-neutral-950 text-white shadow-xl lg:sticky lg:top-8 lg:col-span-5">
                {imageUrl ? <img src={imageUrl} alt={imageAlt || ""} className="aspect-3/2 w-full object-cover" /> : null}
                <div className="p-6 sm:p-8">
                  {eventName ? <Sub className="text-2xl font-semibold tracking-tight text-balance">{eventName}</Sub> : null}
                  {facts.length ? (
                    <dl className={`space-y-4 ${eventName ? "mt-6" : ""}`}>
                      {facts.map((f) => (
                        <div key={f.label} className="flex gap-3">
                          <dt className="shrink-0 pt-0.5">
                            <span className="sr-only">{f.label}</span>
                            <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="size-5 text-indigo-300">
                              <path strokeLinecap="round" strokeLinejoin="round" d={f.icon} />
                            </svg>
                          </dt>
                          <dd className="min-w-0 text-base leading-6 text-neutral-200">
                            {f.value.map((line, i) => (
                              <span key={i} className={`block ${i === 0 ? "font-medium text-white" : "text-sm text-neutral-300"}`}>
                                {line}
                              </span>
                            ))}
                          </dd>
                        </div>
                      ))}
                    </dl>
                  ) : null}
                  {capacityNote ? (
                    <p className="mt-6 flex items-start gap-2 border-t border-white/10 pt-5 text-sm leading-6 text-neutral-300">
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0 text-indigo-300">
                        <path d="M10 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM6 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM1.49 15.326a.78.78 0 0 1-.358-.442 3 3 0 0 1 4.308-3.516 6.484 6.484 0 0 0-1.905 3.959c-.023.222-.014.442.025.654a4.97 4.97 0 0 1-2.07-.655ZM16.44 15.98a4.97 4.97 0 0 0 2.07-.654.78.78 0 0 0 .357-.442 3 3 0 0 0-4.308-3.517 6.484 6.484 0 0 1 1.907 3.96 2.32 2.32 0 0 1-.026.654ZM18 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM5.304 16.19a.844.844 0 0 1-.277-.71 5 5 0 0 1 9.947 0 .843.843 0 0 1-.277.71A6.975 6.975 0 0 1 10 18a6.974 6.974 0 0 1-4.696-1.81Z" />
                      </svg>
                      {capacityNote}
                    </p>
                  ) : null}
                </div>
              </article>
            ) : null}

            <form
              action={formAction || undefined}
              method="post"
              aria-label={eventName ? `Register for ${eventName}` : "Event registration"}
              className={`grid grid-cols-1 gap-x-5 gap-y-6 sm:grid-cols-2 ${hasCard ? "lg:col-span-7" : "max-w-2xl"}`}
            >
              {eventId ? <input type="hidden" name="event_id" value={eventId} /> : null}
              <p className="text-sm leading-6 text-neutral-600 sm:col-span-2">All fields are required unless marked optional.</p>
              <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}>
                  Mobile phone {optional}
                </label>
                <input id={`${uid}-phone`} name="phone" type="tel" autoComplete="tel" inputMode="tel" aria-describedby={`${uid}-phone-hint`} className={`mt-2 ${inputClass}`} />
                <p id={`${uid}-phone-hint`} className="mt-2 text-sm leading-6 text-neutral-600">Only for day-of weather changes.</p>
              </div>
              <div>
                <label htmlFor={`${uid}-count`} className={labelClass}>How many people, including you?</label>
                <input
                  id={`${uid}-count`}
                  name="attendees"
                  type="number"
                  inputMode="numeric"
                  required
                  min={1}
                  max={max}
                  step={1}
                  defaultValue={1}
                  aria-describedby={`${uid}-count-hint`}
                  className={`mt-2 tabular-nums ${inputClass}`}
                />
                <p id={`${uid}-count-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                  {max === 1 ? "One person per registration." : `Up to ${max} per registration.`}
                </p>
              </div>
              {diets.length ? (
                <div>
                  <label htmlFor={`${uid}-diet`} className={labelClass}>
                    Dietary needs {optional}
                  </label>
                  <div className="relative mt-2">
                    <select id={`${uid}-diet`} name="dietary" defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                      <option value="">Choose one</option>
                      {diets.map((d, i) => (
                        <option key={`${d}-${i}`} value={d}>
                          {d}
                        </option>
                      ))}
                    </select>
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="pointer-events-none absolute top-1/2 right-3 size-5 -translate-y-1/2 text-neutral-500">
                      <path fillRule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
                    </svg>
                  </div>
                </div>
              ) : null}
              <div className="sm:col-span-2">
                <label htmlFor={`${uid}-access`} className={labelClass}>
                  Accessibility needs {optional}
                </label>
                <textarea
                  id={`${uid}-access`}
                  name="accessibility"
                  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">
                  Wheelchair seating, ASL interpretation, large print, a quiet space. Tell us anything that helps you join in.
                </p>
              </div>
              <div className="flex flex-col gap-4 border-t border-neutral-200 pt-6 sm:col-span-2 sm:flex-row sm:items-center sm:gap-6">
                <button
                  type="submit"
                  className="inline-flex min-h-11 shrink-0 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"
                >
                  {submitLabel || "Register"}
                </button>
                {confirmationNote ? <p className="text-sm leading-6 text-pretty text-neutral-600">{confirmationNote}</p> : null}
              </div>
            </form>
          </div>
        </div>
      </section>
    );
  },
};
```
