# Add the "Dining Guide" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/dining-guide) to this Pantheon Content Publisher (P1) Next.js project. Restaurants grouped by cuisine with price bands, dietary options, hours, menu links and a Locally owned badge.

## Steps

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

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

/**
 * Dining Guide — restaurants grouped by cuisine, each with neighborhood, price band,
 * dietary options, hours, a "Locally owned" badge and a menu link, under a photo-led intro.
 * Register: `DiningGuideBlock: diningGuideBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Price = "1" | "2" | "3" | "4";

export type DiningGuideProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  imageUrl: string;
  imageAlt: string;
  restaurants: {
    name: string;
    cuisine: string;
    neighborhood: string;
    price: Price;
    description: string;
    dietary: string;
    locallyOwned: boolean;
    hours: string;
    linkLabel: string;
    linkHref: string;
  }[];
  footnote: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };
const grandchildHeading: Record<Heading, "h3" | "h4" | "h5" | "h6"> = { h1: "h3", h2: "h4", h3: "h5", h4: "h6" };

const PRICE_WORDS: Record<Price, string> = { "1": "Inexpensive", "2": "Moderate", "3": "Pricey", "4": "Very expensive" };
const FOCUS = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";
const ARROW = "M2 8a.75.75 0 0 1 .75-.75h8.69L8.22 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H2.75A.75.75 0 0 1 2 8Z";

const splitTags = (raw: string) => (raw || "").split(",").map((t) => t.trim()).filter(Boolean);
const slugify = (s: string) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "other";

export const diningGuideBlock: ComponentConfig<DiningGuideProps> = {
  label: "Dining Guide",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading. 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. Cuisines use the next level down, restaurant names the level after." },
    },
    intro: { type: "textarea", label: "Intro" },
    imageUrl: { type: "text", label: "Image URL", metadata: { help: "Optional photo beside the intro. Leave blank to hide it." } },
    imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for screen reader users. Leave blank only if it's purely decorative." } },
    restaurants: {
      type: "array",
      label: "Restaurants",
      min: 1,
      max: 30,
      getItemSummary: (item) => `${item?.name || "Restaurant"}${item?.cuisine ? ` · ${item.cuisine}` : ""}`,
      defaultItemProps: {
        name: "New restaurant",
        cuisine: "American",
        neighborhood: "",
        price: "2",
        description: "",
        dietary: "",
        locallyOwned: true,
        hours: "",
        linkLabel: "See the menu",
        linkHref: "#",
      },
      arrayFields: {
        name: { type: "text", label: "Name" },
        cuisine: { type: "text", label: "Cuisine", metadata: { help: "Restaurants with the same cuisine (spelled the same way) are grouped together, in the order they first appear." } },
        neighborhood: { type: "text", label: "Neighborhood" },
        price: {
          type: "select",
          label: "Price band",
          options: [
            { label: "$ (inexpensive)", value: "1" },
            { label: "$$ (moderate)", value: "2" },
            { label: "$$$ (pricey)", value: "3" },
            { label: "$$$$ (very expensive)", value: "4" },
          ],
        },
        description: { type: "textarea", label: "Description", metadata: { help: "One sentence on what to order. Leave blank to hide it." } },
        dietary: { type: "text", label: "Dietary options", metadata: { help: "Comma separated, like “Vegetarian, Gluten-free options, Vegan”." } },
        locallyOwned: {
          type: "radio",
          label: "Locally owned",
          options: [
            { label: "Yes", value: true },
            { label: "No", value: false },
          ],
        },
        hours: { type: "text", label: "Hours", metadata: { help: "A short summary, like “Tue–Sun, 11 AM–9 PM”." } },
        linkLabel: { type: "text", label: "Link text", metadata: { help: "Like “See the menu”. Leave blank to hide it." } },
        linkHref: { type: "text", label: "Link" },
      },
    },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Small print under the guide. Leave blank to hide it." } },
  },
  defaultProps: {
    eyebrow: "Eat & drink",
    heading: "Where Riverbend eats",
    headingLevel: "h2",
    intro: "Smoke on the levee, bread from a 100-year-old oven and tacos worth crossing the river for. Most of our favorites are locally owned, and we've marked them.",
    imageUrl: "https://picsum.photos/seed/riverbend-dining/1200/900",
    imageAlt: "A chef plating food at the pass of a busy open kitchen",
    restaurants: [
      {
        name: "Levee Smokehouse",
        cuisine: "Barbecue",
        neighborhood: "Riverfront",
        price: "2",
        description: "Hickory-smoked brisket and burnt ends, sold until they're gone.",
        dietary: "Gluten-free options",
        locallyOwned: true,
        hours: "Wed–Sun, 11 AM–sold out",
        linkLabel: "See the menu",
        linkHref: "https://leveesmokehouse.example.org",
      },
      {
        name: "Pit & Porch",
        cuisine: "Barbecue",
        neighborhood: "Old Mill",
        price: "2",
        description: "Smoked chicken, mac and cheese and a big porch with live music on weekends.",
        dietary: "Vegetarian sides",
        locallyOwned: true,
        hours: "Daily, 11 AM–9 PM",
        linkLabel: "See the menu",
        linkHref: "https://pitandporch.example.org",
      },
      {
        name: "Casa Ribera",
        cuisine: "Mexican",
        neighborhood: "Eastside",
        price: "1",
        description: "Hand-pressed tortillas, al pastor off the trompo and a weekend menudo.",
        dietary: "Vegetarian, Gluten-free options",
        locallyOwned: true,
        hours: "Daily, 10 AM–10 PM",
        linkLabel: "See the menu",
        linkHref: "https://casaribera.example.org",
      },
      {
        name: "The Ferry House Dining Room",
        cuisine: "New American",
        neighborhood: "Downtown",
        price: "4",
        description: "A seasonal tasting menu built on Riverbend Valley farms, in the hotel's 1891 dining room.",
        dietary: "Vegetarian, Vegan on request, Gluten-free options",
        locallyOwned: false,
        hours: "Thu–Sat, 5:30–10 PM",
        linkLabel: "Reserve a table",
        linkHref: "https://ferryhouse.example.org/dining",
      },
      {
        name: "Millstone Kitchen",
        cuisine: "New American",
        neighborhood: "Old Mill",
        price: "3",
        description: "Wood-fired vegetables and river trout beside the old water wheel.",
        dietary: "Vegetarian, Gluten-free options",
        locallyOwned: true,
        hours: "Tue–Sun, 5–10 PM; brunch Sat–Sun",
        linkLabel: "See the menu",
        linkHref: "https://millstonekitchen.example.org",
      },
      {
        name: "Bend Street Bakery",
        cuisine: "Bakery & café",
        neighborhood: "Market Square",
        price: "1",
        description: "Sorghum biscuits, laminated pastries and pour-over from a local roaster.",
        dietary: "Vegan options",
        locallyOwned: true,
        hours: "Daily, 7 AM–2 PM",
        linkLabel: "See the menu",
        linkHref: "https://bendstreetbakery.example.org",
      },
    ],
    footnote: "Hours change seasonally. Call ahead or check each restaurant's website before you go.",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, imageUrl, imageAlt, restaurants, footnote }) => {
    const H = headingLevel || "h2";
    const CuisineH = childHeading[H] ?? "h3";
    const NameH = grandchildHeading[H] ?? "h4";
    const uid = id || "dining";
    const all = (restaurants ?? []).filter((r) => r?.name);
    const groups: { cuisine: string; items: typeof all }[] = [];
    for (const r of all) {
      const key = (r.cuisine || "More favorites").trim();
      const found = groups.find((g) => g.cuisine.toLowerCase() === key.toLowerCase());
      if (found) found.items.push(r);
      else groups.push({ cuisine: key, items: [r] });
    }
    const hasHeader = Boolean(eyebrow || heading || intro || imageUrl);
    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="grid grid-cols-1 gap-10 lg:grid-cols-12 lg:items-end lg:gap-12">
              <div className={imageUrl ? "lg:col-span-6" : "lg:col-span-8"}>
                {eyebrow ? <p className="text-sm font-semibold tracking-widest text-indigo-700 uppercase">{eyebrow}</p> : null}
                {heading ? <H className={`${eyebrow ? "mt-3" : ""} text-4xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-6xl`}>{heading}</H> : null}
                {intro ? <p className="mt-6 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
                {groups.length > 1 ? (
                  <nav aria-label="Cuisines" className="mt-8">
                    <ul role="list" className="flex flex-wrap gap-x-5 gap-y-1">
                      {groups.map((g) => (
                        <li key={g.cuisine}>
                          <a
                            href={`#${uid}-${slugify(g.cuisine)}`}
                            className={`inline-flex min-h-11 items-center rounded-sm text-sm font-semibold text-neutral-900 underline decoration-neutral-300 underline-offset-4 hover:decoration-indigo-600 ${FOCUS}`}
                          >
                            {g.cuisine}
                          </a>
                        </li>
                      ))}
                    </ul>
                  </nav>
                ) : null}
              </div>
              {imageUrl ? (
                <div className="lg:col-span-6">
                  <img src={imageUrl} alt={imageAlt || ""} className="aspect-3/2 w-full rounded-3xl bg-neutral-200 object-cover" />
                </div>
              ) : null}
            </div>
          ) : null}

          <div className="mt-14 space-y-14 sm:mt-20 sm:space-y-16">
            {groups.map((g) => (
              <section key={g.cuisine} id={`${uid}-${slugify(g.cuisine)}`} aria-labelledby={`${uid}-${slugify(g.cuisine)}-h`} className="grid scroll-mt-24 grid-cols-1 gap-6 lg:grid-cols-4 lg:gap-12">
                <div className="border-t-2 border-neutral-950 pt-4">
                  <CuisineH id={`${uid}-${slugify(g.cuisine)}-h`} className="text-2xl font-semibold tracking-tight text-neutral-950">
                    {g.cuisine}
                  </CuisineH>
                  <p className="mt-1 text-sm text-neutral-600 tabular-nums">
                    {g.items.length} {g.items.length === 1 ? "spot" : "spots"}
                  </p>
                </div>
                <ul role="list" className="grid grid-cols-1 gap-x-10 border-t border-neutral-200 sm:grid-cols-2 lg:col-span-3">
                  {g.items.map((r, i) => {
                    const price: Price = PRICE_WORDS[r.price] ? r.price : "2";
                    const tags = splitTags(r.dietary);
                    return (
                      <li key={`${r.name}-${i}`} className="flex flex-col border-b border-neutral-200 py-6">
                        <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
                          <NameH className="text-lg font-semibold tracking-tight text-neutral-950">{r.name}</NameH>
                          {r.locallyOwned ? (
                            <span className="inline-flex items-center gap-1 rounded-full bg-indigo-50 px-2.5 py-0.5 text-xs font-semibold text-indigo-800 ring-1 ring-indigo-200">
                              <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-3.5">
                                <path d="M8.543 2.232a.75.75 0 0 0-1.085 0l-5.25 5.5A.75.75 0 0 0 2.75 9H4v4a1 1 0 0 0 1 1h1.5a.5.5 0 0 0 .5-.5v-2a1 1 0 0 1 2 0v2a.5.5 0 0 0 .5.5H11a1 1 0 0 0 1-1V9h1.25a.75.75 0 0 0 .543-1.268l-5.25-5.5Z" />
                              </svg>
                              Locally owned
                            </span>
                          ) : null}
                        </div>
                        <p className="mt-1 text-sm text-neutral-600">
                          <span className="font-semibold text-neutral-900">
                            <span aria-hidden="true">{"$".repeat(Number(price))}</span>
                            <span className="sr-only">{PRICE_WORDS[price]}</span>
                          </span>
                          {r.neighborhood ? (
                            <>
                              <span aria-hidden="true" className="mx-2 text-neutral-300">/</span>
                              <span className="sr-only">, </span>
                              {r.neighborhood}
                            </>
                          ) : null}
                        </p>
                        {r.description ? <p className="mt-3 text-base leading-7 text-pretty text-neutral-700">{r.description}</p> : null}
                        {tags.length > 0 ? (
                          <ul role="list" aria-label="Dietary options" className="mt-3 flex flex-wrap gap-1.5">
                            {tags.map((t, k) => (
                              <li key={`${t}-${k}`} className="rounded-md bg-neutral-100 px-2 py-1 text-xs font-medium text-neutral-700">
                                {t}
                              </li>
                            ))}
                          </ul>
                        ) : null}
                        <div className="mt-auto flex flex-wrap items-center justify-between gap-x-4 gap-y-1 pt-4">
                          {r.hours ? (
                            <p className="flex items-center gap-1.5 text-sm text-neutral-600">
                              <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-4 shrink-0 text-neutral-400">
                                <path fillRule="evenodd" d="M1 8a7 7 0 1 1 14 0A7 7 0 0 1 1 8Zm7.75-4.25a.75.75 0 0 0-1.5 0V8c0 .414.336.75.75.75h3.25a.75.75 0 0 0 0-1.5h-2.5v-3.5Z" clipRule="evenodd" />
                              </svg>
                              <span className="sr-only">Hours: </span>
                              {r.hours}
                            </p>
                          ) : null}
                          {r.linkLabel ? (
                            <a
                              href={r.linkHref || "#"}
                              className={`group inline-flex min-h-11 items-center gap-1.5 rounded-sm text-sm font-semibold text-indigo-700 hover:text-indigo-900 ${FOCUS}`}
                            >
                              {r.linkLabel}
                              <span className="sr-only">: {r.name}</span>
                              <svg aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" className="size-4 transition group-hover:translate-x-0.5">
                                <path fillRule="evenodd" d={ARROW} clipRule="evenodd" />
                              </svg>
                            </a>
                          ) : null}
                        </div>
                      </li>
                    );
                  })}
                </ul>
              </section>
            ))}
          </div>

          {footnote ? <p className="mt-10 text-sm leading-6 text-neutral-600">{footnote}</p> : null}
        </div>
      </section>
    );
  },
};
```
