# Add the "Public Notices" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/public-notices) to this Pantheon Content Publisher (P1) Next.js project. Legal notices for hearings, zoning, bids and ordinances, with type badges and comment deadlines.

## Steps

1. Create `components/puck/public-notices-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 { publicNoticesBlock } from "./components/puck/public-notices-block";`
3. Register it under `components` as `PublicNoticesBlock: publicNoticesBlock`.
4. Add `"PublicNoticesBlock"` 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/public-notices-block.tsx`

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

/**
 * Public Notices — legal notices, hearings, bids and ordinances with the comment deadline
 * pulled forward. Notice type is a text badge, never color alone.
 * Register: `PublicNoticesBlock: publicNoticesBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type NoticeType = "hearing" | "zoning" | "bid" | "ordinance" | "election" | "general";

export type PublicNoticesProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  notices: {
    type: NoticeType;
    title: string;
    posted: string;
    deadline: string;
    deadlineIso: string;
    href: string;
  }[];
  subscribeLabel: string;
  subscribeHref: string;
  archiveLabel: string;
  archiveHref: string;
};

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

const typeLabels: Record<NoticeType, string> = {
  hearing: "Public hearing",
  zoning: "Zoning",
  bid: "Bid",
  ordinance: "Ordinance",
  election: "Election",
  general: "Notice",
};

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

export const publicNoticesBlock: ComponentConfig<PublicNoticesProps> = {
  label: "Public Notices",
  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" },
    notices: {
      type: "array",
      label: "Notices",
      min: 1,
      max: 30,
      getItemSummary: (item) => (item?.title ? `${typeLabels[item.type] ?? "Notice"} · ${item.title.slice(0, 40)}` : "Notice"),
      defaultItemProps: { type: "hearing", title: "New notice", posted: "", deadline: "", deadlineIso: "", href: "" },
      arrayFields: {
        type: {
          type: "select",
          label: "Notice type",
          options: [
            { label: "Public hearing", value: "hearing" },
            { label: "Zoning", value: "zoning" },
            { label: "Bid", value: "bid" },
            { label: "Ordinance", value: "ordinance" },
            { label: "Election", value: "election" },
            { label: "General notice", value: "general" },
          ],
        },
        title: { type: "textarea", label: "Title", metadata: { help: "Say what is happening and where, in plain language." } },
        posted: { type: "text", label: "Posted date", metadata: { help: "Free text, like Oct 2, 2026." } },
        deadline: { type: "text", label: "Comment deadline", metadata: { help: "Free text, like Oct 21, 2026 at 5 p.m. Leave blank if there's no comment period." } },
        deadlineIso: { type: "text", label: "Deadline (machine date)", metadata: { help: "Optional. The same date as YYYY-MM-DD, like 2026-10-21, so calendars and search engines can read it." } },
        href: { type: "text", label: "Full notice link", metadata: { help: "Link to the full legal text, usually a PDF." } },
      },
    },
    subscribeLabel: { type: "text", label: "Subscribe link text", metadata: { help: "Leave blank to hide it." } },
    subscribeHref: { type: "text", label: "Subscribe link", metadata: { help: "Your email or text alert sign-up page." } },
    archiveLabel: { type: "text", label: "Archive link text", metadata: { help: "Leave blank to hide it." } },
    archiveHref: { type: "text", label: "Archive link" },
  },
  defaultProps: {
    heading: "Public notices",
    headingLevel: "h2",
    intro: "Legal notices the City of Millbrook is required to publish. You can comment on most of them in writing or in person at the hearing listed in the notice.",
    notices: [
      {
        type: "hearing",
        title: "Planning Commission hearing on the Riverside Corridor Plan",
        posted: "Oct 2, 2026",
        deadline: "Oct 21, 2026 at 5 p.m.",
        deadlineIso: "2026-10-21",
        href: "/notices/riverside-corridor-hearing.pdf",
      },
      {
        type: "zoning",
        title: "Rezoning request: 1420 Elm Street from R-1 to R-2 (two-family)",
        posted: "Sep 30, 2026",
        deadline: "Oct 18, 2026",
        deadlineIso: "2026-10-18",
        href: "/notices/1420-elm-rezoning.pdf",
      },
      {
        type: "bid",
        title: "Invitation to bid: 2027 street resurfacing, Phase 2",
        posted: "Sep 26, 2026",
        deadline: "Bids due Nov 4, 2026 at 2 p.m.",
        deadlineIso: "2026-11-04",
        href: "/notices/bid-2027-resurfacing.pdf",
      },
      {
        type: "ordinance",
        title: "Ordinance 2026-31: Short-term rental registration, first reading",
        posted: "Sep 22, 2026",
        deadline: "",
        deadlineIso: "",
        href: "/notices/ordinance-2026-31.pdf",
      },
    ],
    subscribeLabel: "Get notices by email",
    subscribeHref: "/subscribe/notices",
    archiveLabel: "Past notices",
    archiveHref: "/notices/archive",
  },
  render: ({ heading, headingLevel, intro, notices, subscribeLabel, subscribeHref, archiveLabel, archiveHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (notices ?? []).filter((n) => n?.title);
    const hasHeader = Boolean(heading || intro || subscribeLabel);
    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-5xl">
          {hasHeader ? (
            <div className="flex flex-col gap-6 sm:flex-row sm:items-end sm:justify-between">
              <div className="max-w-2xl">
                {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
                {intro ? <p className="mt-4 text-base leading-7 text-pretty text-neutral-600">{intro}</p> : null}
              </div>
              {subscribeLabel ? (
                <a
                  href={subscribeHref || "#"}
                  className={`inline-flex min-h-11 shrink-0 items-center justify-center gap-2 self-start rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-neutral-900 shadow-sm ring-1 ring-neutral-300 transition ring-inset hover:bg-neutral-50 sm:self-auto ${focusRing}`}
                >
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 text-indigo-600">
                    <path d="M3 4a2 2 0 0 0-2 2v1.161l8.441 4.221a1.25 1.25 0 0 0 1.118 0L19 7.162V6a2 2 0 0 0-2-2H3Z" />
                    <path d="m19 8.839-7.77 3.885a2.75 2.75 0 0 1-2.46 0L1 8.839V14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.839Z" />
                  </svg>
                  {subscribeLabel}
                </a>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`divide-y divide-neutral-200 border-y border-neutral-200 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((notice, i) => {
                const label = typeLabels[notice.type] ?? "Notice";
                return (
                  <li key={`${notice.title}-${i}`} className="group relative py-6 sm:grid sm:grid-cols-12 sm:gap-6">
                    <div className="sm:col-span-8">
                      <p className="flex flex-wrap items-center gap-x-3 gap-y-2 text-sm leading-6 text-neutral-600">
                        <span className="inline-flex items-center rounded-md bg-neutral-100 px-2 py-0.5 text-xs font-semibold tracking-wide text-neutral-800 uppercase ring-1 ring-neutral-300 ring-inset">
                          {label}
                        </span>
                        {notice.posted ? <span>Posted {notice.posted}</span> : null}
                      </p>
                      <Sub className="mt-2 text-lg leading-snug font-semibold text-pretty text-neutral-950">
                        {notice.href ? (
                          <a
                            href={notice.href}
                            className="rounded outline-none group-hover:text-indigo-700 group-hover:underline group-hover:decoration-indigo-300 group-hover:underline-offset-4 after:absolute after:inset-0 focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-indigo-600"
                          >
                            {notice.title}
                          </a>
                        ) : (
                          notice.title
                        )}
                      </Sub>
                    </div>
                    <div className="mt-4 sm:col-span-4 sm:mt-0 sm:flex sm:items-center sm:justify-end">
                      {notice.deadline ? (
                        <p className="inline-flex items-start gap-3 rounded-xl bg-indigo-50 px-4 py-3 text-indigo-950 ring-1 ring-indigo-600/15 ring-inset sm:w-full">
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-600">
                            <path fillRule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clipRule="evenodd" />
                          </svg>
                          <span className="min-w-0 text-sm leading-5">
                            <span className="block font-medium text-indigo-800">{notice.type === "bid" ? "Deadline" : "Comments due"}</span>
                            {notice.deadlineIso ? (
                              <time dateTime={notice.deadlineIso} className="block text-base font-semibold">
                                {notice.deadline}
                              </time>
                            ) : (
                              <span className="block text-base font-semibold">{notice.deadline}</span>
                            )}
                          </span>
                        </p>
                      ) : (
                        <p className="text-sm text-neutral-600">No comment period</p>
                      )}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {archiveLabel ? (
            <p className="mt-6">
              <a
                href={archiveHref || "#"}
                className={`group/arc inline-flex min-h-11 items-center gap-1.5 rounded text-sm font-semibold text-indigo-700 ${focusRing}`}
              >
                {archiveLabel}
                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition group-hover/arc: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>
            </p>
          ) : null}
        </div>
      </section>
    );
  },
};
```
