# Add the "Find a Clinic" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/find-a-clinic) to this Pantheon Content Publisher (P1) Next.js project. Clinic cards with services, address, phone, hours, walk-in status, languages, accessibility notes and directions.

## Steps

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

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

/**
 * Find a Clinic — a card per clinic with services offered, address, tap-to-call phone, today's
 * hours, walk-in status, languages spoken, accessibility notes and a directions link.
 * Register: `FindAClinicBlock: findAClinicBlock` in puck.config.tsx.
 */

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

export type FindAClinicProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  clinics: {
    name: string;
    services: string;
    address: string;
    phone: string;
    hoursToday: string;
    walkIns: "yes" | "no";
    walkInNote: string;
    languages: string;
    accessibility: string;
    directionsHref: string;
    detailsHref: string;
  }[];
  helpText: string;
  helpPhone: 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 splitList = (s: string) => (s || "").split(/[,\n]/).map((x) => x.trim()).filter(Boolean);
const telHref = (p: string) => `tel:${(p || "").replace(/[^\d+]/g, "")}`;

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",
  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",
  language:
    "M7.75 2.75a.75.75 0 0 0-1.5 0v1.258a32.987 32.987 0 0 0-3.599.278.75.75 0 1 0 .198 1.487A31.545 31.545 0 0 1 8.7 5.545 19.381 19.381 0 0 1 7 9.56a19.418 19.418 0 0 1-1.002-2.05.75.75 0 0 0-1.384.577 20.935 20.935 0 0 0 1.492 2.91 19.613 19.613 0 0 1-3.828 4.154.75.75 0 1 0 .945 1.164A21.116 21.116 0 0 0 7 12.331c.095.132.192.262.29.391a.75.75 0 0 0 1.194-.91c-.204-.266-.4-.538-.59-.815a20.888 20.888 0 0 0 2.333-5.332c.31.031.618.068.924.108a.75.75 0 0 0 .198-1.487 32.832 32.832 0 0 0-3.599-.278V2.75ZM13 8a.75.75 0 0 1 .671.415l4.25 8.5a.75.75 0 1 1-1.342.67L15.787 16h-5.573l-.793 1.585a.75.75 0 1 1-1.342-.67l4.25-8.5A.75.75 0 0 1 13 8Zm2.037 6.5L13 10.427 10.964 14.5h4.073Z",
  check: "M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",
  calendar:
    "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",
  arrow:
    "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",
};

function Row({ icon, label, children }: { icon: string; label: string; children: React.ReactNode }) {
  return (
    <div className="flex gap-3">
      <dt className="shrink-0 pt-0.5">
        <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 findAClinicBlock: ComponentConfig<FindAClinicProps> = {
  label: "Find a Clinic",
  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. Clinic names use the next level down." },
    },
    intro: { type: "textarea", label: "Intro" },
    clinics: {
      type: "array",
      label: "Clinics",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.name || "Clinic",
      defaultItemProps: {
        name: "New clinic",
        services: "",
        address: "",
        phone: "",
        hoursToday: "",
        walkIns: "no",
        walkInNote: "",
        languages: "",
        accessibility: "",
        directionsHref: "",
        detailsHref: "",
      },
      arrayFields: {
        name: { type: "text", label: "Clinic name" },
        services: { type: "textarea", label: "Services", metadata: { help: "Separate with commas, like Primary care, Dental, Pharmacy. Each one shows as a tag." } },
        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." } },
        hoursToday: { type: "text", label: "Hours", metadata: { help: "A short summary, like Mon – Fri 8 a.m. – 7 p.m., Sat 9 a.m. – 1 p.m. Leave blank to hide." } },
        walkIns: {
          type: "radio",
          label: "Walk-ins",
          options: [
            { label: "Walk-ins welcome", value: "yes" },
            { label: "Appointment needed", value: "no" },
          ],
        },
        walkInNote: { type: "text", label: "Walk-in note", metadata: { help: "Optional, like Arrive by 3 p.m. for same-day visits." } },
        languages: { type: "text", label: "Languages spoken", metadata: { help: "Separate with commas. Leave blank to hide." } },
        accessibility: { type: "textarea", label: "Accessibility notes", metadata: { help: "Parking, step-free entrances, elevators, hearing loops. Leave blank to hide." } },
        directionsHref: { type: "text", label: "Directions link", metadata: { help: "A Google Maps or Apple Maps link. Leave blank to hide." } },
        detailsHref: { type: "text", label: "Clinic page link", metadata: { help: "Optional. Makes the clinic name a link." } },
      },
    },
    helpText: { type: "text", label: "Help line text", metadata: { help: "Shown under the clinics, like Not sure which clinic is right for you? Leave blank to hide." } },
    helpPhone: { type: "text", label: "Help line phone" },
  },
  defaultProps: {
    heading: "Find a clinic near you",
    headingLevel: "h2",
    intro: "We have four clinics in Lakeshore County. Everyone is welcome, with or without insurance. Pick the one that is closest or has the services you need.",
    clinics: [
      {
        name: "Harbor Street Health Center",
        services: "Primary care, Pediatrics, Dental, Pharmacy, Lab",
        address: "410 Harbor Street\nLakeshore, MI 49001",
        phone: "(555) 010-2200",
        hoursToday: "Mon – Fri 7:30 a.m. – 7 p.m. · Sat 9 a.m. – 1 p.m.",
        walkIns: "yes",
        walkInNote: "Check in by 5 p.m. for same-day visits.",
        languages: "English, Spanish, Arabic",
        accessibility: "Step-free entrance and four accessible parking spaces by the front door. Elevator to the dental floor.",
        directionsHref: "https://maps.google.com/?q=410+Harbor+Street+Lakeshore+MI",
        detailsHref: "/clinics/harbor-street",
      },
      {
        name: "Northside Family Clinic",
        services: "Primary care, Prenatal care, Behavioral health",
        address: "2215 Birch Avenue\nLakeshore, MI 49003",
        phone: "(555) 010-2250",
        hoursToday: "Mon – Thu 8 a.m. – 6 p.m. · Fri 8 a.m. – 4 p.m.",
        walkIns: "no",
        walkInNote: "Same-week visits are usually open. Call to book.",
        languages: "English, Spanish, Hmong",
        accessibility: "Automatic doors. Hearing loop at the front desk. All exam rooms on one floor.",
        directionsHref: "https://maps.google.com/?q=2215+Birch+Avenue+Lakeshore+MI",
        detailsHref: "/clinics/northside",
      },
      {
        name: "Dunes Road Community Clinic",
        services: "Primary care, Vaccines, WIC, Lab",
        address: "88 Dunes Road\nPine Hollow, MI 49010",
        phone: "(555) 010-2290",
        hoursToday: "Tue – Sat 9 a.m. – 5 p.m.",
        walkIns: "yes",
        walkInNote: "",
        languages: "English, Spanish",
        accessibility: "Paved path from the parking lot. Accessible restroom. Free wheelchair at the entrance.",
        directionsHref: "https://maps.google.com/?q=88+Dunes+Road+Pine+Hollow+MI",
        detailsHref: "",
      },
    ],
    helpText: "Not sure which clinic is right for you? Call us and we'll help you choose.",
    helpPhone: "(555) 010-2000",
  },
  render: ({ heading, headingLevel, intro, clinics, helpText, helpPhone }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (clinics ?? []).filter((c) => c?.name);
    const hasHeader = Boolean(heading || intro);

    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">
          {hasHeader ? (
            <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-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 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((c, i) => {
                const services = splitList(c.services);
                const lines = (c.address || "").split("\n").map((l) => l.trim()).filter(Boolean);
                const languages = splitList(c.languages);
                const walkIn = c.walkIns === "yes";
                return (
                  <li key={`${c.name}-${i}`}>
                    <article className="flex h-full flex-col rounded-2xl bg-white p-6 shadow-xs ring-1 ring-neutral-950/5 sm:p-7">
                      <Sub className="text-xl font-semibold tracking-tight text-balance text-neutral-950">
                        {c.detailsHref ? (
                          <a href={c.detailsHref} className={`rounded underline decoration-neutral-300 decoration-1 underline-offset-4 hover:decoration-indigo-600 ${focusRing}`}>
                            {c.name}
                          </a>
                        ) : (
                          c.name
                        )}
                      </Sub>

                      <p
                        className={`mt-3 inline-flex items-start gap-2 self-start rounded-lg px-3 py-1.5 text-sm leading-6 font-semibold ${
                          walkIn ? "bg-indigo-50 text-indigo-800 ring-1 ring-indigo-600/20 ring-inset" : "bg-neutral-100 text-neutral-800 ring-1 ring-neutral-950/10 ring-inset"
                        }`}
                      >
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0">
                          <path fillRule="evenodd" d={walkIn ? icons.check : icons.calendar} clipRule="evenodd" />
                        </svg>
                        {walkIn ? "Walk-ins welcome" : "Appointment needed"}
                      </p>
                      {c.walkInNote ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-600">{c.walkInNote}</p> : null}

                      {services.length ? (
                        <div className="mt-5">
                          <p className="text-xs font-semibold tracking-wider text-neutral-600 uppercase">Services</p>
                          <ul role="list" className="mt-2 flex flex-wrap gap-1.5">
                            {services.map((s, j) => (
                              <li key={`${s}-${j}`} className="rounded-md bg-neutral-100 px-2 py-1 text-xs font-medium text-neutral-800">
                                {s}
                              </li>
                            ))}
                          </ul>
                        </div>
                      ) : null}

                      <dl className="mt-6 space-y-3 border-t border-neutral-200 pt-6">
                        {lines.length ? (
                          <Row icon={icons.pin} label="Address">
                            <address className="not-italic">
                              {lines.map((line, j) => (
                                <span key={j} className="block">
                                  {line}
                                </span>
                              ))}
                            </address>
                          </Row>
                        ) : null}
                        {c.phone ? (
                          <Row icon={icons.phone} label="Phone">
                            <a href={telHref(c.phone)} className={`-my-2.5 inline-flex min-h-11 items-center rounded font-semibold text-neutral-950 tabular-nums underline decoration-neutral-300 underline-offset-4 hover:decoration-indigo-600 ${focusRing}`}>
                              {c.phone}
                            </a>
                          </Row>
                        ) : null}
                        {c.hoursToday ? (
                          <Row icon={icons.clock} label="Hours">
                            <span className="tabular-nums">{c.hoursToday}</span>
                          </Row>
                        ) : null}
                        {languages.length ? (
                          <Row icon={icons.language} label="Languages spoken">
                            {languages.join(", ")}
                          </Row>
                        ) : null}
                      </dl>

                      {c.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="min-w-0 text-sm leading-6 text-pretty text-neutral-700">
                            <span className="font-semibold text-neutral-950">Accessibility: </span>
                            {c.accessibility}
                          </p>
                        </div>
                      ) : null}

                      {c.directionsHref ? (
                        <div className="mt-auto pt-6">
                          <a
                            href={c.directionsHref}
                            className={`group inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-indigo-700 ring-1 ring-indigo-200 ring-inset transition hover:bg-indigo-50 ${focusRing}`}
                          >
                            Get directions
                            <span className="sr-only"> to {c.name}</span>
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition motion-safe:group-hover:translate-x-0.5">
                              <path fillRule="evenodd" d={icons.arrow} clipRule="evenodd" />
                            </svg>
                          </a>
                        </div>
                      ) : null}
                    </article>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {helpText || helpPhone ? (
            <div className="mt-10 flex flex-col gap-3 rounded-2xl bg-white p-6 ring-1 ring-neutral-950/5 sm:flex-row sm:items-center sm:justify-between sm:px-8">
              {helpText ? <p className="text-base leading-7 font-medium text-pretty text-neutral-900">{helpText}</p> : null}
              {helpPhone ? (
                <a
                  href={telHref(helpPhone)}
                  className={`inline-flex min-h-11 shrink-0 items-center justify-center gap-2 rounded-lg bg-indigo-600 px-5 py-2.5 text-base font-semibold text-white tabular-nums shadow-xs transition hover:bg-indigo-500 ${focusRing}`}
                >
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                    <path fillRule="evenodd" d={icons.phone} clipRule="evenodd" />
                  </svg>
                  Call {helpPhone}
                </a>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
