# Add the "Campus Visit Signup" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/campus-visit-signup) to this Pantheon Content Publisher (P1) Next.js project. Visit-type cards, date and time picks, student and guest details beside a where-to-go card with parking and access notes.

## Steps

1. Create `components/puck/campus-visit-signup-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 { campusVisitSignupBlock } from "./components/puck/campus-visit-signup-block";`
3. Register it under `components` as `CampusVisitSignupBlock: campusVisitSignupBlock`.
4. Add `"CampusVisitSignupBlock"` 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/campus-visit-signup-block.tsx`

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

/**
 * Campus Visit Signup — prospective students pick a visit type, a date and a start time, then
 * share their details, guests and access needs, beside a where-to-go card with parking notes.
 * A plain HTML form that posts to your admissions endpoint, no JavaScript.
 * Register: `CampusVisitSignupBlock: campusVisitSignupBlock` in puck.config.tsx.
 */

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

type VisitType = { name: string; length: string; description: string };
type Detail = { label: string; value: string };

export type CampusVisitSignupProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  formAction: string;
  visitTypes: VisitType[];
  times: string;
  dateHint: string;
  gradYearOptions: string;
  maxGuests: string;
  submitLabel: string;
  privacyNote: string;
  imageUrl: string;
  imageAlt: string;
  sidebarHeading: string;
  details: Detail[];
  sidebarNote: 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-sm leading-6 font-semibold text-neutral-950";

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

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

export const campusVisitSignupBlock: ComponentConfig<CampusVisitSignupProps> = {
  label: "Campus Visit Signup",
  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" },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: {
        help: "Where the form is sent with POST. Field names: visit_type, visit_date, visit_time, first_name, last_name, email, phone, high_school, grad_year, intended_major, guests, accommodations and guardian_consent.",
      },
    },
    visitTypes: {
      type: "array",
      label: "Visit types",
      min: 1,
      max: 4,
      getItemSummary: (item) => item?.name || "Visit type",
      defaultItemProps: { name: "New visit type", length: "1 hour", description: "" },
      arrayFields: {
        name: { type: "text", label: "Name", metadata: { help: "Sent with the form as visit_type." } },
        length: { type: "text", label: "Length" },
        description: { type: "textarea", label: "Description" },
      },
    },
    times: { type: "textarea", label: "Start times", metadata: { help: "One time per line, such as 10:00 a.m. Leave blank to hide the time choice." } },
    dateHint: { type: "text", label: "Date hint", metadata: { help: "Guidance under the date picker, such as which days you host visits." } },
    gradYearOptions: { type: "textarea", label: "Graduation year options", metadata: { help: "One choice per line for the high school graduation year menu." } },
    maxGuests: { type: "text", label: "Most guests", metadata: { help: "The largest number of guests one student can bring, such as 4." } },
    submitLabel: { type: "text", label: "Button text" },
    privacyNote: { type: "textarea", label: "Privacy note", metadata: { help: "Shown under the button. Leave blank to hide it." } },
    imageUrl: { type: "text", label: "Image URL", metadata: { help: "Photo at the top of the where-to-go card. Leave blank to hide it." } },
    imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe what the photo shows. Leave blank only if it's purely decorative." } },
    sidebarHeading: { type: "text", label: "Card heading", metadata: { help: "Leave the heading, details and note blank to hide the card." } },
    details: {
      type: "array",
      label: "Where-to-go details",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.label || "Detail",
      defaultItemProps: { label: "New detail", value: "" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        value: { type: "textarea", label: "Value" },
      },
    },
    sidebarNote: { type: "textarea", label: "Card note", metadata: { help: "Small print at the bottom of the card, such as how to reschedule." } },
  },
  defaultProps: {
    eyebrow: "Visit campus",
    heading: "Come see where you'll learn",
    headingLevel: "h2",
    intro: "Walk the quad with a current student, sit in on a class and meet an admissions counselor. Families are welcome on every visit.",
    formAction: "/admissions/visit",
    visitTypes: [
      { name: "Campus tour", length: "90 minutes", description: "A student-led walk through classrooms, the library, a residence hall and the dining commons." },
      { name: "Tour and info session", length: "2.5 hours", description: "The tour plus a talk with admissions about applying, scholarships and financial aid." },
      { name: "Discover Day", length: "Full day", description: "Sit in on a class, eat lunch on us and meet faculty in the major you're curious about." },
    ],
    times: "9:30 a.m.\n11:00 a.m.\n1:30 p.m.\n3:00 p.m.",
    dateHint: "We host visits Monday through Friday and most Saturdays during the school year.",
    gradYearOptions: "2027\n2028\n2029\n2030\nI'm a transfer student\nI've already graduated",
    maxGuests: "4",
    submitLabel: "Request my visit",
    privacyNote: "We'll confirm your visit by email within one business day and never share your information.",
    imageUrl: "https://picsum.photos/seed/quad/800/520",
    imageAlt: "Students walking across a tree-lined campus quad toward a brick clock tower",
    sidebarHeading: "Where to go",
    details: [
      { label: "Meet us at", value: "Welcome Center, Founders Hall, first floor\n1200 College Avenue" },
      { label: "Parking", value: "Free visitor parking in Lot C off Elm Street. Show your confirmation email at the gate." },
      { label: "Accessibility", value: "Every tour route has an accessible option. Wheelchairs are available to borrow at the Welcome Center." },
    ],
    sidebarNote: "Need to reschedule? Reply to your confirmation email or call (502) 555-0190.",
  },
  render: ({
    id,
    eyebrow,
    heading,
    headingLevel,
    intro,
    formAction,
    visitTypes,
    times,
    dateHint,
    gradYearOptions,
    maxGuests,
    submitLabel,
    privacyNote,
    imageUrl,
    imageAlt,
    sidebarHeading,
    details,
    sidebarNote,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const uid = `cv-${id || "visit"}`;
    const types = (visitTypes ?? []).filter((t) => t?.name);
    const timeList = lines(times);
    const years = lines(gradYearOptions);
    const detailList = (details ?? []).filter((d) => d?.label || d?.value);
    const guestsMax = Number.parseInt((maxGuests || "").replace(/[^\d]/g, ""), 10);
    const hasSidebar = Boolean(imageUrl || sidebarHeading || detailList.length || sidebarNote);

    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-7xl">
          {eyebrow || heading || intro ? (
            <div className="mx-auto max-w-3xl text-center">
              {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-5xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H> : null}
              {intro ? <p className="mx-auto mt-5 max-w-2xl 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 ${hasSidebar ? "lg:grid-cols-12" : "mx-auto max-w-3xl"} ${eyebrow || heading || intro ? "mt-12 sm:mt-16" : ""}`}>
            <form action={formAction || undefined} method="post" className={hasSidebar ? "lg:col-span-8" : ""}>
              <p className="text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

              {types.length ? (
                <fieldset className="mt-6">
                  <legend className={legendClass}>Choose a visit</legend>
                  <div className={`mt-3 grid grid-cols-1 gap-3 ${types.length >= 3 ? "md:grid-cols-3" : types.length === 2 ? "sm:grid-cols-2" : ""}`}>
                    {types.map((t, i) => (
                      <label
                        key={`${t.name}-${i}`}
                        className="group relative flex min-h-11 cursor-pointer flex-col rounded-2xl bg-neutral-50 p-5 ring-1 ring-neutral-200 transition select-none ring-inset hover:ring-indigo-400 has-checked:bg-white has-checked:shadow-md 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"
                      >
                        <input type="radio" name="visit_type" value={t.name} required defaultChecked={i === 0} className="peer sr-only" />
                        {t.length ? <span className="text-xs font-semibold tracking-wider text-indigo-700 uppercase">{t.length}</span> : null}
                        <span className={`pr-7 text-lg leading-7 font-semibold text-neutral-950 ${t.length ? "mt-1" : ""}`}>{t.name}</span>
                        {t.description ? <span className="mt-2 text-sm leading-6 text-pretty text-neutral-600">{t.description}</span> : null}
                        <span aria-hidden="true" className="absolute top-5 right-5 flex size-5 items-center justify-center rounded-full ring-1 ring-neutral-400 peer-checked:bg-indigo-600 peer-checked:ring-indigo-600">
                          <span className="size-2 rounded-full bg-white" />
                        </span>
                      </label>
                    ))}
                  </div>
                </fieldset>
              ) : null}

              <div className="mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2">
                <div className={timeList.length ? "" : "sm:col-span-2"}>
                  <label htmlFor={`${uid}-date`} className={labelClass}>Date</label>
                  <input id={`${uid}-date`} name="visit_date" type="date" required aria-describedby={dateHint ? `${uid}-date-hint` : undefined} className={`mt-2 ${inputClass}`} />
                  {dateHint ? (
                    <p id={`${uid}-date-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                      {dateHint}
                    </p>
                  ) : null}
                </div>
                {timeList.length ? (
                  <fieldset>
                    <legend className="text-sm leading-6 font-medium text-neutral-900">Start time</legend>
                    <div className="mt-2 flex flex-wrap gap-2">
                      {timeList.map((t, i) => (
                        <label
                          key={`${t}-${i}`}
                          className="inline-flex min-h-11 cursor-pointer items-center rounded-full bg-white px-4 text-sm font-semibold text-neutral-800 ring-1 ring-neutral-300 transition select-none ring-inset hover:ring-indigo-400 has-checked:bg-indigo-600 has-checked:text-white has-checked:ring-indigo-600 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-indigo-600"
                        >
                          <input type="radio" name="visit_time" value={t} required className="sr-only" />
                          <span className="tabular-nums">{t}</span>
                        </label>
                      ))}
                    </div>
                  </fieldset>
                ) : null}
              </div>

              <fieldset className="mt-10 border-t border-neutral-200 pt-8">
                <legend className="text-base leading-7 font-semibold text-neutral-950">About you</legend>
                <div className="mt-4 grid grid-cols-1 gap-x-6 gap-y-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}>
                      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">
                      For a text reminder the day before.
                    </p>
                  </div>
                  <div>
                    <label htmlFor={`${uid}-school`} className={labelClass}>High school</label>
                    <input id={`${uid}-school`} name="high_school" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                  </div>
                  {years.length ? (
                    <div>
                      <label htmlFor={`${uid}-year`} className={labelClass}>Graduation year</label>
                      <select id={`${uid}-year`} name="grad_year" required defaultValue="" className={`mt-2 ${inputClass}`}>
                        <option value="" disabled>
                          Choose a year
                        </option>
                        {years.map((y, i) => (
                          <option key={`${y}-${i}`} value={y}>
                            {y}
                          </option>
                        ))}
                      </select>
                    </div>
                  ) : null}
                  <div>
                    <label htmlFor={`${uid}-major`} className={labelClass}>
                      Intended major <Optional />
                    </label>
                    <input id={`${uid}-major`} name="intended_major" type="text" autoComplete="off" placeholder="Undecided is fine" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-guests`} className={labelClass}>Guests coming with you</label>
                    <input
                      id={`${uid}-guests`}
                      name="guests"
                      type="number"
                      inputMode="numeric"
                      required
                      min={0}
                      max={Number.isFinite(guestsMax) && guestsMax > 0 ? guestsMax : undefined}
                      defaultValue={0}
                      aria-describedby={`${uid}-guests-hint`}
                      className={`mt-2 ${inputClass}`}
                    />
                    <p id={`${uid}-guests-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                      Not counting you{Number.isFinite(guestsMax) && guestsMax > 0 ? `. Up to ${guestsMax}.` : "."}
                    </p>
                  </div>
                  <div className="sm:col-span-2">
                    <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 an ASL interpreter, a shorter walking route, a golf-cart tour or a quiet space. Two weeks&rsquo; notice helps us arrange interpreters.
                    </p>
                  </div>
                  <div className="flex gap-3 sm:col-span-2">
                    <div className="flex h-11 shrink-0 items-center">
                      <input
                        id={`${uid}-consent`}
                        name="guardian_consent"
                        type="checkbox"
                        value="yes"
                        aria-describedby={`${uid}-consent-hint`}
                        className="size-5 rounded border-neutral-400 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                      />
                    </div>
                    <div className="flex min-h-11 flex-col justify-center text-sm leading-6">
                      <label htmlFor={`${uid}-consent`} className="cursor-pointer font-medium text-neutral-900">
                        A parent or guardian knows about this visit and agrees to it
                      </label>
                      <p id={`${uid}-consent-hint`} className="text-neutral-600">
                        Required for students under 18 visiting without an adult.
                      </p>
                    </div>
                  </div>
                </div>
              </fieldset>

              <div className="mt-10 flex flex-col gap-4 border-t border-neutral-200 pt-8 sm:flex-row sm:items-center sm:gap-6">
                <button
                  type="submit"
                  className="inline-flex min-h-12 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 || "Request my visit"}
                </button>
                {privacyNote ? <p className="text-sm leading-6 text-pretty text-neutral-600">{privacyNote}</p> : null}
              </div>
            </form>

            {hasSidebar ? (
              <aside aria-labelledby={sidebarHeading ? `${uid}-aside` : undefined} aria-label={sidebarHeading ? undefined : "Visit details"} className="lg:sticky lg:top-8 lg:col-span-4">
                <div className="overflow-hidden rounded-2xl bg-neutral-50 ring-1 ring-neutral-200">
                  {imageUrl ? <img src={imageUrl} alt={imageAlt || ""} className="aspect-video w-full object-cover" /> : null}
                  {sidebarHeading || detailList.length || sidebarNote ? (
                    <div className="p-6">
                      {sidebarHeading ? (
                        <Sub id={`${uid}-aside`} className="text-lg leading-7 font-semibold text-neutral-950">
                          {sidebarHeading}
                        </Sub>
                      ) : null}
                      {detailList.length ? (
                        <dl className={`space-y-5 ${sidebarHeading ? "mt-5" : ""}`}>
                          {detailList.map((d, i) => (
                            <div key={`${d.label}-${i}`}>
                              {d.label ? <dt className="text-xs font-semibold tracking-wider text-neutral-600 uppercase">{d.label}</dt> : null}
                              {d.value ? (
                                <dd className="mt-1 text-sm leading-6 text-neutral-800">
                                  {lines(d.value).map((l, j) => (
                                    <span key={j} className="block">
                                      {l}
                                    </span>
                                  ))}
                                </dd>
                              ) : null}
                            </div>
                          ))}
                        </dl>
                      ) : null}
                      {sidebarNote ? <p className="mt-6 border-t border-neutral-200 pt-5 text-sm leading-6 text-pretty text-neutral-600">{sidebarNote}</p> : null}
                    </div>
                  ) : null}
                </div>
              </aside>
            ) : null}
          </div>
        </div>
      </section>
    );
  },
};
```
