# Add the "Rec Center Passes" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/rec-center-passes) to this Pantheon Content Publisher (P1) Next.js project. Pass prices by type and age group in a resident and non-resident fee table, with what's included and discounts.

## Steps

1. Create `components/puck/rec-center-passes-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 { recCenterPassesBlock } from "./components/puck/rec-center-passes-block";`
3. Register it under `components` as `RecCenterPassesBlock: recCenterPassesBlock`.
4. Add `"RecCenterPassesBlock"` 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/rec-center-passes-block.tsx`

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

/**
 * Rec Center Passes — a fee table of pass types (daily, 10-visit, monthly, annual) by age
 * category, with resident and non-resident prices, what every pass includes, discounts and
 * a buy link. The table scrolls sideways on phones with the pass names pinned.
 * Register: `RecCenterPassesBlock: recCenterPassesBlock` in puck.config.tsx.
 */

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

type Pass = {
  name: string;
  detail: string;
  youthResident: string;
  youthNonResident: string;
  adultResident: string;
  adultNonResident: string;
  seniorResident: string;
  seniorNonResident: string;
  familyResident: string;
  familyNonResident: string;
};

export type RecCenterPassesProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  youthLabel: string;
  adultLabel: string;
  seniorLabel: string;
  familyLabel: string;
  passes: Pass[];
  residencyNote: string;
  includedHeading: string;
  included: string;
  discountsHeading: string;
  discounts: { title: string; detail: string }[];
  buyHeading: string;
  buyText: string;
  buyLabel: string;
  buyHref: string;
};

const down = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;

const categories = [
  { key: "youth", label: "youthLabel" },
  { key: "adult", label: "adultLabel" },
  { key: "senior", label: "seniorLabel" },
  { key: "family", label: "familyLabel" },
] as const;

const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-700";

const priceField = (label: string) => ({ type: "text" as const, label, metadata: { help: "Like $6, or Free. Leave blank if not offered." } });

export const recCenterPassesBlock: ComponentConfig<RecCenterPassesProps> = {
  label: "Rec Center Passes",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, like the center's name. 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." } },
    youthLabel: { type: "text", label: "Youth column", metadata: { help: "Like Youth (3–17). Leave blank to hide the column." } },
    adultLabel: { type: "text", label: "Adult column", metadata: { help: "Like Adult (18–61). Leave blank to hide the column." } },
    seniorLabel: { type: "text", label: "Senior column", metadata: { help: "Like Senior (62+). Leave blank to hide the column." } },
    familyLabel: { type: "text", label: "Family column", metadata: { help: "Like Family (up to 5). Leave blank to hide the column." } },
    passes: {
      type: "array",
      label: "Pass types",
      min: 1,
      max: 8,
      getItemSummary: (item) => item?.name || "Pass",
      defaultItemProps: {
        name: "New pass",
        detail: "",
        youthResident: "",
        youthNonResident: "",
        adultResident: "",
        adultNonResident: "",
        seniorResident: "",
        seniorNonResident: "",
        familyResident: "",
        familyNonResident: "",
      },
      arrayFields: {
        name: { type: "text", label: "Pass name", metadata: { help: "Like Daily, 10-visit, Monthly or Annual." } },
        detail: { type: "text", label: "Detail", metadata: { help: "Optional, like Good for 12 months. Leave blank to hide it." } },
        youthResident: priceField("Youth, resident"),
        youthNonResident: priceField("Youth, non-resident"),
        adultResident: priceField("Adult, resident"),
        adultNonResident: priceField("Adult, non-resident"),
        seniorResident: priceField("Senior, resident"),
        seniorNonResident: priceField("Senior, non-resident"),
        familyResident: priceField("Family, resident"),
        familyNonResident: priceField("Family, non-resident"),
      },
    },
    residencyNote: { type: "textarea", label: "Fee notes", metadata: { help: "Who counts as a resident, age rules, tax. Leave blank to hide it." } },
    includedHeading: { type: "text", label: "Included heading", metadata: { help: "Leave blank to use Every pass includes." } },
    included: { type: "textarea", label: "Included", metadata: { help: "One item per line. Leave blank to hide the list." } },
    discountsHeading: { type: "text", label: "Discounts heading", metadata: { help: "Leave blank to use Discounts." } },
    discounts: {
      type: "array",
      label: "Discounts",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.title || "Discount",
      defaultItemProps: { title: "New discount", detail: "" },
      arrayFields: {
        title: { type: "text", label: "Title", metadata: { help: "Like Military and veterans: 20% off." } },
        detail: { type: "textarea", label: "Detail", metadata: { help: "Who qualifies and what to bring. Leave blank to hide it." } },
      },
    },
    buyHeading: { type: "text", label: "Buy heading", metadata: { help: "Leave blank to hide the buy panel." } },
    buyText: { type: "textarea", label: "Buy text" },
    buyLabel: { type: "text", label: "Buy button text" },
    buyHref: { type: "text", label: "Buy button link" },
  },
  defaultProps: {
    eyebrow: "Riverside Community Center",
    heading: "Passes and memberships",
    headingLevel: "h2",
    intro: "One pass gets you into the fitness floor, both pools, the indoor track and drop-in gym time at every Cedar Valley rec center.",
    youthLabel: "Youth (3–17)",
    adultLabel: "Adult (18–61)",
    seniorLabel: "Senior (62+)",
    familyLabel: "Family (up to 5)",
    passes: [
      {
        name: "Daily",
        detail: "One visit, any center",
        youthResident: "$4",
        youthNonResident: "$6",
        adultResident: "$7",
        adultNonResident: "$10",
        seniorResident: "$5",
        seniorNonResident: "$7",
        familyResident: "$18",
        familyNonResident: "$26",
      },
      {
        name: "10-visit",
        detail: "Never expires",
        youthResident: "$35",
        youthNonResident: "$50",
        adultResident: "$60",
        adultNonResident: "$85",
        seniorResident: "$42",
        seniorNonResident: "$60",
        familyResident: "",
        familyNonResident: "",
      },
      {
        name: "Monthly",
        detail: "Auto-renews; cancel anytime",
        youthResident: "$18",
        youthNonResident: "$26",
        adultResident: "$34",
        adultNonResident: "$48",
        seniorResident: "$24",
        seniorNonResident: "$34",
        familyResident: "$62",
        familyNonResident: "$88",
      },
      {
        name: "Annual",
        detail: "Best value: 12 months for the price of 10",
        youthResident: "$180",
        youthNonResident: "$260",
        adultResident: "$340",
        adultNonResident: "$480",
        seniorResident: "$240",
        seniorNonResident: "$340",
        familyResident: "$620",
        familyNonResident: "$880",
      },
    ],
    residencyNote: "Resident prices are for people who live in the Cedar Valley Park District; bring a photo ID and a utility bill the first time. Children under 3 are always free. Family passes cover two adults and up to three children in one household.",
    includedHeading: "Every pass includes",
    included: "Fitness floor and free weights\nLap pool, leisure pool and hot tub\nIndoor walking and running track\nDrop-in basketball, volleyball and pickleball\nLocker rooms, with family changing rooms\nAccess to all three rec centers",
    discountsHeading: "Discounts",
    discounts: [
      { title: "Military and veterans: 20% off", detail: "Active duty, reserve, National Guard and veterans, plus their households. Bring a military ID or DD-214." },
      { title: "Play It Forward scholarship: up to 80% off", detail: "For households that qualify by income. Apply once a year online or at the front desk." },
      { title: "Silver Sneakers and Renew Active: free", detail: "Members of these Medicare fitness programs get an adult pass at no cost. Bring your member card." },
    ],
    buyHeading: "Get your pass",
    buyText: "Buy online and pick up your card at any front desk, or buy in person during open hours. Questions? Call 555-0142.",
    buyLabel: "Buy a pass online",
    buyHref: "/passes/buy",
  },
  render: (props) => {
    const {
      id,
      eyebrow,
      heading,
      headingLevel,
      intro,
      passes,
      residencyNote,
      includedHeading,
      included,
      discountsHeading,
      discounts,
      buyHeading,
      buyText,
      buyLabel,
      buyHref,
    } = props;
    const H = headingLevel || "h2";
    const Sub = down[H] || "h3";
    const base = id || "rec-center-passes";
    const cols = categories.map((c, i) => ({ ...c, i, text: props[c.label] })).filter((c) => c.text);
    const rows = (passes ?? []).filter((p) => p?.name);
    const perks = (included || "")
      .split("\n")
      .map((l) => l.trim())
      .filter(Boolean);
    const deals = (discounts ?? []).filter((d) => d?.title);
    const hasHeader = Boolean(eyebrow || heading || intro);
    const showTable = rows.length > 0 && cols.length > 0;

    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">
          {hasHeader ? (
            <div className="max-w-2xl">
              {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700">{eyebrow}</p> : null}
              {heading ? <H 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}

          {showTable ? (
            <div className={hasHeader ? "mt-10 sm:mt-12" : ""}>
              {cols.length > 1 ? (
                <p className="mb-3 flex items-center gap-2 text-sm text-neutral-600 lg:hidden">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                    <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>
                  Scroll sideways to see every price.
                </p>
              ) : null}
              <div
                role="region"
                aria-labelledby={`${base}-caption`}
                tabIndex={0}
                className={`relative overflow-x-auto rounded-2xl ring-1 ring-neutral-200 ${focusRing}`}
              >
                <table className="w-full min-w-3xl border-collapse text-left text-sm leading-6">
                  <caption id={`${base}-caption`} className="sr-only">
                    {heading ? `${heading}: ` : ""}pass prices by age group, resident and non-resident
                  </caption>
                  <thead>
                    <tr className="bg-neutral-950 text-white">
                      <td aria-hidden="true" className="sticky left-0 z-10 bg-neutral-950" />
                      {cols.map((c) => (
                        <th key={c.key} id={`${base}-${c.key}`} scope="colgroup" colSpan={2} className="border-l border-white/15 px-4 pt-4 pb-1 text-center text-sm font-semibold">
                          {c.text}
                        </th>
                      ))}
                    </tr>
                    <tr className="border-b border-neutral-200 bg-neutral-950 text-neutral-300">
                      <th id={`${base}-pass`} scope="col" className="sticky left-0 z-10 bg-neutral-950 px-4 pb-3 text-xs font-semibold tracking-wide text-white uppercase sm:px-5">
                        Pass
                      </th>
                      {cols.flatMap((c) => [
                        <th key={`${c.key}-r`} id={`${base}-${c.key}-r`} scope="col" className="border-l border-white/15 px-4 pb-3 text-right text-xs font-medium">
                          Resident
                        </th>,
                        <th key={`${c.key}-n`} id={`${base}-${c.key}-n`} scope="col" className="px-4 pb-3 text-right text-xs font-medium">
                          Non-res.<span className="sr-only">ident</span>
                        </th>,
                      ])}
                    </tr>
                  </thead>
                  <tbody className="divide-y divide-neutral-200">
                    {rows.map((p, ri) => {
                      const rowId = `${base}-row-${ri}`;
                      return (
                        <tr key={`${p.name}-${ri}`} className="group bg-white hover:bg-indigo-50">
                          <th id={rowId} scope="row" className="sticky left-0 z-10 bg-white px-4 py-4 align-top font-semibold text-neutral-950 group-hover:bg-indigo-50 sm:px-5">
                            <span className="block text-base">{p.name}</span>
                            {p.detail ? <span className="mt-0.5 block max-w-40 text-xs leading-5 font-normal text-neutral-600">{p.detail}</span> : null}
                          </th>
                          {cols.flatMap((c) => {
                            const res = p[`${c.key}Resident` as keyof Pass];
                            const non = p[`${c.key}NonResident` as keyof Pass];
                            const dash = (
                              <>
                                <span aria-hidden="true" className="text-neutral-400">—</span>
                                <span className="sr-only">Not offered</span>
                              </>
                            );
                            return [
                              <td key={`${c.key}-r`} headers={`${rowId} ${base}-${c.key} ${base}-${c.key}-r`} className="border-l border-neutral-200 px-4 py-4 text-right align-top text-base font-semibold text-neutral-950 tabular-nums">
                                {res || dash}
                              </td>,
                              <td key={`${c.key}-n`} headers={`${rowId} ${base}-${c.key} ${base}-${c.key}-n`} className="px-4 py-4 text-right align-top text-base text-neutral-600 tabular-nums">
                                {non || dash}
                              </td>,
                            ];
                          })}
                        </tr>
                      );
                    })}
                  </tbody>
                </table>
              </div>
              {residencyNote ? <p className="mt-4 max-w-3xl text-sm leading-6 text-pretty text-neutral-600">{residencyNote}</p> : null}
            </div>
          ) : null}

          {perks.length || deals.length || buyHeading ? (
            <div className={`grid grid-cols-1 gap-8 lg:grid-cols-12 lg:gap-10 ${hasHeader || showTable ? "mt-12 sm:mt-16" : ""}`}>
              {perks.length ? (
                <div className={deals.length ? "lg:col-span-4" : "lg:col-span-8"}>
                  <Sub id={`${base}-included`} className="text-lg font-semibold tracking-tight text-neutral-950">
                    {includedHeading || "Every pass includes"}
                  </Sub>
                  <ul role="list" aria-labelledby={`${base}-included`} className="mt-4 space-y-3 text-sm leading-6 text-neutral-700">
                    {perks.map((perk, i) => (
                      <li key={`${perk}-${i}`} className="flex gap-3">
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="h-6 w-5 flex-none text-indigo-600">
                          <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>
                        {perk}
                      </li>
                    ))}
                  </ul>
                </div>
              ) : null}

              {deals.length ? (
                <div className={perks.length ? "lg:col-span-4" : "lg:col-span-8"}>
                  <Sub id={`${base}-discounts`} className="text-lg font-semibold tracking-tight text-neutral-950">
                    {discountsHeading || "Discounts"}
                  </Sub>
                  <ul role="list" aria-labelledby={`${base}-discounts`} className="mt-4 space-y-4">
                    {deals.map((d, i) => (
                      <li key={`${d.title}-${i}`} className="border-l-2 border-indigo-600 pl-4">
                        <p className="text-sm font-semibold text-neutral-950">{d.title}</p>
                        {d.detail ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-600">{d.detail}</p> : null}
                      </li>
                    ))}
                  </ul>
                </div>
              ) : null}

              {buyHeading ? (
                <div className={`self-start rounded-2xl bg-indigo-50 p-6 ring-1 ring-indigo-100 sm:p-8 ${perks.length || deals.length ? "lg:col-span-4" : "lg:col-span-12"}`}>
                  <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="size-8 text-indigo-700">
                    <path d="M16.5 6v.75m0 3v.75m0 3v.75m0 3V18m-9-5.25h5.25M7.5 15h3M3.375 5.25c-.621 0-1.125.504-1.125 1.125v3.026a2.999 2.999 0 0 1 0 5.198v3.026c0 .621.504 1.125 1.125 1.125h17.25c.621 0 1.125-.504 1.125-1.125v-3.026a2.999 2.999 0 0 1 0-5.198V6.375c0-.621-.504-1.125-1.125-1.125H3.375Z" />
                  </svg>
                  <Sub className="mt-4 text-lg font-semibold tracking-tight text-neutral-950">{buyHeading}</Sub>
                  {buyText ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-700">{buyText}</p> : null}
                  {buyLabel ? (
                    <a
                      href={buyHref || "#"}
                      className={`mt-6 flex min-h-11 w-full items-center justify-center rounded-lg bg-indigo-700 px-5 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-600 ${focusRing}`}
                    >
                      {buyLabel}
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
