# Add the "Vaccine Clinics" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/vaccine-clinics) to this Pantheon Content Publisher (P1) Next.js project. Upcoming vaccine clinics with date tiles, time, place, vaccines, ages, cost, walk-in status and booking.

## Steps

1. Create `components/puck/vaccine-clinics-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 { vaccineClinicsBlock } from "./components/puck/vaccine-clinics-block";`
3. Register it under `components` as `VaccineClinicsBlock: vaccineClinicsBlock`.
4. Add `"VaccineClinicsBlock"` 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/vaccine-clinics-block.tsx`

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

/**
 * Vaccine Clinics — upcoming immunization clinics with a date tile, time, place, vaccines
 * offered, ages, cost, walk-in or appointment status and a booking link.
 * Register: `VaccineClinicsBlock: vaccineClinicsBlock` in puck.config.tsx.
 */

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

export type VaccineClinicsProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  costNote: string;
  bringNote: string;
  clinics: {
    title: string;
    date: string;
    isoDate: string;
    time: string;
    location: string;
    address: string;
    vaccines: string;
    ages: string;
    cost: string;
    access: "walk-in" | "appointment" | "both";
    bookLabel: string;
    bookHref: string;
  }[];
  moreLabel: string;
  moreHref: 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 MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
const WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];

function parseIso(iso: string) {
  const m = /^(\d{4})-(\d{2})-(\d{2})/.exec((iso || "").trim());
  if (!m) return null;
  const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
  if (mo < 1 || mo > 12 || d < 1 || d > 31) return null;
  const weekday = new Date(Date.UTC(y, mo - 1, d)).getUTCDay();
  return { month: MONTHS[mo - 1], day: d, weekday: WEEKDAYS[weekday] };
}

const accessCopy = {
  "walk-in": "Walk-ins welcome",
  appointment: "Appointment needed",
  both: "Walk in or book ahead",
};

const icons = {
  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",
  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",
  users:
    "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",
  tag: "M4.5 2A2.5 2.5 0 0 0 2 4.5v3.879a2.5 2.5 0 0 0 .732 1.767l7.5 7.5a2.5 2.5 0 0 0 3.536 0l3.878-3.878a2.5 2.5 0 0 0 0-3.536l-7.5-7.5A2.5 2.5 0 0 0 8.38 2H4.5ZM5 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
  info: "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",
  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 Detail({ icon, label, children }: { icon: string; label: string; children: React.ReactNode }) {
  return (
    <div className="flex gap-2.5">
      <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-neutral-500">
          <path fillRule="evenodd" d={icon} clipRule="evenodd" />
        </svg>
      </dt>
      <dd className="min-w-0 text-sm leading-6 text-neutral-700">{children}</dd>
    </div>
  );
}

export const vaccineClinicsBlock: ComponentConfig<VaccineClinicsProps> = {
  label: "Vaccine Clinics",
  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 titles use the next level down." },
    },
    intro: { type: "textarea", label: "Intro" },
    costNote: { type: "text", label: "Cost highlight", metadata: { help: "Shown as a badge under the intro, like No cost. Insurance not required. Leave blank to hide." } },
    bringNote: { type: "textarea", label: "What to bring", metadata: { help: "A short note shown beside the list. Leave blank to hide." } },
    clinics: {
      type: "array",
      label: "Clinics",
      min: 1,
      max: 20,
      getItemSummary: (item) => (item?.title ? `${item.date ? `${item.date} · ` : ""}${item.title}` : "Clinic"),
      defaultItemProps: { title: "Vaccine clinic", date: "", isoDate: "", time: "", location: "", address: "", vaccines: "", ages: "", cost: "No cost", access: "walk-in", bookLabel: "", bookHref: "" },
      arrayFields: {
        title: { type: "text", label: "Title" },
        date: { type: "text", label: "Date (as shown)", metadata: { help: "Written the way people read it, like Saturday, October 17." } },
        isoDate: { type: "text", label: "Date (YYYY-MM-DD)", metadata: { help: "Like 2026-10-17. Builds the date tile and tells calendars and screen readers the exact date." } },
        time: { type: "text", label: "Time", metadata: { help: "Like 9 a.m. – 1 p.m." } },
        location: { type: "text", label: "Place" },
        address: { type: "text", label: "Address" },
        vaccines: { type: "textarea", label: "Vaccines offered", metadata: { help: "Separate with commas. Each one shows as a tag." } },
        ages: { type: "text", label: "Ages", metadata: { help: "Like Ages 6 months and up." } },
        cost: { type: "text", label: "Cost", metadata: { help: "Like No cost; insurance not required." } },
        access: {
          type: "radio",
          label: "How to get a shot",
          options: [
            { label: "Walk in", value: "walk-in" },
            { label: "Appointment", value: "appointment" },
            { label: "Either", value: "both" },
          ],
        },
        bookLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
        bookHref: { type: "text", label: "Button link" },
      },
    },
    moreLabel: { type: "text", label: "Footer link text", metadata: { help: "Like See all vaccine services. Leave blank to hide." } },
    moreHref: { type: "text", label: "Footer link" },
  },
  defaultProps: {
    heading: "Upcoming vaccine clinics",
    headingLevel: "h2",
    intro: "Get your flu shot and other vaccines at a clinic near you. Bring the whole family. Shots take about 15 minutes, plus a short wait after.",
    costNote: "No cost. Insurance not required.",
    bringNote: "Bring your vaccine card or records if you have them. You do not need to show ID or proof of insurance.",
    clinics: [
      {
        title: "Family flu shot clinic",
        date: "Saturday, October 17",
        isoDate: "2026-10-17",
        time: "9 a.m. – 1 p.m.",
        location: "Lakeshore Public Library, Community Room",
        address: "120 Front Street, Lakeshore",
        vaccines: "Flu, COVID-19, Tdap",
        ages: "Ages 6 months and up",
        cost: "No cost; insurance not required",
        access: "walk-in",
        bookLabel: "",
        bookHref: "",
      },
      {
        title: "Back-to-school catch-up shots",
        date: "Wednesday, October 21",
        isoDate: "2026-10-21",
        time: "3 p.m. – 7 p.m.",
        location: "Northside Family Clinic",
        address: "2215 Birch Avenue, Lakeshore",
        vaccines: "MMR, Tdap, HPV, Meningococcal, Polio",
        ages: "Ages 4 to 18, with a parent or guardian",
        cost: "No cost; insurance not required",
        access: "appointment",
        bookLabel: "Book a time",
        bookHref: "/vaccines/book?clinic=northside-1021",
      },
      {
        title: "Adult vaccine clinic",
        date: "Thursday, October 29",
        isoDate: "2026-10-29",
        time: "10 a.m. – 2 p.m.",
        location: "Pine Hollow Senior Center",
        address: "45 Maple Lane, Pine Hollow",
        vaccines: "Flu, COVID-19, Shingles, Pneumonia",
        ages: "Ages 18 and up",
        cost: "No cost; insurance not required",
        access: "both",
        bookLabel: "Save a spot",
        bookHref: "/vaccines/book?clinic=pine-hollow-1029",
      },
    ],
    moreLabel: "See all vaccine services",
    moreHref: "/vaccines",
  },
  render: ({ heading, headingLevel, intro, costNote, bringNote, clinics, moreLabel, moreHref }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (clinics ?? []).filter((c) => c?.title);

    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-5xl">
          <div className="grid grid-cols-1 gap-8 lg:grid-cols-5 lg:items-end">
            <div className="lg:col-span-3">
              {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}
              {costNote ? (
                <p className="mt-6 inline-flex items-center gap-2 rounded-full bg-indigo-50 px-4 py-2 text-sm font-semibold text-indigo-800 ring-1 ring-indigo-600/20 ring-inset">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0">
                    <path fillRule="evenodd" d={icons.tag} clipRule="evenodd" />
                  </svg>
                  {costNote}
                </p>
              ) : null}
            </div>
            {bringNote ? (
              <div className="flex gap-3 rounded-2xl bg-neutral-50 p-5 ring-1 ring-neutral-950/5 ring-inset lg:col-span-2">
                <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={icons.info} clipRule="evenodd" />
                </svg>
                <p className="text-sm leading-6 text-pretty text-neutral-700">
                  <span className="block font-semibold text-neutral-950">What to bring</span>
                  {bringNote}
                </p>
              </div>
            ) : null}
          </div>

          {list.length ? (
            <ol role="list" className="mt-12 space-y-4">
              {list.map((c, i) => {
                const parsed = parseIso(c.isoDate);
                const vaccines = (c.vaccines || "").split(/[,\n]/).map((v) => v.trim()).filter(Boolean);
                const access = accessCopy[c.access] ?? accessCopy["walk-in"];
                const walkIn = c.access !== "appointment";
                const dateText = c.date || (parsed ? `${parsed.weekday}, ${parsed.month} ${parsed.day}` : "");
                return (
                  <li key={`${c.title}-${i}`}>
                    <article className="flex flex-col gap-5 rounded-2xl bg-white p-5 shadow-xs ring-1 ring-neutral-950/10 sm:flex-row sm:flex-wrap sm:gap-6 sm:p-6 lg:flex-nowrap lg:items-center">
                      {parsed ? (
                        <div aria-hidden="true" className="flex w-20 shrink-0 flex-col items-center rounded-xl bg-indigo-600 px-2 py-3 text-white">
                          <span className="text-xs font-semibold tracking-widest uppercase">{parsed.month}</span>
                          <span className="text-3xl leading-none font-semibold tabular-nums">{parsed.day}</span>
                          <span className="mt-1 text-xs font-medium text-indigo-100">{parsed.weekday}</span>
                        </div>
                      ) : null}

                      <div className="min-w-0 flex-1">
                        <Sub className="text-lg font-semibold tracking-tight text-neutral-950">{c.title}</Sub>
                        {dateText || c.time ? (
                          <p className="mt-0.5 text-sm font-medium text-neutral-800 tabular-nums">
                            {dateText ? parsed ? <time dateTime={c.isoDate.trim().slice(0, 10)}>{dateText}</time> : dateText : null}
                            {dateText && c.time ? " · " : null}
                            {c.time}
                          </p>
                        ) : null}
                        <dl className="mt-3 grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2">
                          {c.location ? (
                            <Detail icon={icons.pin} label="Place">
                              <span className="font-medium text-neutral-900">{c.location}</span>
                              {c.address ? <span className="block">{c.address}</span> : null}
                            </Detail>
                          ) : null}
                          {c.ages ? (
                            <Detail icon={icons.users} label="Ages">
                              {c.ages}
                            </Detail>
                          ) : null}
                          {c.cost ? (
                            <Detail icon={icons.tag} label="Cost">
                              {c.cost}
                            </Detail>
                          ) : null}
                          <Detail icon={icons.clock} label="How to get a shot">
                            <span className="font-medium text-neutral-900">{access}</span>
                          </Detail>
                        </dl>
                        {vaccines.length ? (
                          <div className="mt-4 flex flex-wrap items-center gap-1.5">
                            <span className="mr-1 text-xs font-semibold text-neutral-600">Vaccines:</span>
                            <ul role="list" className="contents">
                              {vaccines.map((v, j) => (
                                <li key={`${v}-${j}`} className="rounded-md bg-neutral-100 px-2 py-1 text-xs font-medium text-neutral-800">
                                  {v}
                                </li>
                              ))}
                            </ul>
                          </div>
                        ) : null}
                      </div>

                      <div className="shrink-0 sm:basis-full lg:basis-auto">
                        {c.bookLabel ? (
                          <a
                            href={c.bookHref || "#"}
                            className={`inline-flex min-h-11 w-full items-center justify-center rounded-lg bg-indigo-600 px-5 py-2.5 text-sm font-semibold whitespace-nowrap text-white shadow-xs transition hover:bg-indigo-500 sm:w-auto ${focusRing}`}
                          >
                            {c.bookLabel}
                            <span className="sr-only">: {c.title}{c.date ? `, ${c.date}` : ""}</span>
                          </a>
                        ) : walkIn ? (
                          <p className="text-sm font-semibold text-indigo-800">No appointment needed</p>
                        ) : null}
                      </div>
                    </article>
                  </li>
                );
              })}
            </ol>
          ) : null}

          {moreLabel ? (
            <div className="mt-8">
              <a href={moreHref || "#"} 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}`}>
                {moreLabel}
                <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}
        </div>
      </section>
    );
  },
};
```
