# Add the "Park Rules" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/park-rules) to this Pantheon Content Publisher (P1) Next.js project. Park hours, rules grouped by topic with icons and ordinance references, and a report-a-violation contact panel.

## Steps

1. Create `components/puck/park-rules-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 { parkRulesBlock } from "./components/puck/park-rules-block";`
3. Register it under `components` as `ParkRulesBlock: parkRulesBlock`.
4. Add `"ParkRulesBlock"` 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/park-rules-block.tsx`

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

/**
 * Park Rules — park hours, then rules grouped by topic (dogs, alcohol, drones, fires, fishing…),
 * each group with an icon, plain-language rules and an optional ordinance reference, and a
 * "report a violation" contact panel.
 * Register: `ParkRulesBlock: parkRulesBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Topic = "dogs" | "alcohol" | "drones" | "fire" | "fishing" | "bikes" | "smoking" | "swimming" | "noise" | "general";

export type ParkRulesProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  hoursLabel: string;
  hours: string;
  hoursNote: string;
  groups: {
    topic: Topic;
    title: string;
    rules: string;
    ordinance: string;
    ordinanceHref: string;
  }[];
  reportHeading: string;
  reportText: string;
  reportPhone: string;
  reportEmail: string;
  reportLabel: string;
  reportHref: string;
  emergencyNote: 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 topics: Record<Topic, { label: string; path: string }> = {
  dogs: { label: "Dogs", path: "M10 5.5 8 3H5L3 6v3l2 1v4l-1 7h3l1-5h6l1 5h3l-1-7V9l2-2-2-2h-3l-2 2h-3ZM6 6.5h.01" },
  alcohol: { label: "Alcohol", path: "M7 3h10l-1 6a4 4 0 0 1-8 0L7 3Zm5 10v7m-4 0h8M7.5 6h9" },
  drones: { label: "Drones", path: "M9.5 9.5h5v5h-5zM9.5 9.5 6.5 6.5m8 3 3-3m-8 8-3 3m8-3 3 3M3 6.5h7m4 0h7M3 17.5h7m4 0h7" },
  fire: { label: "Fires & grills", path: "M12 22a7 7 0 0 0 7-7c0-4-3-6-4-10-2 2-3 4-3 6-1-1-2-2-2-4-2 2-5 5-5 8a7 7 0 0 0 7 7Zm0 0a3 3 0 0 0 3-3c0-2-1.5-3-3-5-1.5 2-3 3-3 5a3 3 0 0 0 3 3Z" },
  fishing: { label: "Fishing", path: "M2.5 12s4-6 10.5-6c4 0 7 3 8.5 6-1.5 3-4.5 6-8.5 6-6.5 0-10.5-6-10.5-6Zm0 0L1 8.5M2.5 12 1 15.5M16 10.5h.01" },
  bikes: { label: "Bikes & scooters", path: "M5.5 18.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm13 0a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM5.5 15l4-7h6l3 7M9.5 8 8 5H6m6.5 10 3-7" },
  smoking: { label: "Smoking & vaping", path: "M2 15h14v3H2zm17 0v3m3-3v3M16 11c0-2-2-2-2-4m5 4c0-2-2-2-2-4" },
  swimming: { label: "Swimming", path: "M2 18c2 0 2-1.5 4-1.5s2 1.5 4 1.5 2-1.5 4-1.5 2 1.5 4 1.5 2-1.5 4-1.5M2 13c2 0 2-1.5 4-1.5s2 1.5 4 1.5 2-1.5 4-1.5 2 1.5 4 1.5 2-1.5 4-1.5M16 7.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM7 10l4-4 3 3" },
  noise: { label: "Sound & music", path: "M11 5 6 9H3v6h3l5 4V5Zm4.5 3.5a5 5 0 0 1 0 7m2.5-10a9 9 0 0 1 0 13" },
  general: { label: "General", path: "M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6l-8-3Zm0 5v5m0 3h.01" },
};

const topicOptions = (Object.keys(topics) as Topic[]).map((value) => ({ label: topics[value].label, value }));

const lines = (value: string | undefined) =>
  (value ?? "")
    .split("\n")
    .map((l) => l.trim())
    .filter(Boolean);

export const parkRulesBlock: ComponentConfig<ParkRulesProps> = {
  label: "Park Rules",
  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." } },
    hoursLabel: { type: "text", label: "Hours heading", metadata: { help: "Like Park hours. Leave blank to hide the hours panel." } },
    hours: {
      type: "textarea",
      label: "Hours",
      metadata: { help: "One line per place, written as Place | Hours. Like Nature preserves | Dawn to dusk." },
    },
    hoursNote: { type: "text", label: "Hours note", metadata: { help: "Like Parking lots close 30 minutes after the park. Leave blank to hide it." } },
    groups: {
      type: "array",
      label: "Rule groups",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.title || topics[item?.topic]?.label || "Rule group",
      defaultItemProps: { topic: "general", title: "", rules: "", ordinance: "", ordinanceHref: "" },
      arrayFields: {
        topic: { type: "select", label: "Icon", options: topicOptions, metadata: { help: "Picks the icon. Also used as the title if you leave Title blank." } },
        title: { type: "text", label: "Title", metadata: { help: "Leave blank to use the icon's name." } },
        rules: { type: "textarea", label: "Rules", metadata: { help: "One rule per line, in plain words. Each line becomes a list item." } },
        ordinance: { type: "text", label: "Ordinance reference", metadata: { help: "Like Ordinance 4.12. Leave blank to hide it." } },
        ordinanceHref: { type: "text", label: "Ordinance link", metadata: { help: "Links the reference to the full text. Leave blank for plain text." } },
      },
    },
    reportHeading: { type: "text", label: "Report heading", metadata: { help: "Like Report a violation. Leave blank to hide the panel." } },
    reportText: { type: "textarea", label: "Report details" },
    reportPhone: { type: "text", label: "Phone", metadata: { help: "Shown as a tap-to-call link." } },
    reportEmail: { type: "text", label: "Email" },
    reportLabel: { type: "text", label: "Report button text", metadata: { help: "Like Report online. Leave blank to hide the button." } },
    reportHref: { type: "text", label: "Report link" },
    emergencyNote: { type: "text", label: "Emergency note", metadata: { help: "Shown in bold, like For emergencies, call 911. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Park rules and regulations",
    headingLevel: "h2",
    intro: "These rules keep Cedar Valley parks safe, clean and welcoming for everyone. Rangers will usually start with a friendly reminder. Repeat violations can lead to a fine.",
    hoursLabel: "Park hours",
    hours: "Most parks | 6 a.m. to 10 p.m.\nNature preserves | Dawn to dusk\nHillcrest Dog Park | 6 a.m. to 9 p.m.\nCedar Run Sports Complex | 7 a.m. to 11 p.m.",
    hoursNote: "Parking lots close 30 minutes after the park.",
    groups: [
      {
        topic: "dogs",
        title: "",
        rules: "Keep dogs on a leash 6 feet or shorter, except inside fenced off-leash areas.\nPick up after your dog. Free bags are at most park entrances.\nDogs aren't allowed on playgrounds, splash pads or athletic fields.",
        ordinance: "Ordinance 4.12",
        ordinanceHref: "/code/4-12",
      },
      {
        topic: "alcohol",
        title: "",
        rules: "Alcohol is allowed only in reserved shelters with an approved permit.\nNo glass containers anywhere in the parks.",
        ordinance: "Ordinance 4.20",
        ordinanceHref: "/code/4-20",
      },
      {
        topic: "drones",
        title: "",
        rules: "Recreational drones may fly only at the Cedar Run model field.\nDon't fly over people, wildlife areas or events.\nCommercial filming needs a permit.",
        ordinance: "Ordinance 4.31",
        ordinanceHref: "/code/4-31",
      },
      {
        topic: "fire",
        title: "",
        rules: "Use park grills or your own grill set on a hard surface. No ground fires.\nDump hot coals only in the red coal bins.\nFires are banned when a burn ban is in effect.",
        ordinance: "Ordinance 4.15",
        ordinanceHref: "/code/4-15",
      },
      {
        topic: "fishing",
        title: "",
        rules: "Anglers 16 and older need a state fishing license.\nHeron Lake is catch and release only.\nNo fishing from bridges or boat docks.",
        ordinance: "",
        ordinanceHref: "",
      },
      {
        topic: "smoking",
        title: "",
        rules: "Smoking and vaping are not allowed within 25 feet of playgrounds, shelters, restrooms or building entrances.",
        ordinance: "Ordinance 4.08",
        ordinanceHref: "/code/4-08",
      },
    ],
    reportHeading: "Report a violation",
    reportText: "Call the park ranger line, 7 days a week from 7 a.m. to 10 p.m., or report online any time. Include the park name and what you saw.",
    reportPhone: "(555) 555-0147",
    reportEmail: "rangers@cedarvalleyparks.example.org",
    reportLabel: "Report online",
    reportHref: "/report",
    emergencyNote: "For an emergency or a crime in progress, call 911.",
  },
  render: ({ id, heading, headingLevel, intro, hoursLabel, hours, hoursNote, groups, reportHeading, reportText, reportPhone, reportEmail, reportLabel, reportHref, emergencyNote }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const baseId = id || "park-rules";
    const hourRows = lines(hours).map((l) => {
      const [place, ...rest] = l.split("|");
      return { place: place.trim(), time: rest.join("|").trim() };
    });
    const list = (groups ?? [])
      .map((g) => ({ ...g, icon: topics[g?.topic] ?? topics.general, items: lines(g?.rules) }))
      .filter((g) => g.items.length);
    const hasHeader = Boolean(heading || intro);
    const hasHours = Boolean(hoursLabel && hourRows.length);
    const hasReport = Boolean(reportHeading && (reportText || reportPhone || reportEmail || reportLabel || emergencyNote));
    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-6xl">
          {hasHeader || hasHours ? (
            <div className="grid grid-cols-1 gap-8 lg:grid-cols-5 lg:gap-12">
              {hasHeader ? (
                <div className={hasHours ? "lg:col-span-3" : "max-w-2xl lg:col-span-5"}>
                  {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 max-w-2xl text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
                </div>
              ) : null}
              {hasHours ? (
                <div className={`rounded-2xl bg-neutral-50 p-5 ring-1 ring-neutral-200 sm:p-6 ${hasHeader ? "lg:col-span-2" : "lg:col-span-5 lg:max-w-xl"}`}>
                  <Sub className="flex items-center gap-2 text-base font-semibold text-neutral-950">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-700">
                      <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>
                    {hoursLabel}
                  </Sub>
                  <dl className="mt-4 divide-y divide-neutral-200 text-sm leading-6">
                    {hourRows.map((row, i) => (
                      <div key={i} className="flex flex-wrap justify-between gap-x-4 py-2 first:pt-0">
                        <dt className="text-neutral-700">{row.place}</dt>
                        {row.time ? <dd className="font-semibold text-neutral-950 tabular-nums">{row.time}</dd> : null}
                      </div>
                    ))}
                  </dl>
                  {hoursNote ? <p className="mt-3 border-t border-neutral-200 pt-3 text-sm leading-6 text-pretty text-neutral-600">{hoursNote}</p> : null}
                </div>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-x-10 gap-y-10 md:grid-cols-2 ${hasHeader || hasHours ? "mt-12 sm:mt-16" : ""}`}>
              {list.map((g, i) => (
                <li key={`${g.topic}-${i}`} className="flex gap-4 border-t border-neutral-200 pt-6">
                  <span aria-hidden="true" className="grid size-11 shrink-0 place-items-center rounded-xl bg-indigo-50 text-indigo-700 ring-1 ring-indigo-600/15">
                    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" className="size-6">
                      <path d={g.icon.path} />
                    </svg>
                  </span>
                  <div className="min-w-0 flex-1">
                    <Sub className="pt-2 text-lg leading-7 font-semibold text-neutral-950">{g.title || g.icon.label}</Sub>
                    <ul role="list" className="mt-3 space-y-2.5">
                      {g.items.map((rule, j) => (
                        <li key={j} className="flex gap-3 text-sm leading-6 text-pretty text-neutral-700">
                          <span aria-hidden="true" className="mt-2.5 h-px w-3 shrink-0 bg-neutral-400" />
                          <span className="min-w-0">{rule}</span>
                        </li>
                      ))}
                    </ul>
                    {g.ordinance ? (
                      <p className="mt-3 text-xs leading-5 text-neutral-600">
                        {g.ordinanceHref ? (
                          <a
                            href={g.ordinanceHref}
                            className={`inline-flex min-h-11 items-center gap-1.5 rounded font-medium text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}
                          >
                            <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-3.5 shrink-0">
                              <path fillRule="evenodd" d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm1 5.75A.75.75 0 0 1 5.75 7h4.5a.75.75 0 0 1 0 1.5h-4.5A.75.75 0 0 1 5 7.75Zm0 3a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z" clipRule="evenodd" />
                            </svg>
                            {g.ordinance}
                            <span className="sr-only"> ({g.title || g.icon.label})</span>
                          </a>
                        ) : (
                          <span className="font-medium">{g.ordinance}</span>
                        )}
                      </p>
                    ) : null}
                  </div>
                </li>
              ))}
            </ul>
          ) : null}

          {hasReport ? (
            <aside
              aria-labelledby={`${baseId}-report`}
              className="mt-14 grid grid-cols-1 gap-6 rounded-2xl bg-neutral-900 p-6 text-white sm:p-8 lg:grid-cols-3 lg:items-center lg:gap-10"
            >
              <div className="lg:col-span-2">
                <p id={`${baseId}-report`} className="flex items-center gap-2.5 text-lg font-semibold">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-300">
                    <path d="M3.5 2.75a.75.75 0 0 0-1.5 0v14.5a.75.75 0 0 0 1.5 0v-4.392l1.657-.348a6.449 6.449 0 0 1 4.271.572 7.948 7.948 0 0 0 5.965.524l2.078-.64A.75.75 0 0 0 18 12.25v-8.5a.75.75 0 0 0-.904-.734l-2.38.501a7.25 7.25 0 0 1-4.186-.363l-.502-.2a8.75 8.75 0 0 0-5.053-.439l-1.475.31V2.75Z" />
                  </svg>
                  {reportHeading}
                </p>
                {reportText ? <p className="mt-2 max-w-2xl text-sm leading-6 text-pretty text-neutral-300">{reportText}</p> : null}
                {reportPhone || reportEmail ? (
                  <p className="mt-2 flex flex-col text-sm font-semibold sm:flex-row sm:flex-wrap sm:gap-x-6">
                    {reportPhone ? (
                      <a
                        href={`tel:${reportPhone.replace(/[^\d+]/g, "")}`}
                        className="inline-flex min-h-11 items-center self-start rounded text-white underline decoration-indigo-300 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                      >
                        {reportPhone}
                      </a>
                    ) : null}
                    {reportEmail ? (
                      <a
                        href={`mailto:${reportEmail}`}
                        className="inline-flex min-h-11 items-center self-start rounded break-all text-white underline decoration-indigo-300 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                      >
                        {reportEmail}
                      </a>
                    ) : null}
                  </p>
                ) : null}
              </div>
              {reportLabel || emergencyNote ? (
                <div className="flex flex-col gap-4 lg:items-end lg:text-right">
                  {reportLabel ? (
                    <a
                      href={reportHref || "#"}
                      className="inline-flex min-h-11 items-center justify-center rounded-lg bg-white px-5 py-2.5 text-sm font-semibold text-neutral-950 shadow-sm transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                    >
                      {reportLabel}
                    </a>
                  ) : null}
                  {emergencyNote ? <p className="text-sm leading-6 font-semibold text-pretty text-white">{emergencyNote}</p> : null}
                </div>
              ) : null}
            </aside>
          ) : null}
        </div>
      </section>
    );
  },
};
```
