# Add the "Facility Rentals" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/facility-rentals) to this Pantheon Content Publisher (P1) Next.js project. Shelters and rooms for rent with photo, capacity, amenities, resident rates, hours, deposit, booking link and policies.

## Steps

1. Create `components/puck/facility-rentals-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 { facilityRentalsBlock } from "./components/puck/facility-rentals-block";`
3. Register it under `components` as `FacilityRentalsBlock: facilityRentalsBlock`.
4. Add `"FacilityRentalsBlock"` to the best-fitting entry in `categories` (this block's library category is "Parks & rec"). 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/facility-rentals-block.tsx`

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

/**
 * Facility Rentals — shelters, pavilions and rooms for rent, each with a photo, capacity,
 * amenities (icon plus label), resident and non-resident rates, rental hours, deposit and a
 * booking link, followed by the rental policies in a native disclosure.
 * Register: `FacilityRentalsBlock: facilityRentalsBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Amenity = "electricity" | "grill" | "restrooms" | "water" | "accessible" | "parking";

export type FacilityRentalsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  facilities: {
    name: string;
    location: string;
    imageUrl: string;
    imageAlt: string;
    capacity: string;
    amenities: { amenity: Amenity }[];
    residentRate: string;
    nonResidentRate: string;
    hours: string;
    deposit: string;
    bookHref: string;
  }[];
  bookLabel: string;
  policiesLabel: string;
  policies: string;
  contactText: string;
  contactPhone: string;
  contactEmail: string;
};

const childHeading = { 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-700";

const amenities: Record<Amenity, { label: string; path: string }> = {
  electricity: { label: "Electricity", path: "M13 2 4.5 13.5H11L10 22l8.5-11.5H12L13 2Z" },
  grill: { label: "Grills", path: "M3.5 10h17a8.5 8.5 0 0 1-17 0Zm4.5 8-2 4m12-4 2 4m-8-4v4M9 2.5c-.8 1.2.8 2.3 0 3.5m3-3.5c-.8 1.2.8 2.3 0 3.5m3-3.5c-.8 1.2.8 2.3 0 3.5" },
  restrooms: { label: "Restrooms", path: "M7 4.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm10 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM5 7h4l1 7H8.5v7h-3v-7H4l1-7Zm10 0h4l2 8h-2.5v6h-3v-6H13l2-8ZM12 3v18" },
  water: { label: "Drinking water", path: "M12 3c-3 4-5.5 7-5.5 10a5.5 5.5 0 0 0 11 0C17.5 10 15 7 12 3Zm-2.5 10.5a2.5 2.5 0 0 0 2.5 2.5" },
  accessible: { label: "ADA accessible", path: "M12 5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM9 8h6m-3 0v6h4l2 5M9.5 11.5a5 5 0 1 0 6 7" },
  parking: { label: "Parking", path: "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm4 14V7h4a3 3 0 0 1 0 6H9" },
};

const amenityOptions = (Object.keys(amenities) as Amenity[]).map((value) => ({ label: amenities[value].label, value }));

export const facilityRentalsBlock: ComponentConfig<FacilityRentalsProps> = {
  label: "Facility Rentals",
  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", metadata: { help: "Leave blank to hide it." } },
    facilities: {
      type: "array",
      label: "Facilities",
      min: 1,
      max: 18,
      getItemSummary: (item) => item?.name || "Facility",
      defaultItemProps: {
        name: "New facility",
        location: "",
        imageUrl: "",
        imageAlt: "",
        capacity: "",
        amenities: [],
        residentRate: "",
        nonResidentRate: "",
        hours: "",
        deposit: "",
        bookHref: "",
      },
      arrayFields: {
        name: { type: "text", label: "Facility name" },
        location: { type: "text", label: "Park or building", metadata: { help: "Where it is, like Willow Creek Park. Leave blank to hide it." } },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "A landscape photo works best. Leave blank for a plain card." } },
        imageAlt: { type: "text", label: "Image description", metadata: { help: "Describe what the photo shows for people who can't see it." } },
        capacity: { type: "text", label: "Capacity", metadata: { help: "Like 60 people, or 40 seated. Shown on the photo." } },
        amenities: {
          type: "array",
          label: "Amenities",
          max: 6,
          getItemSummary: (item) => amenities[item?.amenity]?.label || "Amenity",
          defaultItemProps: { amenity: "electricity" },
          arrayFields: {
            amenity: { type: "select", label: "Amenity", options: amenityOptions },
          },
        },
        residentRate: { type: "text", label: "Resident rate", metadata: { help: "Like $90 per day, or $35 per hour." } },
        nonResidentRate: { type: "text", label: "Non-resident rate", metadata: { help: "Leave blank if everyone pays the same." } },
        hours: { type: "text", label: "Rental hours", metadata: { help: "Like 8 a.m. to 9 p.m., April to October." } },
        deposit: { type: "text", label: "Deposit", metadata: { help: "Like $100, refundable. Leave blank if there's none." } },
        bookHref: { type: "text", label: "Booking link", metadata: { help: "Your reservation system's page for this facility. Leave blank to hide the button." } },
      },
    },
    bookLabel: { type: "text", label: "Booking button text", metadata: { help: "Used on every card. The facility name is added for screen readers." } },
    policiesLabel: { type: "text", label: "Policies heading", metadata: { help: "The label people click to open the policies. Leave blank to hide them." } },
    policies: { type: "textarea", label: "Rental policies", metadata: { help: "One policy per line. Each line becomes a list item." } },
    contactText: { type: "text", label: "Contact note", metadata: { help: "Like Questions about a rental? Leave blank to hide the contact line." } },
    contactPhone: { type: "text", label: "Phone", metadata: { help: "Shown as a tap-to-call link." } },
    contactEmail: { type: "text", label: "Email" },
  },
  defaultProps: {
    eyebrow: "Rentals",
    heading: "Reserve a shelter or room",
    headingLevel: "h2",
    intro: "Host a reunion, birthday or team picnic at one of our parks. Reservations open 12 months ahead for residents and 10 months ahead for everyone else.",
    facilities: [
      {
        name: "Willow Creek Pavilion",
        location: "Willow Creek Park",
        imageUrl: "https://picsum.photos/seed/pavilion/800/533",
        imageAlt: "A large open-air pavilion with picnic tables beside a creek",
        capacity: "120 people",
        amenities: [{ amenity: "electricity" }, { amenity: "grill" }, { amenity: "restrooms" }, { amenity: "water" }, { amenity: "accessible" }, { amenity: "parking" }],
        residentRate: "$140 per day",
        nonResidentRate: "$190 per day",
        hours: "8 a.m. to 9 p.m., April to October",
        deposit: "$100, refundable",
        bookHref: "/rentals/willow-creek-pavilion",
      },
      {
        name: "Oak Hollow Shelter",
        location: "Oak Hollow Park",
        imageUrl: "https://picsum.photos/seed/shelter/800/533",
        imageAlt: "A small wooden picnic shelter under tall oak trees",
        capacity: "40 people",
        amenities: [{ amenity: "grill" }, { amenity: "water" }, { amenity: "accessible" }, { amenity: "parking" }],
        residentRate: "$55 per day",
        nonResidentRate: "$75 per day",
        hours: "Dawn to dusk, year round",
        deposit: "",
        bookHref: "/rentals/oak-hollow-shelter",
      },
      {
        name: "Prairie Room",
        location: "Cedar Valley Community Center",
        imageUrl: "https://picsum.photos/seed/meetingroom/800/533",
        imageAlt: "A bright meeting room with round tables and tall windows",
        capacity: "60 seated",
        amenities: [{ amenity: "electricity" }, { amenity: "restrooms" }, { amenity: "accessible" }, { amenity: "parking" }],
        residentRate: "$35 per hour",
        nonResidentRate: "$50 per hour",
        hours: "9 a.m. to 10 p.m., 2-hour minimum",
        deposit: "$150, refundable",
        bookHref: "/rentals/prairie-room",
      },
    ],
    bookLabel: "Check availability & book",
    policiesLabel: "Rental policies",
    policies:
      "Residents must show a photo ID and proof of address when booking.\nPay the full rental fee when you book. Deposits are refunded within 14 days if the site is left clean and undamaged.\nCancel at least 14 days ahead for a full refund, minus a $15 processing fee.\nAlcohol needs a separate permit and proof of liability insurance.\nAmplified sound must end by 9 p.m. Bounce houses and tents need approval first.\nShelters that aren't reserved are first come, first served.",
    contactText: "Questions about a rental?",
    contactPhone: "(555) 555-0123",
    contactEmail: "rentals@cedarvalleyparks.example.org",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, facilities, bookLabel, policiesLabel, policies, contactText, contactPhone, contactEmail }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const baseId = id || "facility-rentals";
    const list = (facilities ?? []).filter((f) => f?.name);
    const rules = (policies ?? "")
      .split("\n")
      .map((p) => p.trim())
      .filter(Boolean);
    const hasHeader = Boolean(eyebrow || heading || intro);
    const hasContact = Boolean(contactText || contactPhone || contactEmail);
    const cta = bookLabel || "Check availability & book";
    return (
      <section aria-labelledby={heading ? `${baseId}-heading` : undefined} 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">
          {hasHeader ? (
            <div className="max-w-2xl">
              {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700">{eyebrow}</p> : null}
              {heading ? (
                <H id={`${baseId}-heading`} className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${eyebrow ? "mt-2" : ""}`}>
                  {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 xl:grid-cols-3 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((f, i) => {
                const items = (f.amenities ?? []).filter((a) => a?.amenity && amenities[a.amenity]);
                const details = [
                  { label: "Hours", value: f.hours },
                  { label: "Deposit", value: f.deposit },
                ].filter((d) => d.value);
                return (
                  <li key={`${f.name}-${i}`} className="flex flex-col overflow-hidden rounded-2xl bg-white shadow-sm ring-1 ring-neutral-950/5">
                    {f.imageUrl ? (
                      <div className="relative">
                        <img src={f.imageUrl} alt={f.imageAlt || ""} loading="lazy" className="aspect-3/2 w-full bg-neutral-100 object-cover" />
                        {f.capacity ? (
                          <p className="absolute bottom-3 left-3 inline-flex items-center gap-1.5 rounded-full bg-white/95 px-3 py-1 text-sm font-semibold text-neutral-950 shadow-sm ring-1 ring-neutral-950/5">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 text-indigo-700">
                              <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>
                            <span className="sr-only">Capacity: </span>
                            {f.capacity}
                          </p>
                        ) : null}
                      </div>
                    ) : null}

                    <div className={`flex flex-1 flex-col p-5 sm:p-6 ${f.imageUrl ? "" : "border-t-4 border-indigo-700"}`}>
                      {f.location ? <p className="text-sm font-medium text-neutral-600">{f.location}</p> : null}
                      <Sub className={`text-xl font-semibold tracking-tight text-pretty text-neutral-950 ${f.location ? "mt-1" : ""}`}>{f.name}</Sub>
                      {!f.imageUrl && f.capacity ? (
                        <p className="mt-2 text-sm font-semibold text-neutral-800">
                          <span className="font-normal text-neutral-600">Capacity: </span>
                          {f.capacity}
                        </p>
                      ) : null}

                      {items.length ? (
                        <div className="mt-4">
                          <p className="sr-only">Amenities</p>
                          <ul role="list" className="grid grid-cols-2 gap-x-4 gap-y-2">
                            {items.map((a, j) => (
                              <li key={j} className="flex items-center gap-2 text-sm leading-5 text-neutral-700">
                                <span aria-hidden="true" className="grid size-7 shrink-0 place-items-center rounded-full bg-indigo-50 text-indigo-700 ring-1 ring-indigo-600/15">
                                  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" className="size-4">
                                    <path d={amenities[a.amenity].path} />
                                  </svg>
                                </span>
                                {amenities[a.amenity].label}
                              </li>
                            ))}
                          </ul>
                        </div>
                      ) : null}

                      {f.residentRate || f.nonResidentRate ? (
                        <dl className="mt-5 grid grid-cols-2 gap-px overflow-hidden rounded-xl bg-neutral-200 ring-1 ring-neutral-200">
                          {f.residentRate ? (
                            <div className={`bg-neutral-50 px-3 py-2.5 ${f.nonResidentRate ? "" : "col-span-2"}`}>
                              <dt className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">{f.nonResidentRate ? "Resident" : "Rate"}</dt>
                              <dd className="mt-0.5 text-base font-semibold text-neutral-950 tabular-nums">{f.residentRate}</dd>
                            </div>
                          ) : null}
                          {f.nonResidentRate ? (
                            <div className={`bg-neutral-50 px-3 py-2.5 ${f.residentRate ? "" : "col-span-2"}`}>
                              <dt className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">Non-resident</dt>
                              <dd className="mt-0.5 text-base font-semibold text-neutral-700 tabular-nums">{f.nonResidentRate}</dd>
                            </div>
                          ) : null}
                        </dl>
                      ) : null}

                      {details.length ? (
                        <dl className="mt-4 space-y-1.5 text-sm leading-6">
                          {details.map((d) => (
                            <div key={d.label} className="flex gap-3">
                              <dt className="w-16 shrink-0 font-semibold text-neutral-950">{d.label}</dt>
                              <dd className="min-w-0 text-neutral-700">{d.value}</dd>
                            </div>
                          ))}
                        </dl>
                      ) : null}

                      {f.bookHref ? (
                        <div className="mt-auto pt-6">
                          <a
                            href={f.bookHref}
                            className={`group inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-indigo-700 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-600 ${focusRing}`}
                          >
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                              <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>
                            {cta}
                            <span className="sr-only">: {f.name}</span>
                          </a>
                        </div>
                      ) : null}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {(policiesLabel && rules.length) || hasContact ? (
            <div className="mt-10 grid grid-cols-1 gap-6 lg:grid-cols-3 lg:items-start">
              {policiesLabel && rules.length ? (
                <details className="group rounded-2xl bg-white ring-1 ring-neutral-200 open:shadow-sm lg:col-span-2">
                  <summary
                    className={`flex min-h-11 cursor-pointer list-none items-center justify-between gap-4 rounded-2xl px-5 py-4 text-base font-semibold text-neutral-950 sm:px-6 [&::-webkit-details-marker]:hidden ${focusRing}`}
                  >
                    <span className="inline-flex items-center gap-2.5">
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-700">
                        <path fillRule="evenodd" d="M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z" clipRule="evenodd" />
                      </svg>
                      {policiesLabel}
                    </span>
                    <span aria-hidden="true" className="grid size-8 shrink-0 place-items-center rounded-full bg-neutral-100 text-neutral-600 transition group-open:rotate-180 group-open:bg-indigo-700 group-open:text-white">
                      <svg viewBox="0 0 20 20" fill="currentColor" className="size-5">
                        <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>
                    </span>
                  </summary>
                  <ul role="list" className="space-y-3 border-t border-neutral-200 px-5 pt-5 pb-6 sm:px-6">
                    {rules.map((rule, j) => (
                      <li key={j} className="flex gap-3 text-sm leading-6 text-pretty text-neutral-700">
                        <span aria-hidden="true" className="mt-2.5 size-1.5 shrink-0 rounded-full bg-indigo-600" />
                        <span className="min-w-0">{rule}</span>
                      </li>
                    ))}
                  </ul>
                </details>
              ) : null}
              {hasContact ? (
                <aside aria-label="Rental contact" className={`rounded-2xl border border-dashed border-neutral-300 px-5 py-4 sm:px-6 ${policiesLabel && rules.length ? "" : "lg:col-span-3"}`}>
                  {contactText ? <p className="text-sm font-semibold text-neutral-950">{contactText}</p> : null}
                  {contactPhone || contactEmail ? (
                    <p className="flex flex-col text-sm font-semibold sm:flex-row sm:flex-wrap sm:gap-x-6 lg:flex-col">
                      {contactPhone ? (
                        <a href={`tel:${contactPhone.replace(/[^\d+]/g, "")}`} className={`inline-flex min-h-11 items-center self-start rounded text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                          {contactPhone}
                        </a>
                      ) : null}
                      {contactEmail ? (
                        <a href={`mailto:${contactEmail}`} className={`inline-flex min-h-11 items-center self-start rounded break-all text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                          {contactEmail}
                        </a>
                      ) : null}
                    </p>
                  ) : null}
                </aside>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
