# Add the "Parks Directory" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/parks-directory) to this Pantheon Content Publisher (P1) Next.js project. Park cards with photos, labeled amenity icons, hours, address and a directions link.

## Steps

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

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

/**
 * Parks Directory — city parks as photo cards with amenities (icon plus text label), hours,
 * address and a directions link. Amenities are picked from a list so the icons stay consistent.
 * Register: `ParksDirectoryBlock: parksDirectoryBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Amenity = "playground" | "trails" | "restrooms" | "dog" | "accessible" | "picnic" | "sports" | "water" | "parking";

export type ParksDirectoryProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  parks: {
    name: string;
    imageUrl: string;
    imageAlt: string;
    description: string;
    amenities: { amenity: Amenity }[];
    hours: string;
    address: string;
    mapHref: string;
    href: string;
  }[];
  allParksLabel: string;
  allParksHref: string;
};

const childHeading = { 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-700";

const amenities: Record<Amenity, { label: string; path: string }> = {
  playground: { label: "Playground", path: "M5 21V8m14 13V8M3 8l9-5 9 5M8 21v-5h8v5M10 12h4" },
  trails: { label: "Walking trails", path: "M13 4.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM9.5 21l2.5-7 3 3v4M7 12l2-5 4 1 2 4 3 1M12 14l-1.5-4.5" },
  restrooms: { label: "Restrooms", path: "M7 4.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm10 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM5 7h4l1 7H8.5v7h-3v-7H4l1-7Zm10 0h4l2 8h-2.5v6h-3v-6H13l2-8ZM12 3v18" },
  dog: { label: "Dog park", path: "M10 5.5 8 3H5L3 6v3l2 1v4l-1 7h3l1-5h6l1 5h3l-1-7V9l2-2-2-2h-3l-2 2h-3ZM6 6.5h.01" },
  accessible: { label: "ADA accessible", path: "M12 5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM9 8h6m-3 0v6h4l2 5M9.5 11.5a5 5 0 1 0 6 7" },
  picnic: { label: "Picnic shelter", path: "M3 10 12 4l9 6M5 10v10m14-10v10M7 15h10M9 15l-1.5 5M15 15l1.5 5" },
  sports: { label: "Sports fields", path: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 7l4 3-1.5 4.5h-5L8 10l4-3Zm0-4v4m4 3 4.5-1.5M14.5 14.5 17 19M9.5 14.5 7 19M8 10 3.5 8.5" },
  water: { label: "Splash pad", path: "M12 3c-3 4-5.5 7-5.5 10a5.5 5.5 0 0 0 11 0C17.5 10 15 7 12 3Zm-2.5 10.5a2.5 2.5 0 0 0 2.5 2.5" },
  parking: { label: "Parking", path: "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm4 14V7h4a3 3 0 0 1 0 6H9" },
};

const amenityOptions = (Object.keys(amenities) as Amenity[]).map((value) => ({ label: amenities[value].label, value }));

export const parksDirectoryBlock: ComponentConfig<ParksDirectoryProps> = {
  label: "Parks Directory",
  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", metadata: { help: "Leave blank to hide it." } },
    parks: {
      type: "array",
      label: "Parks",
      min: 1,
      max: 24,
      getItemSummary: (item) => item?.name || "Park",
      defaultItemProps: { name: "New park", imageUrl: "", imageAlt: "", description: "", amenities: [], hours: "", address: "", mapHref: "", href: "" },
      arrayFields: {
        name: { type: "text", label: "Park name" },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "A landscape photo works best. Leave blank for a plain card." } },
        imageAlt: { type: "text", label: "Image description", metadata: { help: "Describe what the photo shows for people who can't see it." } },
        description: { type: "textarea", label: "Short description", metadata: { help: "One sentence. Leave blank to hide it." } },
        amenities: {
          type: "array",
          label: "Amenities",
          max: 9,
          getItemSummary: (item) => amenities[item?.amenity]?.label || "Amenity",
          defaultItemProps: { amenity: "playground" },
          arrayFields: {
            amenity: { type: "select", label: "Amenity", options: amenityOptions },
          },
        },
        hours: { type: "text", label: "Hours", metadata: { help: "Like Dawn to dusk, or 6 a.m. to 10 p.m." } },
        address: { type: "text", label: "Address" },
        mapHref: { type: "text", label: "Directions link", metadata: { help: "A map link for this park. Leave blank to hide it." } },
        href: { type: "text", label: "Park page link", metadata: { help: "Makes the park name a link. Leave blank for plain text." } },
      },
    },
    allParksLabel: { type: "text", label: "All parks link text", metadata: { help: "Leave blank to hide the link." } },
    allParksHref: { type: "text", label: "All parks link" },
  },
  defaultProps: {
    heading: "Find a park near you",
    headingLevel: "h2",
    intro: "Millbrook maintains 23 parks and 14 miles of trails. Every park is free and open to everyone.",
    parks: [
      {
        name: "Riverside Park",
        imageUrl: "https://picsum.photos/seed/riverside/800/533",
        imageAlt: "A paved path along a river lined with trees",
        description: "The city's largest park, with a river walk that connects to the Canal Street trail.",
        amenities: [{ amenity: "playground" }, { amenity: "trails" }, { amenity: "restrooms" }, { amenity: "accessible" }, { amenity: "picnic" }],
        hours: "6 a.m. to 10 p.m.",
        address: "400 River Road",
        mapHref: "https://maps.example.com/?q=400+River+Road+Millbrook",
        href: "/parks/riverside",
      },
      {
        name: "Hillcrest Commons",
        imageUrl: "https://picsum.photos/seed/meadow/800/533",
        imageAlt: "An open grassy field with a few trees on a sunny day",
        description: "A neighborhood park with a fenced off-leash area and a summer splash pad.",
        amenities: [{ amenity: "dog" }, { amenity: "water" }, { amenity: "restrooms" }, { amenity: "accessible" }, { amenity: "parking" }],
        hours: "Dawn to dusk",
        address: "1180 Hillcrest Avenue",
        mapHref: "https://maps.example.com/?q=1180+Hillcrest+Avenue+Millbrook",
        href: "/parks/hillcrest",
      },
      {
        name: "Cedar Run Sports Complex",
        imageUrl: "https://picsum.photos/seed/fields/800/533",
        imageAlt: "Green athletic fields with goals at the far end",
        description: "Four lighted fields for youth and adult leagues. Reserve fields online.",
        amenities: [{ amenity: "sports" }, { amenity: "restrooms" }, { amenity: "parking" }, { amenity: "accessible" }],
        hours: "7 a.m. to 11 p.m.",
        address: "2900 Cedar Run Drive",
        mapHref: "https://maps.example.com/?q=2900+Cedar+Run+Drive+Millbrook",
        href: "/parks/cedar-run",
      },
    ],
    allParksLabel: "See all 23 parks",
    allParksHref: "/parks",
  },
  render: ({ id, heading, headingLevel, intro, parks, allParksLabel, allParksHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const baseId = id || "parks-directory";
    const list = (parks ?? []).filter((p) => p?.name);
    return (
      <section aria-labelledby={heading ? `${baseId}-heading` : undefined} 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 || allParksLabel ? (
            <div className="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between sm:gap-10">
              <div className="max-w-2xl">
                {heading ? (
                  <H id={`${baseId}-heading`} 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>
              {allParksLabel ? (
                <a
                  href={allParksHref || "#"}
                  className={`group inline-flex min-h-11 shrink-0 items-center gap-1.5 self-start rounded text-base font-semibold text-indigo-700 hover:text-indigo-900 sm:self-auto ${focusRing}`}
                >
                  {allParksLabel}
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 transition motion-safe: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>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 ${heading || intro || allParksLabel ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((park, i) => {
                const items = (park.amenities ?? []).filter((a) => a?.amenity && amenities[a.amenity]);
                return (
                  <li key={`${park.name}-${i}`} className="flex flex-col">
                    {park.imageUrl ? (
                      <img src={park.imageUrl} alt={park.imageAlt || ""} loading="lazy" className="aspect-3/2 w-full rounded-2xl bg-neutral-100 object-cover ring-1 ring-neutral-950/5" />
                    ) : null}
                    <div className={park.imageUrl ? "mt-5" : "border-t-2 border-indigo-700 pt-5"}>
                      <Sub className="text-xl font-semibold tracking-tight text-neutral-950">
                        {park.href ? (
                          <a href={park.href} className={`rounded hover:text-indigo-800 hover:underline hover:decoration-indigo-300 hover:underline-offset-4 ${focusRing}`}>
                            {park.name}
                          </a>
                        ) : (
                          park.name
                        )}
                      </Sub>
                      {park.description ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-600">{park.description}</p> : null}
                    </div>
                    {items.length ? (
                      <div className="mt-4">
                        <p className="sr-only">Amenities</p>
                        <ul role="list" className="flex flex-wrap gap-2">
                          {items.map((a, j) => (
                            <li key={j} className="inline-flex items-center gap-1.5 rounded-full bg-indigo-50 py-1 pr-3 pl-2 text-sm leading-5 font-medium text-indigo-900 ring-1 ring-indigo-600/15">
                              <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" className="size-4 shrink-0 text-indigo-700">
                                <path d={amenities[a.amenity].path} />
                              </svg>
                              {amenities[a.amenity].label}
                            </li>
                          ))}
                        </ul>
                      </div>
                    ) : null}
                    {park.hours || park.address ? (
                      <dl className="mt-5 grid grid-cols-1 gap-2 border-t border-neutral-200 pt-4 text-sm leading-6">
                        {park.hours ? (
                          <div className="flex gap-3">
                            <dt className="w-16 shrink-0 font-semibold text-neutral-950">Hours</dt>
                            <dd className="min-w-0 text-neutral-700">{park.hours}</dd>
                          </div>
                        ) : null}
                        {park.address ? (
                          <div className="flex gap-3">
                            <dt className="w-16 shrink-0 font-semibold text-neutral-950">Address</dt>
                            <dd className="min-w-0 text-neutral-700">{park.address}</dd>
                          </div>
                        ) : null}
                      </dl>
                    ) : null}
                    {park.mapHref ? (
                      <a
                        href={park.mapHref}
                        className={`mt-2 inline-flex min-h-11 items-center gap-1.5 self-start rounded text-sm font-semibold text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}
                      >
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                          <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>
                        Get directions<span className="sr-only"> to {park.name}</span>
                      </a>
                    ) : null}
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
