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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/visit-campus) to this Pantheon Content Publisher (P1) Next.js project. Photo cards for each tour or visit option with length, schedule and booking, plus admissions contact.

## Steps

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

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

/**
 * Visit Campus — tour and visit options as photo cards, each with length, schedule and a
 * booking link, plus an admissions contact line. Phone and email links are built for you.
 * Register: `VisitCampusBlock: visitCampusBlock` in puck.config.tsx.
 */

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

type Visit = {
  imageUrl: string;
  imageAlt: string;
  type: string;
  duration: string;
  description: string;
  schedule: string;
  ctaLabel: string;
  ctaHref: string;
};

export type VisitCampusProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  visits: Visit[];
  contactText: string;
  phone: string;
  email: string;
};

const childHeading = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;

const textLink =
  "inline-flex min-h-11 items-center rounded font-semibold text-neutral-950 underline decoration-neutral-300 underline-offset-4 hover:decoration-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

export const visitCampusBlock: ComponentConfig<VisitCampusProps> = {
  label: "Visit Campus",
  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" },
    visits: {
      type: "array",
      label: "Visit options",
      min: 1,
      max: 6,
      getItemSummary: (item) => item?.type || "Visit option",
      defaultItemProps: {
        imageUrl: "https://picsum.photos/seed/campusvisit/800/600",
        imageAlt: "",
        type: "New visit option",
        duration: "1 hour",
        description: "",
        schedule: "",
        ctaLabel: "Register",
        ctaHref: "/visit",
      },
      arrayFields: {
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "Landscape photos work best. Leave blank to hide the image." } },
        imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for screen reader users. Leave blank only if it's purely decorative." } },
        type: { type: "text", label: "Visit type", metadata: { help: "Such as In-person tour or Virtual information session." } },
        duration: { type: "text", label: "Length", metadata: { help: "Shown on the photo, such as 90 minutes or Half day. Leave blank to hide it." } },
        description: { type: "textarea", label: "Description" },
        schedule: { type: "textarea", label: "When", metadata: { help: "Days and times this option runs. Leave blank to hide it." } },
        ctaLabel: { type: "text", label: "Button text" },
        ctaHref: { type: "text", label: "Button link", metadata: { help: "A path (/visit/tour), full URL, #anchor, mailto: or tel:." } },
      },
    },
    contactText: { type: "textarea", label: "Contact line", metadata: { help: "Shown under the cards beside the phone and email. Leave all three blank to hide it." } },
    phone: { type: "text", label: "Phone", metadata: { help: "Shown as typed. The tap-to-call link is built from the digits." } },
    email: { type: "text", label: "Email" },
  },
  defaultProps: {
    heading: "Come see Northfield for yourself",
    headingLevel: "h2",
    intro: "The best way to know if a campus feels like home is to walk it. Pick the visit that fits your schedule; every option is free.",
    visits: [
      {
        imageUrl: "https://picsum.photos/seed/campustour/800/600",
        imageAlt: "A student guide leading a small group past brick academic buildings on a sunny afternoon",
        type: "In-person campus tour",
        duration: "90 minutes",
        description: "Walk the quad, step inside a residence hall and see the new Hollis Science Center with a current student as your guide.",
        schedule: "Weekdays at 10 a.m. and 2 p.m.\nSelect Saturdays at 11 a.m.",
        ctaLabel: "Reserve a tour",
        ctaHref: "/visit/tour",
      },
      {
        imageUrl: "https://picsum.photos/seed/lecturehall/800/600",
        imageAlt: "Prospective students and parents seated in a sloped lecture hall listening to a professor",
        type: "Admitted Student Day",
        duration: "Half day",
        description: "Meet faculty in your intended major, sit in on a sample class and finish with lunch in Founders Dining Hall.",
        schedule: "Saturday, March 13, 2027\nSaturday, April 10, 2027",
        ctaLabel: "Save your spot",
        ctaHref: "/visit/admitted-student-day",
      },
      {
        imageUrl: "https://picsum.photos/seed/laptopstudy/800/600",
        imageAlt: "A student at a kitchen table watching a live video tour on a laptop",
        type: "Live virtual tour",
        duration: "30 minutes",
        description: "Explore campus from anywhere on a live, student-led video tour, with time at the end for your questions.",
        schedule: "Tuesdays and Thursdays at 7 p.m. Central",
        ctaLabel: "Join a virtual tour",
        ctaHref: "/visit/virtual",
      },
    ],
    contactText: "Need a different day, an accessible route or a visit for a group? Our visit team can help.",
    phone: "(555) 014-2200",
    email: "visit@northfield.example.edu",
  },
  render: ({ heading, headingLevel, intro, visits, contactText, phone, email }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (visits ?? []).filter((v) => v?.type || v?.description);
    const tel = (phone || "").replace(/[^\d+]/g, "");
    const hasContact = Boolean(contactText || phone || email);

    return (
      <section className="bg-neutral-50 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-7xl">
          {heading || intro ? (
            <div className="max-w-2xl">
              {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl lg:text-5xl">{heading}</H> : null}
              {intro ? <p className="mt-5 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid gap-6 sm:grid-cols-2 lg:grid-cols-3 lg:gap-8 ${heading || intro ? "mt-12 sm:mt-14" : ""}`}>
              {list.map((visit, i) => {
                const schedule = (visit.schedule || "")
                  .split("\n")
                  .map((s) => s.trim())
                  .filter(Boolean);
                return (
                  <li key={`${visit.type}-${i}`} className="flex flex-col overflow-hidden rounded-2xl bg-white shadow-sm ring-1 ring-neutral-200">
                    {visit.imageUrl || visit.duration ? (
                      <div className="relative">
                        {visit.imageUrl ? (
                          <img src={visit.imageUrl} alt={visit.imageAlt || ""} className="aspect-3/2 w-full bg-neutral-100 object-cover" />
                        ) : (
                          <div aria-hidden="true" className="h-14 bg-neutral-100" />
                        )}
                        {visit.duration ? (
                          <p className="absolute top-4 left-4 inline-flex items-center gap-1.5 rounded-full bg-white px-3 py-1 text-xs font-semibold text-neutral-900 shadow-sm ring-1 ring-neutral-900/5">
                            <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-3.5 text-indigo-600">
                              <path fillRule="evenodd" d="M1 8a7 7 0 1 1 14 0A7 7 0 0 1 1 8Zm7.75-4.25a.75.75 0 0 0-1.5 0V8c0 .414.336.75.75.75h3.25a.75.75 0 0 0 0-1.5h-2.5v-3.5Z" clipRule="evenodd" />
                            </svg>
                            <span className="sr-only">Length: </span>
                            {visit.duration}
                          </p>
                        ) : null}
                      </div>
                    ) : null}
                    <div className="flex flex-1 flex-col p-6 sm:p-7">
                      {visit.type ? <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{visit.type}</Sub> : null}
                      {visit.description ? <p className="mt-3 text-base leading-7 text-pretty text-neutral-600">{visit.description}</p> : null}
                      {schedule.length ? (
                        <div className="mt-5 flex gap-3 rounded-xl bg-neutral-50 p-4 ring-1 ring-neutral-200/70">
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-600">
                            <path fillRule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clipRule="evenodd" />
                          </svg>
                          <div className="min-w-0 text-sm leading-6">
                            <p className="font-semibold text-neutral-950">When</p>
                            {schedule.map((line, j) => (
                              <p key={j} className="text-neutral-700">
                                {line}
                              </p>
                            ))}
                          </div>
                        </div>
                      ) : null}
                      {visit.ctaLabel ? (
                        <div className="mt-auto pt-6">
                          <a
                            href={visit.ctaHref || "#"}
                            className="flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-indigo-600 px-5 py-3 text-center text-base font-semibold text-white shadow-sm transition hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                          >
                            {visit.ctaLabel}
                            {visit.type ? <span className="sr-only">: {visit.type}</span> : null}
                          </a>
                        </div>
                      ) : null}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {hasContact ? (
            <div className="mt-10 flex flex-col gap-4 rounded-2xl bg-white p-6 ring-1 ring-neutral-200 sm:mt-12 sm:p-8 lg:flex-row lg:items-center lg:justify-between lg:gap-10">
              {contactText ? <p className="max-w-xl text-base leading-7 text-pretty text-neutral-700">{contactText}</p> : null}
              {tel || email ? (
                <div className="flex flex-col gap-1 sm:flex-row sm:flex-wrap sm:items-center sm:gap-x-8">
                  {tel ? (
                    <a href={`tel:${tel}`} className={`${textLink} gap-2 tabular-nums`}>
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-600">
                        <path fillRule="evenodd" d="M2 3.5A1.5 1.5 0 0 1 3.5 2h1.148a1.5 1.5 0 0 1 1.465 1.175l.513 2.31a1.5 1.5 0 0 1-1.02 1.745l-1.051.35a.5.5 0 0 0-.31.637 10.48 10.48 0 0 0 6.548 6.548.5.5 0 0 0 .637-.31l.35-1.05a1.5 1.5 0 0 1 1.745-1.021l2.31.513A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15C7.82 18 2 12.18 2 5V3.5Z" clipRule="evenodd" />
                      </svg>
                      {phone}
                    </a>
                  ) : null}
                  {email ? (
                    <a href={`mailto:${email.trim()}`} className={`${textLink} min-w-0 gap-2 break-all`}>
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-600">
                        <path d="M3 4a2 2 0 0 0-2 2v1.161l8.441 4.221a1.25 1.25 0 0 0 1.118 0L19 7.162V6a2 2 0 0 0-2-2H3Z" />
                        <path d="m19 8.839-7.77 3.885a2.75 2.75 0 0 1-2.46 0L1 8.839V14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.839Z" />
                      </svg>
                      {email}
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
