# Add the "Lunch Menu" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/lunch-menu) to this Pantheon Content Publisher (P1) Next.js project. A week of school lunches by day with sides, vegetarian options and allergen badges, plus a free meals application link.

## Steps

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

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

/**
 * Lunch Menu — a week of school lunches by day (entrée, sides, vegetarian option) with
 * allergens as text badges, plus free and reduced-price meal and nutrition links.
 * Register: `LunchMenuBlock: lunchMenuBlock` in puck.config.tsx.
 */

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

type Day = { day: string; date: string; entree: string; sides: string; vegetarian: string; allergens: string };

export type LunchMenuProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  weekOf: string;
  days: Day[];
  allergenNote: string;
  mealsHeading: string;
  mealsText: string;
  mealsLabel: string;
  mealsHref: string;
  nutritionLabel: string;
  nutritionHref: string;
};

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

const arrow =
  "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";
const sparkle =
  "M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684Z";

const splitList = (raw: string) =>
  (raw || "")
    .split(/[,\n]/)
    .map((s) => s.trim())
    .filter(Boolean);

export const lunchMenuBlock: ComponentConfig<LunchMenuProps> = {
  label: "Lunch Menu",
  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." } },
    weekOf: { type: "text", label: "Week", metadata: { help: "Like \"Week of October 12, 2026\". Leave blank to hide it." } },
    days: {
      type: "array",
      label: "Days",
      min: 1,
      max: 7,
      getItemSummary: (item) => (item?.day ? `${item.day}${item.entree ? ` · ${item.entree}` : ""}` : "Day"),
      defaultItemProps: { day: "Monday", date: "", entree: "", sides: "", vegetarian: "", allergens: "" },
      arrayFields: {
        day: { type: "text", label: "Day" },
        date: { type: "text", label: "Date", metadata: { help: "Like \"Oct 12\". Leave blank to hide it." } },
        entree: { type: "text", label: "Main dish", metadata: { help: "Write \"No school\" on days off." } },
        sides: { type: "textarea", label: "Sides", metadata: { help: "Separate with commas." } },
        vegetarian: { type: "text", label: "Vegetarian option", metadata: { help: "Leave blank to hide it." } },
        allergens: { type: "text", label: "Allergens", metadata: { help: "Separate with commas, like \"Milk, Wheat, Soy\"." } },
      },
    },
    allergenNote: { type: "textarea", label: "Allergy note", metadata: { help: "Leave blank to hide it." } },
    mealsHeading: { type: "text", label: "Meal help heading", metadata: { help: "Leave blank to hide the meal help card." } },
    mealsText: { type: "textarea", label: "Meal help text" },
    mealsLabel: { type: "text", label: "Application link text" },
    mealsHref: { type: "text", label: "Application link" },
    nutritionLabel: { type: "text", label: "Nutrition link text", metadata: { help: "Leave blank to hide the link." } },
    nutritionHref: { type: "text", label: "Nutrition link" },
  },
  defaultProps: {
    heading: "What's for lunch",
    headingLevel: "h2",
    intro: "Every lunch comes with milk and a fruit and vegetable bar. Menus can change when deliveries do.",
    weekOf: "Week of October 12, 2026",
    days: [
      { day: "Monday", date: "Oct 12", entree: "Chicken tenders with honey mustard", sides: "Roasted sweet potatoes, Green beans, Apple slices", vegetarian: "Cheese quesadilla", allergens: "Wheat, Milk, Egg" },
      { day: "Tuesday", date: "Oct 13", entree: "Beef and bean tacos", sides: "Spanish rice, Corn salsa, Orange wedges", vegetarian: "Black bean tacos", allergens: "Wheat, Milk" },
      { day: "Wednesday", date: "Oct 14", entree: "Whole-grain cheese pizza", sides: "Caesar side salad, Baby carrots, Pears", vegetarian: "Same as main dish", allergens: "Wheat, Milk, Soy" },
      { day: "Thursday", date: "Oct 15", entree: "Turkey and cheese sub", sides: "Tomato soup, Cucumber coins, Grapes", vegetarian: "Hummus and veggie wrap", allergens: "Wheat, Milk, Sesame" },
      { day: "Friday", date: "Oct 16", entree: "Teriyaki chicken rice bowl", sides: "Steamed broccoli, Edamame, Pineapple", vegetarian: "Teriyaki tofu rice bowl", allergens: "Wheat, Soy" },
    ],
    allergenNote:
      "Have a child with a food allergy? Ask your doctor to fill out a Special Diet form and send it to Nutrition Services. Kitchens can't promise any food is free of allergens.",
    mealsHeading: "Free and reduced-price meals",
    mealsText: "Many families qualify, and the form takes about 10 minutes. Apply any time during the school year. Your answers stay private.",
    mealsLabel: "Apply for meal benefits",
    mealsHref: "/nutrition/apply",
    nutritionLabel: "Nutrition and ingredient details",
    nutritionHref: "/nutrition/menus",
  },
  render: ({ id, heading, headingLevel, intro, weekOf, days, allergenNote, mealsHeading, mealsText, mealsLabel, mealsHref, nutritionLabel, nutritionHref }) => {
    const H = headingLevel || "h2";
    const Sub = lower[H] || "h3";
    const uid = id || "lunch-menu";
    const list = (days ?? []).filter((d) => d?.day || d?.entree);
    const showMeals = Boolean(mealsHeading || mealsText || mealsLabel);

    return (
      <section aria-labelledby={heading ? `${uid}-heading` : undefined} 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">
          <div className="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between sm:gap-8">
            {heading || intro ? (
              <div className="max-w-2xl">
                {heading ? (
                  <H id={`${uid}-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>
            ) : null}
            {weekOf ? <p className="shrink-0 text-sm font-semibold text-indigo-700">{weekOf}</p> : null}
          </div>

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5 ${heading || intro || weekOf ? "mt-10" : ""}`}>
              {list.map((d, i) => {
                const sides = splitList(d.sides);
                const allergens = splitList(d.allergens);
                return (
                  <li key={`${d.day}-${i}`} className="flex min-w-0 flex-col rounded-2xl bg-white p-5 shadow-xs ring-1 ring-neutral-950/5">
                    <Sub className="flex items-baseline justify-between gap-3 border-b border-neutral-100 pb-3">
                      <span className="text-base font-semibold text-neutral-950">{d.day}</span>
                      {d.date ? <span className="text-sm font-medium text-neutral-500 tabular-nums">{d.date}</span> : null}
                    </Sub>
                    {d.entree ? <p className="mt-4 text-lg leading-snug font-semibold text-balance text-neutral-950">{d.entree}</p> : null}
                    {sides.length ? (
                      <div className="mt-3">
                        <p className="text-xs font-semibold tracking-wide text-neutral-500 uppercase">Sides</p>
                        <ul role="list" className="mt-1 space-y-0.5 text-sm leading-6 text-neutral-700">
                          {sides.map((s, j) => (
                            <li key={j}>{s}</li>
                          ))}
                        </ul>
                      </div>
                    ) : null}
                    {d.vegetarian ? (
                      <p className="mt-4 flex gap-2 rounded-lg bg-indigo-50 px-3 py-2 text-sm leading-6 text-indigo-950">
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-1 size-4 shrink-0 text-indigo-700">
                          <path d={sparkle} />
                        </svg>
                        <span>
                          <span className="font-semibold">Vegetarian: </span>
                          {d.vegetarian}
                        </span>
                      </p>
                    ) : null}
                    {allergens.length ? (
                      <div className="mt-auto flex flex-wrap items-center gap-x-2 gap-y-1.5 pt-4">
                        <p className="text-xs font-medium text-neutral-600">Contains:</p>
                        <ul role="list" className="flex flex-wrap gap-1.5">
                          {allergens.map((a, j) => (
                            <li key={j} className="rounded-md bg-white px-2 py-0.5 text-xs font-medium text-neutral-800 ring-1 ring-neutral-300 ring-inset">
                              {a}
                            </li>
                          ))}
                        </ul>
                      </div>
                    ) : null}
                  </li>
                );
              })}
            </ul>
          ) : null}

          {allergenNote || showMeals || nutritionLabel ? (
            <div className="mt-10 grid grid-cols-1 gap-6 lg:grid-cols-2 lg:items-start">
              <div className="space-y-4">
                {allergenNote ? (
                  <p className="flex gap-3 text-sm leading-6 text-pretty text-neutral-700">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-neutral-500">
                      <path
                        fillRule="evenodd"
                        d="M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z"
                        clipRule="evenodd"
                      />
                    </svg>
                    <span>{allergenNote}</span>
                  </p>
                ) : null}
                {nutritionLabel ? (
                  <a
                    href={nutritionHref || "#"}
                    className="group inline-flex min-h-11 items-center gap-1.5 rounded-lg text-sm font-semibold text-indigo-700 hover:text-indigo-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-700"
                  >
                    {nutritionLabel}
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 transition motion-safe:group-hover:translate-x-0.5">
                      <path fillRule="evenodd" d={arrow} clipRule="evenodd" />
                    </svg>
                  </a>
                ) : null}
              </div>
              {showMeals ? (
                <div className="rounded-2xl bg-indigo-700 p-6 text-white sm:p-8">
                  {mealsHeading ? <p className="text-lg font-semibold">{mealsHeading}</p> : null}
                  {mealsText ? <p className="mt-2 text-sm leading-6 text-pretty text-indigo-100">{mealsText}</p> : null}
                  {mealsLabel ? (
                    <a
                      href={mealsHref || "#"}
                      className="group mt-5 inline-flex min-h-11 items-center gap-2 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-indigo-800 shadow-sm transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                    >
                      {mealsLabel}
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 transition motion-safe:group-hover:translate-x-0.5">
                        <path fillRule="evenodd" d={arrow} clipRule="evenodd" />
                      </svg>
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
