# Add the "Office Locations" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/office-locations) to this Pantheon Content Publisher (P1) Next.js project. A card for each office with address, phone, email, hours, directions and accessibility notes.

## Steps

1. Create `components/puck/office-locations-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 { officeLocationsBlock } from "./components/puck/office-locations-block";`
3. Register it under `components` as `OfficeLocationsBlock: officeLocationsBlock`.
4. Add `"OfficeLocationsBlock"` to the best-fitting entry in `categories` (this block's library category is "Civic & utility"). 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/office-locations-block.tsx`

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

/**
 * Office Locations — a card per location with address, tap-to-call phone, email, hours,
 * directions and accessibility notes (parking, entrances, elevators).
 * Register: `OfficeLocationsBlock: officeLocationsBlock` in puck.config.tsx.
 */

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

export type OfficeLocationsProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  locations: {
    name: string;
    tag: string;
    address: string;
    phone: string;
    email: string;
    hours: string;
    directionsHref: string;
    accessibility: 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";
const rowLink = `inline-flex min-h-11 items-center rounded font-semibold text-neutral-950 underline decoration-neutral-300 underline-offset-4 hover:decoration-indigo-600 ${focusRing}`;

const icons = {
  pin: "m9.69 18.933.003.001C9.89 19.02 10 19 10 19s.11.02.308-.066l.002-.001.006-.003.018-.008a5.741 5.741 0 0 0 .281-.14c.186-.096.446-.24.757-.433.62-.384 1.445-.966 2.274-1.765C15.302 14.988 17 12.493 17 9A7 7 0 1 0 3 9c0 3.492 1.698 5.988 3.355 7.584a13.731 13.731 0 0 0 2.273 1.765 11.842 11.842 0 0 0 .976.544l.062.029.018.008.006.003ZM10 11.25a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Z",
  phone:
    "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",
  email:
    "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-2H3ZM19 8.839l-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",
  clock: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z",
};

function Row({ icon, label, children }: { icon: string; label: string; children: React.ReactNode }) {
  return (
    <div className="flex gap-3">
      <dt className="pt-3">
        <span className="sr-only">{label}</span>
        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 text-indigo-600">
          <path fillRule="evenodd" d={icon} clipRule="evenodd" />
        </svg>
      </dt>
      <dd className="min-w-0 flex-1 text-sm leading-6 text-neutral-700">{children}</dd>
    </div>
  );
}

export const officeLocationsBlock: ComponentConfig<OfficeLocationsProps> = {
  label: "Office Locations",
  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" },
    locations: {
      type: "array",
      label: "Locations",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.name || "Location",
      defaultItemProps: { name: "New location", tag: "", address: "", phone: "", email: "", hours: "", directionsHref: "", accessibility: "" },
      arrayFields: {
        name: { type: "text", label: "Name" },
        tag: { type: "text", label: "Tag", metadata: { help: "Optional short label, like Main office or Walk-in services." } },
        address: { type: "textarea", label: "Address", metadata: { help: "One line per row, exactly as it should appear." } },
        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" },
        hours: { type: "textarea", label: "Hours", metadata: { help: "One line per row, like Mon – Fri: 8 a.m. – 5 p.m." } },
        directionsHref: { type: "text", label: "Directions link", metadata: { help: "A Google Maps or Apple Maps share URL. Leave blank to hide it." } },
        accessibility: {
          type: "textarea",
          label: "Accessibility notes",
          metadata: { help: "Accessible parking, step-free entrances, elevators, hearing loops. Leave blank to hide." },
        },
      },
    },
  },
  defaultProps: {
    heading: "Office locations",
    headingLevel: "h2",
    intro: "Visit any office to register for programs, pay fees or request a permit. Bring a photo ID for account changes.",
    locations: [
      {
        name: "City Hall Annex",
        tag: "Main office",
        address: "500 Water Street, Suite 200\nRiverbend, OH 45202",
        phone: "(513) 555-0187",
        email: "parks@riverbend.gov",
        hours: "Mon – Fri: 8 a.m. – 5 p.m.\nSat – Sun: Closed",
        directionsHref: "https://maps.google.com/?q=500+Water+Street+Riverbend+OH",
        accessibility: "Step-free entrance on Water Street. Elevator to Suite 200. Two accessible spaces in the front lot.",
      },
      {
        name: "Eastside Community Center",
        tag: "Walk-in services",
        address: "2130 Linden Avenue\nRiverbend, OH 45206",
        phone: "(513) 555-0214",
        email: "eastside@riverbend.gov",
        hours: "Mon – Thu: 9 a.m. – 8 p.m.\nFri – Sat: 9 a.m. – 4 p.m.",
        directionsHref: "https://maps.google.com/?q=2130+Linden+Avenue+Riverbend+OH",
        accessibility: "Automatic doors at the main entrance. Hearing loop at the front desk. Accessible restrooms on both floors.",
      },
      {
        name: "Greenway Nature Center",
        tag: "Seasonal",
        address: "88 Bluff Road\nRiverbend, OH 45230",
        phone: "(513) 555-0350",
        email: "",
        hours: "Apr – Oct: Wed – Sun, 10 a.m. – 4 p.m.",
        directionsHref: "https://maps.google.com/?q=88+Bluff+Road+Riverbend+OH",
        accessibility: "Paved path from parking to the entrance. All-terrain wheelchair available to borrow; call ahead to reserve.",
      },
    ],
  },
  render: ({ heading, headingLevel, intro, locations }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (locations ?? []).filter((l) => l?.name);

    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="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
              {intro ? <p className="mt-4 text-base leading-7 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((loc, i) => {
                const lines = (loc.address || "").split("\n").map((l) => l.trim()).filter(Boolean);
                const hours = (loc.hours || "").split("\n").map((l) => l.trim()).filter(Boolean);
                const tel = (loc.phone || "").replace(/[^\d+]/g, "");
                const mail = (loc.email || "").trim();
                return (
                  <li key={`${loc.name}-${i}`}>
                    <article className="flex h-full flex-col rounded-2xl bg-white p-6 shadow-sm ring-1 ring-neutral-200 sm:p-8">
                      {loc.tag ? <p className="text-xs font-semibold tracking-widest text-indigo-700 uppercase">{loc.tag}</p> : null}
                      <Sub className={`text-xl font-semibold tracking-tight text-neutral-950 ${loc.tag ? "mt-2" : ""}`}>{loc.name}</Sub>
                      <dl className="mt-5 space-y-1">
                        {lines.length ? (
                          <Row icon={icons.pin} label="Address">
                            <address className="py-2.5 not-italic">
                              {lines.map((line, j) => (
                                <span key={j} className="block">
                                  {line}
                                </span>
                              ))}
                            </address>
                          </Row>
                        ) : null}
                        {tel ? (
                          <Row icon={icons.phone} label="Phone">
                            <a href={`tel:${tel}`} className={`${rowLink} tabular-nums`}>
                              {loc.phone}
                            </a>
                          </Row>
                        ) : null}
                        {mail ? (
                          <Row icon={icons.email} label="Email">
                            <a href={`mailto:${mail}`} className={`${rowLink} break-all`}>
                              {mail}
                            </a>
                          </Row>
                        ) : null}
                        {hours.length ? (
                          <Row icon={icons.clock} label="Hours">
                            <p className="py-2.5 tabular-nums">
                              {hours.map((h, j) => (
                                <span key={j} className="block">
                                  {h}
                                </span>
                              ))}
                            </p>
                          </Row>
                        ) : null}
                      </dl>
                      {loc.accessibility ? (
                        <div className="mt-5 flex gap-3 rounded-xl bg-neutral-50 p-4 ring-1 ring-neutral-200 ring-inset">
                          <svg aria-hidden="true" viewBox="0 0 24 24" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-700">
                            <circle cx="12" cy="4" r="2" />
                            <path d="M19 9.5a1 1 0 0 0-1-1H6a1 1 0 1 0 0 2h4v3.2l-2.4 6.4a1 1 0 1 0 1.9.7L11.6 15h.8l2.1 5.8a1 1 0 0 0 1.9-.7L14 13.7v-3.2h4a1 1 0 0 0 1-1Z" />
                          </svg>
                          <p className="text-sm leading-6 text-neutral-700">
                            <span className="font-semibold text-neutral-950">Accessibility: </span>
                            {loc.accessibility}
                          </p>
                        </div>
                      ) : null}
                      {loc.directionsHref ? (
                        <div className="mt-auto pt-6">
                          <a
                            href={loc.directionsHref}
                            className={`group inline-flex min-h-11 items-center gap-2 rounded-lg text-sm font-semibold text-indigo-700 hover:text-indigo-900 ${focusRing}`}
                          >
                            Get directions
                            <span className="sr-only"> to {loc.name}</span>
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition group-hover:translate-x-0.5">
                              <path fillRule="evenodd" d="M3 10a.75.75 0 0 1 .75-.75h10.64l-3.22-3.22a.75.75 0 1 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.75A.75.75 0 0 1 3 10Z" clipRule="evenodd" />
                            </svg>
                          </a>
                        </div>
                      ) : null}
                    </article>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
