# Add the "Council Districts" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/council-districts) to this Pantheon Content Publisher (P1) Next.js project. Council districts or wards with neighborhoods covered, each representative's contact details and an address lookup.

## Steps

1. Create `components/puck/council-districts-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 { councilDistrictsBlock } from "./components/puck/council-districts-block";`
3. Register it under `components` as `CouncilDistrictsBlock: councilDistrictsBlock`.
4. Add `"CouncilDistrictsBlock"` 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/council-districts-block.tsx`

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

/**
 * Council Districts — every council district or ward with the neighborhoods it covers, its
 * representative and how to reach them, plus a "find your district" address lookup.
 * Register: `CouncilDistrictsBlock: councilDistrictsBlock` in puck.config.tsx.
 */

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

export type CouncilDistrictsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  districtWord: string;
  lookupHeading: string;
  lookupText: string;
  lookupAction: string;
  lookupParam: string;
  lookupLabel: string;
  lookupPlaceholder: string;
  mapLabel: string;
  mapHref: string;
  districts: {
    number: string;
    neighborhoods: string;
    member: string;
    role: string;
    phone: string;
    email: string;
    href: 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 initials = (name: string) =>
  name
    .replace(/^(Council ?member|Alder(wo)?man|Ald\.|Dr\.|Mr\.|Ms\.|Mrs\.)\s+/i, "")
    .split(/\s+/)
    .filter(Boolean)
    .slice(0, 2)
    .map((w) => w[0]?.toUpperCase())
    .join("");

export const councilDistrictsBlock: ComponentConfig<CouncilDistrictsProps> = {
  label: "Council Districts",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, like City Council. 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." },
    },
    intro: { type: "textarea", label: "Intro", metadata: { help: "Leave blank to hide it." } },
    districtWord: { type: "text", label: "District or ward", metadata: { help: "The word your city uses, like District or Ward. Shown before each number." } },
    lookupHeading: { type: "text", label: "Lookup heading", metadata: { help: "Like Find your district. Leave the lookup page URL blank to hide the whole panel." } },
    lookupText: { type: "textarea", label: "Lookup text", metadata: { help: "One sentence on what people will get. Leave blank to hide it." } },
    lookupAction: { type: "text", label: "Lookup page URL", metadata: { help: "The address search page the form sends people to, like /districts/lookup." } },
    lookupParam: { type: "text", label: "Address query name", metadata: { help: "The URL parameter your lookup page reads, usually address." } },
    lookupLabel: { type: "text", label: "Address label", metadata: { help: "Read aloud and shown above the box, like Your street address." } },
    lookupPlaceholder: { type: "text", label: "Address example text", metadata: { help: "A short example inside the box. Don't put instructions here; they disappear as people type." } },
    mapLabel: { type: "text", label: "Map link text", metadata: { help: "Leave blank to hide the link." } },
    mapHref: { type: "text", label: "Map link", metadata: { help: "A district map page or PDF." } },
    districts: {
      type: "array",
      label: "Districts",
      min: 1,
      max: 15,
      getItemSummary: (item) => (item?.number ? `${item.number} · ${item.member || "Vacant"}` : "District"),
      defaultItemProps: { number: "1", neighborhoods: "", member: "", role: "Council Member", phone: "", email: "", href: "" },
      arrayFields: {
        number: { type: "text", label: "Number", metadata: { help: "Just the number or letter, like 3." } },
        neighborhoods: { type: "textarea", label: "Neighborhoods", metadata: { help: "Separate names with commas. Leave blank to hide them." } },
        member: { type: "text", label: "Representative", metadata: { help: "Full name. Leave blank if the seat is vacant; the card will say so." } },
        role: { type: "text", label: "Title", metadata: { help: "Like Council Member or Council President." } },
        phone: { type: "text", label: "Phone", metadata: { help: "Shown as a tap-to-call link." } },
        email: { type: "text", label: "Email" },
        href: { type: "text", label: "Profile link", metadata: { help: "The representative's page. Leave blank to hide it." } },
      },
    },
  },
  defaultProps: {
    eyebrow: "City Council",
    heading: "Who represents your neighborhood",
    headingLevel: "h2",
    intro: "Millbrook is divided into six council districts. Your council member is your first call for neighborhood concerns, from zoning questions to a streetlight that's been out for weeks.",
    districtWord: "District",
    lookupHeading: "Find your district",
    lookupText: "Enter your home address to see your district, your council member and your polling place.",
    lookupAction: "/council/districts/lookup",
    lookupParam: "address",
    lookupLabel: "Your street address",
    lookupPlaceholder: "e.g. 214 Elm Street",
    mapLabel: "View the district map (PDF)",
    mapHref: "/council/district-map.pdf",
    districts: [
      { number: "1", neighborhoods: "Riverside, Old Mill, Canal Street", member: "Denise Okafor", role: "Council Member", phone: "(555) 555-0111", email: "district1@millbrook.example.gov", href: "/council/district-1" },
      { number: "2", neighborhoods: "Northside, Hillcrest, Fairview Park", member: "Marcus Bell", role: "Council President", phone: "(555) 555-0112", email: "district2@millbrook.example.gov", href: "/council/district-2" },
      { number: "3", neighborhoods: "Downtown, Market Square, Elm Heights", member: "Rosa Delgado", role: "Council Member", phone: "(555) 555-0113", email: "district3@millbrook.example.gov", href: "/council/district-3" },
      { number: "4", neighborhoods: "Westgate, Brookfield, Cedar Run", member: "Tom Nguyen", role: "Council Member", phone: "(555) 555-0114", email: "district4@millbrook.example.gov", href: "/council/district-4" },
      { number: "5", neighborhoods: "Southview, Lakeside, Pine Hollow", member: "Alicia Grant", role: "Council Member", phone: "(555) 555-0115", email: "district5@millbrook.example.gov", href: "/council/district-5" },
      { number: "6", neighborhoods: "Eastwood, Orchard Hill, Millbrook Station", member: "", role: "Council Member", phone: "(555) 555-0116", email: "council@millbrook.example.gov", href: "" },
    ],
  },
  render: ({
    id,
    eyebrow,
    heading,
    headingLevel,
    intro,
    districtWord,
    lookupHeading,
    lookupText,
    lookupAction,
    lookupParam,
    lookupLabel,
    lookupPlaceholder,
    mapLabel,
    mapHref,
    districts,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (districts ?? []).filter((d) => d?.number || d?.member);
    const word = districtWord || "District";
    const baseId = id || "council-districts";
    const hasHeader = Boolean(eyebrow || heading || intro);
    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">
          {hasHeader || lookupAction ? (
            <div className="grid grid-cols-1 gap-10 lg:grid-cols-12 lg:items-end lg:gap-16">
              {hasHeader ? (
                <div className="lg:col-span-6">
                  {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700">{eyebrow}</p> : null}
                  {heading ? (
                    <H id={`${baseId}-heading`} className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${eyebrow ? "mt-2" : ""}`}>
                      {heading}
                    </H>
                  ) : null}
                  {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
                </div>
              ) : null}
              {lookupAction ? (
                <div className="rounded-2xl bg-indigo-950 p-6 text-white shadow-lg sm:p-8 lg:col-span-6">
                  <div className="flex items-start gap-3">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-6 shrink-0 text-indigo-300">
                      <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>
                    <div className="min-w-0">
                      {lookupHeading ? <p className="text-lg font-semibold">{lookupHeading}</p> : null}
                      {lookupText ? <p className="mt-1 text-sm leading-6 text-pretty text-indigo-100">{lookupText}</p> : null}
                    </div>
                  </div>
                  <form action={lookupAction} method="get" className="mt-6">
                    <label htmlFor={`${baseId}-address`} className="block text-sm leading-6 font-semibold text-white">
                      {lookupLabel || "Street address"}
                    </label>
                    <div className="mt-2 flex flex-col gap-2 sm:flex-row">
                      <input
                        id={`${baseId}-address`}
                        type="text"
                        name={lookupParam || "address"}
                        autoComplete="street-address"
                        placeholder={lookupPlaceholder || undefined}
                        className="block min-h-12 w-full min-w-0 flex-1 rounded-lg border-0 bg-white px-4 text-base text-neutral-950 ring-1 ring-white/10 placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-300 focus:outline-none"
                      />
                      <button
                        type="submit"
                        className="inline-flex min-h-12 shrink-0 items-center justify-center gap-2 rounded-lg bg-white px-5 text-base font-semibold text-indigo-950 transition hover:bg-indigo-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                      >
                        Look up
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-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>
                      </button>
                    </div>
                  </form>
                  {mapLabel ? (
                    <a
                      href={mapHref || "#"}
                      className="mt-4 inline-flex min-h-11 items-center gap-2 rounded text-sm font-semibold text-indigo-100 underline decoration-indigo-400 underline-offset-4 hover:text-white hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                    >
                      {mapLabel}
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 ${hasHeader || lookupAction ? "mt-12 sm:mt-16" : ""}`}>
              {list.map((d, i) => {
                const hoods = (d.neighborhoods ?? "")
                  .split(",")
                  .map((n) => n.trim())
                  .filter(Boolean);
                const tel = d.phone ? d.phone.replace(/[^\d+]/g, "") : "";
                return (
                  <li key={`${d.number}-${i}`} className="flex flex-col rounded-2xl bg-neutral-50 p-6 ring-1 ring-neutral-200">
                    <div className="flex items-start justify-between gap-4">
                      <Sub className="flex flex-col">
                        <span className="text-xs font-semibold tracking-widest text-neutral-600 uppercase">{word}</span>
                        <span className="mt-1 text-5xl leading-none font-semibold tracking-tight text-indigo-700 tabular-nums">{d.number}</span>
                      </Sub>
                      {d.member ? (
                        <span aria-hidden="true" className="grid size-12 shrink-0 place-items-center rounded-full bg-white text-sm font-semibold tracking-wide text-indigo-800 ring-1 ring-indigo-200">
                          {initials(d.member)}
                        </span>
                      ) : null}
                    </div>
                    {hoods.length ? (
                      <div className="mt-5">
                        <p className="sr-only">Neighborhoods</p>
                        <ul role="list" className="flex flex-wrap gap-1.5">
                          {hoods.map((h, j) => (
                            <li key={j} className="rounded-md bg-white px-2 py-1 text-sm leading-5 text-neutral-700 ring-1 ring-neutral-200">
                              {h}
                            </li>
                          ))}
                        </ul>
                      </div>
                    ) : null}
                    <div className="mt-6 border-t border-neutral-200 pt-5 sm:mt-auto">
                      {d.member ? (
                        <p className="text-base font-semibold text-neutral-950">
                          {d.href ? (
                            <a href={d.href} className={`rounded underline decoration-neutral-300 underline-offset-4 hover:text-indigo-800 hover:decoration-indigo-700 ${focusRing}`}>
                              {d.member}
                            </a>
                          ) : (
                            d.member
                          )}
                        </p>
                      ) : (
                        <p className="text-base font-semibold text-neutral-950">Seat currently vacant</p>
                      )}
                      {d.role ? <p className="text-sm leading-6 text-neutral-600">{d.role}</p> : null}
                      {tel || d.email ? (
                        <ul role="list" className="mt-2 flex flex-col text-sm font-semibold">
                          {tel ? (
                            <li>
                              <a href={`tel:${tel}`} className={`inline-flex min-h-11 items-center gap-2 rounded text-indigo-700 hover:text-indigo-900 ${focusRing}`}>
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                                  <path fillRule="evenodd" d="M2 3.5A1.5 1.5 0 0 1 3.5 2h1.148a1.5 1.5 0 0 1 1.465 1.175l.513 2.31a1.5 1.5 0 0 1-1.02 1.762l-.776.259a.75.75 0 0 0-.443.98 10.53 10.53 0 0 0 5.127 5.127.75.75 0 0 0 .98-.443l.259-.776a1.5 1.5 0 0 1 1.762-1.02l2.31.513A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15c-7.18 0-13-5.82-13-13V3.5Z" clipRule="evenodd" />
                                </svg>
                                <span className="sr-only">Call </span>
                                {d.phone}
                              </a>
                            </li>
                          ) : null}
                          {d.email ? (
                            <li>
                              <a href={`mailto:${d.email}`} className={`inline-flex min-h-11 items-center gap-2 rounded break-all text-indigo-700 hover:text-indigo-900 ${focusRing}`}>
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0">
                                  <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>
                                <span className="sr-only">Email </span>
                                {d.email}
                              </a>
                            </li>
                          ) : null}
                        </ul>
                      ) : null}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
