# Add the "Branch Services" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/branch-services) to this Pantheon Content Publisher (P1) Next.js project. Library branches with address and hours, plus a services table with check marks that scrolls accessibly on phones.

## Steps

1. Create `components/puck/branch-services-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 { branchServicesBlock } from "./components/puck/branch-services-block";`
3. Register it under `components` as `BranchServicesBlock: branchServicesBlock`.
4. Add `"BranchServicesBlock"` 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/branch-services-block.tsx`

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

/**
 * Branch Services — every library branch with its address and hours summary, and a
 * services matrix (Wi-Fi, printing, study rooms…) with check marks and screen reader text.
 * Register: `BranchServicesBlock: branchServicesBlock` in puck.config.tsx.
 */

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

type YesNo = "yes" | "no";

type Branch = {
  name: string;
  address: string;
  hours: string;
  phone: string;
  href: string;
  s1: YesNo;
  s2: YesNo;
  s3: YesNo;
  s4: YesNo;
  s5: YesNo;
  s6: YesNo;
};

type ServiceKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6";

export type BranchServicesProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  caption: string;
  service1: string;
  service2: string;
  service3: string;
  service4: string;
  service5: string;
  service6: string;
  branches: Branch[];
  footnote: string;
};

const yesNo = {
  type: "radio" as const,
  options: [
    { label: "Yes", value: "yes" },
    { label: "No", value: "no" },
  ],
};

const serviceHelp = { help: "Column heading. Leave blank to drop this column." };

export const branchServicesBlock: ComponentConfig<BranchServicesProps> = {
  label: "Branch Services",
  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" },
    caption: { type: "text", label: "Table caption", metadata: { help: "Names the table for screen reader users." } },
    service1: { type: "text", label: "Service 1", metadata: serviceHelp },
    service2: { type: "text", label: "Service 2", metadata: serviceHelp },
    service3: { type: "text", label: "Service 3", metadata: serviceHelp },
    service4: { type: "text", label: "Service 4", metadata: serviceHelp },
    service5: { type: "text", label: "Service 5", metadata: serviceHelp },
    service6: { type: "text", label: "Service 6", metadata: serviceHelp },
    branches: {
      type: "array",
      label: "Branches",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.name || "Branch",
      defaultItemProps: { name: "New branch", address: "", hours: "", phone: "", href: "", s1: "yes", s2: "yes", s3: "no", s4: "no", s5: "no", s6: "no" },
      arrayFields: {
        name: { type: "text", label: "Branch name" },
        address: { type: "text", label: "Address" },
        hours: { type: "text", label: "Hours summary", metadata: { help: "One line, such as Mon–Thu 9–8 · Fri–Sat 9–5 · Sun 1–5." } },
        phone: { type: "text", label: "Phone", metadata: { help: "Leave blank to hide it." } },
        href: { type: "text", label: "Branch page link", metadata: { help: "Leave blank for no link." } },
        s1: { ...yesNo, label: "Offers service 1" },
        s2: { ...yesNo, label: "Offers service 2" },
        s3: { ...yesNo, label: "Offers service 3" },
        s4: { ...yesNo, label: "Offers service 4" },
        s5: { ...yesNo, label: "Offers service 5" },
        s6: { ...yesNo, label: "Offers service 6" },
      },
    },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Small print under the table, such as appointment details. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Branches and services",
    headingLevel: "h2",
    intro: "Every Cedar Valley branch has free Wi-Fi and printing. Some services, like the makerspace and passport appointments, live at one or two locations, so check here before you head out.",
    caption: "Services offered at each Cedar Valley Public Library branch",
    service1: "Wi-Fi",
    service2: "Printing",
    service3: "Study rooms",
    service4: "Makerspace",
    service5: "Notary",
    service6: "Passport services",
    branches: [
      { name: "Main Library", address: "200 Cedar Street, Cedar Valley", hours: "Mon–Thu 9–9 · Fri–Sat 9–6 · Sun 1–5", phone: "(555) 555-0110", href: "/branches/main", s1: "yes", s2: "yes", s3: "yes", s4: "yes", s5: "yes", s6: "yes" },
      { name: "Riverside Branch", address: "48 Mill Road, Cedar Valley", hours: "Mon–Thu 10–8 · Fri–Sat 10–5 · Sun closed", phone: "(555) 555-0124", href: "/branches/riverside", s1: "yes", s2: "yes", s3: "yes", s4: "no", s5: "yes", s6: "no" },
      { name: "Hillcrest Branch", address: "1510 Hillcrest Avenue, Cedar Valley", hours: "Mon–Thu 10–8 · Fri–Sat 10–5 · Sun 1–5", phone: "(555) 555-0137", href: "/branches/hillcrest", s1: "yes", s2: "yes", s3: "yes", s4: "yes", s5: "no", s6: "no" },
      { name: "North Fork Branch", address: "9 Grange Lane, North Fork", hours: "Tue–Thu 11–7 · Sat 10–4 · Sun–Mon closed", phone: "(555) 555-0142", href: "/branches/north-fork", s1: "yes", s2: "yes", s3: "no", s4: "no", s5: "no", s6: "no" },
    ],
    footnote: "Passport services are by appointment only. Notary service is free for cardholders; call ahead to make sure a notary is on duty.",
  },
  render: ({ id, heading, headingLevel, intro, caption, service1, service2, service3, service4, service5, service6, branches, footnote }) => {
    const H = headingLevel || "h2";
    const list = (branches ?? []).filter((b) => b?.name);
    const captionId = `p1-branch-services-${id || "block"}-caption`;
    const services = (
      [
        ["s1", service1],
        ["s2", service2],
        ["s3", service3],
        ["s4", service4],
        ["s5", service5],
        ["s6", service6],
      ] as [ServiceKey, string][]
    ).filter(([, label]) => label);

    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">
          {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 ? (
            <div
              role="region"
              aria-labelledby={captionId}
              tabIndex={0}
              className="relative mt-10 overflow-x-auto rounded-2xl bg-white shadow-sm ring-1 ring-neutral-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:mt-12"
            >
              <table className="w-full min-w-3xl border-collapse text-left">
                <caption id={captionId} className="sr-only">
                  {caption || "Services by branch"}
                </caption>
                <thead>
                  <tr className="border-b border-neutral-200">
                    <th scope="col" className="bg-white px-5 py-4 sm:sticky sm:left-0 sm:z-10 text-sm font-semibold text-neutral-950">
                      Branch
                    </th>
                    {services.map(([key, label]) => (
                      <th key={key} scope="col" className="px-3 py-4 text-center text-sm font-semibold text-neutral-950">
                        {label}
                      </th>
                    ))}
                  </tr>
                </thead>
                <tbody className="divide-y divide-neutral-200">
                  {list.map((b, i) => (
                    <tr key={`${b.name}-${i}`} className="group align-top">
                      <th scope="row" className="min-w-52 bg-white sm:sticky sm:left-0 sm:z-10 sm:w-72 px-5 py-5 text-left font-normal group-hover:bg-neutral-50">
                        {b.href ? (
                          <a
                            href={b.href}
                            className="rounded-sm text-base font-semibold text-neutral-950 underline decoration-neutral-300 underline-offset-4 hover:text-indigo-700 hover:decoration-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                          >
                            {b.name}
                          </a>
                        ) : (
                          <span className="text-base font-semibold text-neutral-950">{b.name}</span>
                        )}
                        {b.address ? (
                          <span className="mt-2 flex items-start gap-1.5 text-sm leading-5 text-neutral-600">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0 text-neutral-400">
                              <path fillRule="evenodd" d="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" clipRule="evenodd" />
                            </svg>
                            <span>{b.address}</span>
                          </span>
                        ) : null}
                        {b.hours ? (
                          <span className="mt-1 flex items-start gap-1.5 text-sm leading-5 text-neutral-600">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0 text-neutral-400">
                              <path fillRule="evenodd" d="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" clipRule="evenodd" />
                            </svg>
                            <span>
                              <span className="sr-only">Hours: </span>
                              {b.hours}
                            </span>
                          </span>
                        ) : null}
                        {b.phone ? (
                          <a
                            href={`tel:${b.phone.replace(/[^0-9+]/g, "")}`}
                            className="mt-1 inline-flex min-h-11 items-center gap-1.5 rounded-sm text-sm text-neutral-700 hover:text-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                          >
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 text-neutral-400">
                              <path fillRule="evenodd" d="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.756l-.97.33a11.04 11.04 0 0 0 6.783 6.783l.33-.97a1.5 1.5 0 0 1 1.756-1.02l2.31.513A1.5 1.5 0 0 1 18 14.352V15.5a1.5 1.5 0 0 1-1.5 1.5H15c-7.18 0-13-5.82-13-13V3.5Z" clipRule="evenodd" />
                            </svg>
                            {b.phone}
                          </a>
                        ) : null}
                      </th>
                      {services.map(([key, label]) => {
                        const has = b[key] === "yes";
                        return (
                          <td key={key} className="px-3 py-5 text-center align-middle group-hover:bg-neutral-50">
                            {has ? (
                              <span className="inline-grid size-8 place-items-center rounded-full bg-indigo-600 text-white">
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4">
                                  <path fillRule="evenodd" d="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" clipRule="evenodd" />
                                </svg>
                              </span>
                            ) : (
                              <span aria-hidden="true" className="text-lg text-neutral-400">
                                —
                              </span>
                            )}
                            <span className="sr-only">{has ? `Yes, ${label} available` : `No ${label}`}</span>
                          </td>
                        );
                      })}
                    </tr>
                  ))}
                </tbody>
              </table>
            </div>
          ) : null}

          {footnote ? <p className="mt-4 max-w-3xl text-sm leading-6 text-pretty text-neutral-600">{footnote}</p> : null}
        </div>
      </section>
    );
  },
};
```
