# Add the "Room Booking" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/room-booking) to this Pantheon Content Publisher (P1) Next.js project. Meeting and study rooms with capacity, equipment, accessibility and cost, a book link each, and rules in a toggle.

## Steps

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

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

/**
 * Room Booking — library meeting and study rooms as cards with branch, capacity, equipment,
 * accessibility and price, a book link per room and the booking rules in a native <details>.
 * Register: `RoomBookingBlock: roomBookingBlock` in puck.config.tsx.
 */

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

type Room = {
  name: string;
  branch: string;
  capacity: string;
  equipment: string;
  accessibility: string;
  price: string;
  imageUrl: string;
  imageAlt: string;
  bookLabel: string;
  bookHref: string;
};

export type RoomBookingProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  rooms: Room[];
  rulesSummary: string;
  rules: { rule: string }[];
  contact: string;
};

const childLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;
const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

export const roomBookingBlock: ComponentConfig<RoomBookingProps> = {
  label: "Room Booking",
  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" },
    rooms: {
      type: "array",
      label: "Rooms",
      min: 1,
      max: 12,
      getItemSummary: (item) => [item?.name, item?.branch].filter(Boolean).join(" · ") || "Room",
      defaultItemProps: { name: "New room", branch: "Main Library", capacity: "Up to 6 people", equipment: "Whiteboard", accessibility: "", price: "Free", imageUrl: "", imageAlt: "", bookLabel: "Book this room", bookHref: "" },
      arrayFields: {
        name: { type: "text", label: "Room name" },
        branch: { type: "text", label: "Branch" },
        capacity: { type: "text", label: "Capacity", metadata: { help: "Such as Up to 4 people, or 60 seated." } },
        equipment: { type: "textarea", label: "Equipment", metadata: { help: "One item per line." } },
        accessibility: { type: "text", label: "Accessibility", metadata: { help: "Such as Step-free entry, hearing loop. Leave blank to hide it." } },
        price: { type: "text", label: "Cost", metadata: { help: "Such as Free, or Free for nonprofits; $25/hour for businesses." } },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "Leave blank for no photo." } },
        imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the room for someone who can't see the photo." } },
        bookLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to use Book this room." } },
        bookHref: { type: "text", label: "Booking link", metadata: { help: "Leave blank to hide the button, such as for first-come rooms." } },
      },
    },
    rulesSummary: { type: "text", label: "Rules toggle text", metadata: { help: "The clickable line that opens the rules, such as Room booking rules." } },
    rules: {
      type: "array",
      label: "Booking rules",
      min: 0,
      max: 12,
      getItemSummary: (item) => item?.rule?.slice(0, 48) || "Rule",
      defaultItemProps: { rule: "New rule" },
      arrayFields: { rule: { type: "textarea", label: "Rule" } },
    },
    contact: { type: "text", label: "Contact line", metadata: { help: "Shown under the rules, such as Questions? Call (555) 555-0100. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Meeting and study rooms",
    headingLevel: "h2",
    intro: "Quiet rooms for studying, tutoring, interviews and telehealth, and bigger spaces for community meetings. Book up to two weeks ahead with your Cedar Valley library card.",
    rooms: [
      { name: "Study Room A", branch: "Main Library, 2nd floor", capacity: "Up to 4 people", equipment: "Wall-mounted screen with HDMI\nWhiteboard\nPower at the table", accessibility: "Elevator access, adjustable-height table", price: "Free", imageUrl: "https://picsum.photos/seed/studyroom/800/500", imageAlt: "A small study room with a round table, four chairs and a whiteboard", bookLabel: "Book Study Room A", bookHref: "/rooms/main-study-a" },
      { name: "Oak Community Room", branch: "Main Library, ground floor", capacity: "60 seated, 90 standing", equipment: "Projector and screen\nWireless microphone\nKitchenette\nTables and chairs for 60", accessibility: "Step-free entry, hearing loop, accessible restroom next door", price: "Free for nonprofits; $40/hour for private events", imageUrl: "https://picsum.photos/seed/communityroom/800/500", imageAlt: "A bright meeting room set with rows of chairs facing a projector screen", bookLabel: "Request the Oak Room", bookHref: "/rooms/main-oak" },
      { name: "Telehealth Pod", branch: "Riverside Branch", capacity: "1 person", equipment: "Laptop with webcam\nNoise-canceling headset\nPrivacy door", accessibility: "Step-free entry, wheelchair-height desk", price: "Free", imageUrl: "", imageAlt: "", bookLabel: "Book the pod", bookHref: "/rooms/riverside-telehealth" },
    ],
    rulesSummary: "Room booking rules",
    rules: [
      { rule: "Book up to 14 days ahead; one booking per cardholder per day, up to 2 hours for study rooms." },
      { rule: "Arrive within 15 minutes of your start time or the room is released to the next person." },
      { rule: "Community rooms are open to the public; meetings must be free to attend unless you've paid the private-event rate." },
      { rule: "Light snacks are fine. Leave the room as you found it, with tables wiped and chairs back in place." },
      { rule: "Booking a room doesn't mean the library endorses your group or event." },
    ],
    contact: "Questions about rooms? Call (555) 555-0108 or email rooms@cedarvalleylibrary.example.org.",
  },
  render: ({ id, heading, headingLevel, intro, rooms, rulesSummary, rules, contact }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (rooms ?? []).filter((r) => r?.name);
    const ruleList = (rules ?? []).filter((r) => r?.rule);
    const uid = `p1-room-booking-${id || "block"}`;

    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">
          {heading || intro ? (
            <div className="max-w-2xl">
              {heading ? <H className="font-serif 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}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3 ${heading || intro ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((r, i) => {
                const equipment = (r.equipment || "").split("\n").map((s) => s.trim()).filter(Boolean);
                const nameId = `${uid}-room-${i}`;
                return (
                  <li key={`${r.name}-${i}`}>
                    <article aria-labelledby={nameId} className="flex h-full flex-col overflow-hidden rounded-2xl bg-white shadow-sm ring-1 ring-neutral-200">
                      {r.imageUrl ? (
                        <img src={r.imageUrl} alt={r.imageAlt || ""} loading="lazy" className="aspect-16/10 w-full bg-neutral-100 object-cover" />
                      ) : (
                        <div aria-hidden="true" className="relative grid aspect-16/10 w-full place-items-center overflow-hidden bg-indigo-50">
                          <svg viewBox="0 0 120 80" fill="none" className="w-1/2 text-indigo-300">
                            <rect x="20" y="10" width="80" height="44" rx="4" stroke="currentColor" strokeWidth="2.5" />
                            <rect x="34" y="58" width="52" height="6" rx="3" fill="currentColor" />
                            <path d="M40 70h40" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" />
                            <circle cx="60" cy="32" r="8" stroke="currentColor" strokeWidth="2.5" />
                          </svg>
                        </div>
                      )}
                      <div className="flex flex-1 flex-col p-5 sm:p-6">
                        {r.branch ? <p className="text-sm font-medium text-indigo-700">{r.branch}</p> : null}
                        <Sub id={nameId} className="mt-1 text-xl font-semibold tracking-tight text-neutral-950">
                          {r.name}
                        </Sub>
                        <dl className="mt-4 grid grid-cols-1 gap-3 text-sm leading-6">
                          {r.capacity ? (
                            <div className="flex items-start gap-2.5">
                              <dt className="shrink-0">
                                <span className="sr-only">Capacity</span>
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 text-neutral-500">
                                  <path d="M7 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM14.5 9a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM1.615 16.428a1.224 1.224 0 0 1-.569-1.175 6.002 6.002 0 0 1 11.908 0c.058.467-.172.92-.57 1.174A9.953 9.953 0 0 1 7 18a9.953 9.953 0 0 1-5.385-1.572ZM14.5 16h-.106c.07-.297.088-.611.048-.933a7.47 7.47 0 0 0-1.588-3.755 4.502 4.502 0 0 1 5.874 2.636.818.818 0 0 1-.36.98A7.465 7.465 0 0 1 14.5 16Z" />
                                </svg>
                              </dt>
                              <dd className="font-semibold text-neutral-950">{r.capacity}</dd>
                            </div>
                          ) : null}
                          {equipment.length ? (
                            <div className="flex items-start gap-2.5">
                              <dt className="shrink-0">
                                <span className="sr-only">Equipment</span>
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 text-neutral-500">
                                  <path fillRule="evenodd" d="M2 4.25A2.25 2.25 0 0 1 4.25 2h11.5A2.25 2.25 0 0 1 18 4.25v8.5A2.25 2.25 0 0 1 15.75 15h-3.105a3.501 3.501 0 0 0 1.1 1.677A.75.75 0 0 1 13.26 18H6.74a.75.75 0 0 1-.484-1.323A3.501 3.501 0 0 0 7.355 15H4.25A2.25 2.25 0 0 1 2 12.75v-8.5Zm1.5 0a.75.75 0 0 1 .75-.75h11.5a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-.75.75H4.25a.75.75 0 0 1-.75-.75v-7.5Z" clipRule="evenodd" />
                                </svg>
                              </dt>
                              <dd className="min-w-0">
                                <ul role="list" className="space-y-0.5 text-neutral-700">
                                  {equipment.map((e, j) => (
                                    <li key={`${e}-${j}`}>{e}</li>
                                  ))}
                                </ul>
                              </dd>
                            </div>
                          ) : null}
                          {r.accessibility ? (
                            <div className="flex items-start gap-2.5">
                              <dt className="shrink-0">
                                <span className="sr-only">Accessibility</span>
                                <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor" className="mt-0.5 size-5 text-neutral-500">
                                  <circle cx="12" cy="4" r="2" />
                                  <path d="M19 9.5a1 1 0 0 0-1-1H6a1 1 0 0 0 0 2h4v2.6l-2.4 6.5a1 1 0 1 0 1.9.7L11.6 15h.8l2.1 5.3a1 1 0 1 0 1.9-.7L14 13.1v-2.6h4a1 1 0 0 0 1-1Z" />
                                </svg>
                              </dt>
                              <dd className="min-w-0 text-neutral-700">{r.accessibility}</dd>
                            </div>
                          ) : null}
                          {r.price ? (
                            <div className="flex items-start gap-2.5">
                              <dt className="shrink-0">
                                <span className="sr-only">Cost</span>
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 text-neutral-500">
                                  <path fillRule="evenodd" d="M5.5 3A2.5 2.5 0 0 0 3 5.5v2.879a2.5 2.5 0 0 0 .732 1.767l6.5 6.5a2.5 2.5 0 0 0 3.536 0l2.878-2.878a2.5 2.5 0 0 0 0-3.536l-6.5-6.5A2.5 2.5 0 0 0 8.38 3H5.5ZM6 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" clipRule="evenodd" />
                                </svg>
                              </dt>
                              <dd className="min-w-0 text-neutral-700">{r.price}</dd>
                            </div>
                          ) : null}
                        </dl>
                        {r.bookHref ? (
                          <div className="mt-auto pt-6">
                            <a
                              href={r.bookHref}
                              className={`inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-xl bg-indigo-600 px-5 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-500 sm:w-auto ${focusRing}`}
                            >
                              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4">
                                <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>
                              {r.bookLabel || "Book this room"}
                            </a>
                          </div>
                        ) : null}
                      </div>
                    </article>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {ruleList.length || contact ? (
            <div className="mt-10 max-w-3xl">
              {ruleList.length ? (
                <details className="group rounded-2xl bg-neutral-50 ring-1 ring-neutral-200">
                  <summary
                    className={`flex min-h-12 cursor-pointer list-none items-center justify-between gap-4 rounded-2xl px-5 py-3 text-base font-semibold text-neutral-950 hover:bg-neutral-100 [&::-webkit-details-marker]:hidden ${focusRing}`}
                  >
                    {rulesSummary || "Room booking rules"}
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-neutral-500 transition group-open:rotate-180">
                      <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>
                  </summary>
                  <ol className="list-decimal space-y-2 px-5 pt-1 pb-5 pl-10 text-sm leading-6 text-neutral-700 marker:font-semibold marker:text-indigo-700">
                    {ruleList.map((r, i) => (
                      <li key={i} className="pl-1 text-pretty">
                        {r.rule}
                      </li>
                    ))}
                  </ol>
                </details>
              ) : null}
              {contact ? <p className="mt-4 text-sm leading-6 text-neutral-600">{contact}</p> : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
