# Add the "Voter Info" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/voter-info) to this Pantheon Content Publisher (P1) Next.js project. Election day, key deadlines, early voting sites, what to bring, sample ballot and accessible voting options.

## Steps

1. Create `components/puck/voter-info-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 { voterInfoBlock } from "./components/puck/voter-info-block";`
3. Register it under `components` as `VoterInfoBlock: voterInfoBlock`.
4. Add `"VoterInfoBlock"` 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/voter-info-block.tsx`

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

/**
 * Voter Info — everything for the next election on one screen: election day, key deadlines,
 * early voting sites, what to bring, the sample ballot and accessible voting options.
 * Register: `VoterInfoBlock: voterInfoBlock` in puck.config.tsx.
 */

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

export type VoterInfoProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  electionDate: string;
  pollHours: string;
  registerLabel: string;
  registerHref: string;
  sampleBallotLabel: string;
  sampleBallotHref: string;
  keyDatesHeading: string;
  keyDates: { label: string; date: string; note: string }[];
  earlyVotingHeading: string;
  earlyVotingDates: string;
  earlyVoting: { name: string; address: string; hours: string }[];
  bringHeading: string;
  bringItems: string;
  bringNote: string;
  accessibilityHeading: string;
  accessibilityText: string;
  accessibilityItems: string;
  officeName: string;
  officePhone: string;
  officeEmail: string;
};

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

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

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

const check = "M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z";

export const voterInfoBlock: ComponentConfig<VoterInfoProps> = {
  label: "Voter Info",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, like the election name. 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." } },
    electionDate: { type: "text", label: "Election day", metadata: { help: "Write it out, like Tuesday, November 3, 2026." } },
    pollHours: { type: "text", label: "Polling hours", metadata: { help: "Like Polls open 6 a.m. to 7 p.m. Leave blank to hide it." } },
    registerLabel: { type: "text", label: "Register link text", metadata: { help: "Leave blank to hide the button." } },
    registerHref: { type: "text", label: "Register link", metadata: { help: "Usually your state's online voter registration page." } },
    sampleBallotLabel: { type: "text", label: "Sample ballot link text", metadata: { help: "Leave blank to hide the button." } },
    sampleBallotHref: { type: "text", label: "Sample ballot link", metadata: { help: "A page or PDF." } },
    keyDatesHeading: { type: "text", label: "Key dates heading", metadata: { help: "Like Key dates. Leave blank to hide it." } },
    keyDates: {
      type: "array",
      label: "Key dates",
      max: 6,
      getItemSummary: (item) => item?.label || "Date",
      defaultItemProps: { label: "New deadline", date: "", note: "" },
      arrayFields: {
        label: { type: "text", label: "What", metadata: { help: "Like Registration deadline." } },
        date: { type: "text", label: "Date", metadata: { help: "Like Mon, Oct 5." } },
        note: { type: "text", label: "Note", metadata: { help: "One short line, like Online, by mail or in person. Leave blank to hide it." } },
      },
    },
    earlyVotingHeading: { type: "text", label: "Early voting heading", metadata: { help: "Leave blank and remove all sites to hide this panel." } },
    earlyVotingDates: { type: "text", label: "Early voting dates", metadata: { help: "Like Oct 17 to Oct 31. Leave blank to hide it." } },
    earlyVoting: {
      type: "array",
      label: "Early voting sites",
      max: 10,
      getItemSummary: (item) => item?.name || "Site",
      defaultItemProps: { name: "New site", address: "", hours: "" },
      arrayFields: {
        name: { type: "text", label: "Site name" },
        address: { type: "text", label: "Address" },
        hours: { type: "textarea", label: "Hours", metadata: { help: "Like Mon–Fri 8 a.m. to 6 p.m.; Sat 9 a.m. to 3 p.m." } },
      },
    },
    bringHeading: { type: "text", label: "What to bring heading", metadata: { help: "Leave blank to hide this panel." } },
    bringItems: { type: "textarea", label: "What to bring", metadata: { help: "One item per line. Each line becomes a checklist item." } },
    bringNote: { type: "textarea", label: "What to bring note", metadata: { help: "Like what happens if someone forgets their ID. Leave blank to hide it." } },
    accessibilityHeading: { type: "text", label: "Accessible voting heading", metadata: { help: "Leave blank to hide this panel." } },
    accessibilityText: { type: "textarea", label: "Accessible voting text" },
    accessibilityItems: { type: "textarea", label: "Accessible voting options", metadata: { help: "One option per line." } },
    officeName: { type: "text", label: "Elections office", metadata: { help: "Leave blank to hide the contact line." } },
    officePhone: { type: "text", label: "Office phone", metadata: { help: "Shown as a tap-to-call link." } },
    officeEmail: { type: "text", label: "Office email" },
  },
  defaultProps: {
    eyebrow: "General Election",
    heading: "Get ready to vote",
    headingLevel: "h2",
    intro: "Millbrook voters will choose a mayor, three council members and two ballot questions. Here's what you need to know.",
    electionDate: "Tuesday, November 3, 2026",
    pollHours: "Polls open 6 a.m. to 7 p.m.",
    registerLabel: "Register or check your registration",
    registerHref: "/elections/register",
    sampleBallotLabel: "See your sample ballot",
    sampleBallotHref: "/elections/sample-ballot",
    keyDatesHeading: "Key dates",
    keyDates: [
      { label: "Registration deadline", date: "Mon, Oct 5", note: "Online, by mail (postmarked) or in person" },
      { label: "Last day to request a mail ballot", date: "Tue, Oct 27", note: "Must be received by 5 p.m." },
      { label: "Early voting", date: "Oct 17 to Oct 31", note: "Any registered voter, at any early site" },
      { label: "Mail ballots due", date: "Tue, Nov 3", note: "Received by 7 p.m. or dropped in a city drop box" },
    ],
    earlyVotingHeading: "Early voting sites",
    earlyVotingDates: "Saturday, Oct 17 to Saturday, Oct 31",
    earlyVoting: [
      { name: "Millbrook City Hall", address: "100 Main Street, Room 110", hours: "Mon–Fri 8 a.m. to 6 p.m.\nSat 9 a.m. to 3 p.m." },
      { name: "Northside Recreation Center", address: "2215 Hillcrest Avenue", hours: "Mon–Sat 10 a.m. to 7 p.m." },
      { name: "Millbrook Public Library, South Branch", address: "780 Lakeside Drive", hours: "Mon–Sat 10 a.m. to 7 p.m.\nSun, Oct 25, noon to 5 p.m." },
    ],
    bringHeading: "What to bring",
    bringItems: "A photo ID, like a driver's license, state ID, passport or student ID\nYour sample ballot with your choices marked (optional)\nA support person, if you'd like help",
    bringNote: "No ID? You can still vote a provisional ballot and show ID at the elections office within three days.",
    accessibilityHeading: "Accessible voting",
    accessibilityText: "Every polling place is accessible and has a ballot-marking device with audio, large print and sip-and-puff controls.",
    accessibilityItems: "Curbside voting: call when you arrive and a poll worker will bring your ballot\nBring anyone you choose to help you, except your employer or union representative\nAccessible mail ballots you can fill out on a screen reader\nASL and Spanish interpreters on request",
    officeName: "Millbrook Elections Office",
    officePhone: "(555) 555-0130",
    officeEmail: "elections@millbrook.example.gov",
  },
  render: ({
    id,
    eyebrow,
    heading,
    headingLevel,
    intro,
    electionDate,
    pollHours,
    registerLabel,
    registerHref,
    sampleBallotLabel,
    sampleBallotHref,
    keyDatesHeading,
    keyDates,
    earlyVotingHeading,
    earlyVotingDates,
    earlyVoting,
    bringHeading,
    bringItems,
    bringNote,
    accessibilityHeading,
    accessibilityText,
    accessibilityItems,
    officeName,
    officePhone,
    officeEmail,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const Item = grandHeading[headingLevel] || "h4";
    const baseId = id || "voter-info";
    const dates = (keyDates ?? []).filter((d) => d?.label);
    const sites = (earlyVoting ?? []).filter((s) => s?.name);
    const bring = lines(bringItems);
    const access = lines(accessibilityItems);
    const tel = officePhone ? officePhone.replace(/[^\d+]/g, "") : "";
    const hasEarly = Boolean(earlyVotingHeading || sites.length);
    const hasBring = Boolean(bringHeading && (bring.length || bringNote));
    return (
      <section aria-labelledby={heading ? `${baseId}-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="grid grid-cols-1 gap-10 lg:grid-cols-12 lg:gap-12">
            <div className="lg:col-span-5">
              {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}
              {electionDate ? (
                <div className="mt-8 rounded-2xl bg-indigo-700 p-6 text-white shadow-sm sm:p-8">
                  <p className="text-sm font-semibold tracking-widest text-indigo-200 uppercase">Election day</p>
                  <p className="mt-2 text-2xl leading-tight font-semibold tracking-tight text-balance sm:text-3xl">{electionDate}</p>
                  {pollHours ? <p className="mt-2 text-base text-indigo-100">{pollHours}</p> : null}
                </div>
              ) : null}
              {registerLabel || sampleBallotLabel ? (
                <div className="mt-6 flex flex-col gap-3 sm:flex-row sm:flex-wrap lg:flex-col xl:flex-row">
                  {registerLabel ? (
                    <a
                      href={registerHref || "#"}
                      className={`inline-flex min-h-12 items-center justify-center rounded-lg bg-neutral-950 px-5 text-base font-semibold text-white shadow-sm transition hover:bg-neutral-800 ${focusRing}`}
                    >
                      {registerLabel}
                    </a>
                  ) : null}
                  {sampleBallotLabel ? (
                    <a
                      href={sampleBallotHref || "#"}
                      className={`inline-flex min-h-12 items-center justify-center gap-2 rounded-lg bg-white px-5 text-base font-semibold text-neutral-950 shadow-sm ring-1 ring-neutral-300 transition ring-inset hover:bg-neutral-50 ${focusRing}`}
                    >
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-700">
                        <path fillRule="evenodd" d="M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z" clipRule="evenodd" />
                      </svg>
                      {sampleBallotLabel}
                    </a>
                  ) : null}
                </div>
              ) : null}
            </div>

            {dates.length ? (
              <div className="lg:col-span-7 lg:pt-2">
                {keyDatesHeading ? <Sub className="mb-4 text-sm font-semibold tracking-widest text-neutral-600 uppercase">{keyDatesHeading}</Sub> : null}
                <ol role="list" className=" rounded-2xl bg-white ring-1 ring-neutral-200">
                  {dates.map((d, i) => (
                    <li key={`${d.label}-${i}`} className="relative flex gap-4 border-b border-neutral-100 px-5 py-5 last:border-b-0 sm:gap-6 sm:px-6">
                      <span aria-hidden="true" className="relative mt-1 flex flex-col items-center">
                        <span className="size-3 rounded-full bg-indigo-700 ring-4 ring-indigo-100" />
                      </span>
                      <div className="grid min-w-0 flex-1 grid-cols-1 gap-1 sm:grid-cols-5 sm:gap-6">
                        <p className="text-lg font-semibold text-neutral-950 tabular-nums sm:col-span-2">{d.date}</p>
                        <div className="sm:col-span-3">
                          <p className="text-base font-semibold text-neutral-900">{d.label}</p>
                          {d.note ? <p className="mt-0.5 text-sm leading-6 text-pretty text-neutral-600">{d.note}</p> : null}
                        </div>
                      </div>
                    </li>
                  ))}
                </ol>
              </div>
            ) : null}
          </div>

          {hasEarly || hasBring ? (
            <div className={`mt-12 grid grid-cols-1 gap-6 ${hasEarly && hasBring ? "lg:grid-cols-3" : ""}`}>
              {hasEarly ? (
                <div className={`rounded-2xl bg-white p-6 ring-1 ring-neutral-200 sm:p-8 ${hasBring ? "lg:col-span-2" : ""}`}>
                  <div className="flex flex-col gap-1 sm:flex-row sm:items-baseline sm:justify-between sm:gap-6">
                    {earlyVotingHeading ? <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{earlyVotingHeading}</Sub> : null}
                    {earlyVotingDates ? <p className="text-sm font-semibold text-indigo-700">{earlyVotingDates}</p> : null}
                  </div>
                  {sites.length ? (
                    <ul role="list" className="mt-6 grid grid-cols-1 gap-6 sm:grid-cols-2 xl:grid-cols-3">
                      {sites.map((s, i) => (
                        <li key={`${s.name}-${i}`} className="border-t-2 border-indigo-700 pt-4">
                          <Item className="text-base font-semibold text-neutral-950">{s.name}</Item>
                          {s.address ? <p className="mt-1 text-sm leading-6 text-neutral-700">{s.address}</p> : null}
                          {lines(s.hours).length ? (
                            <p className="mt-2 text-sm leading-6 text-neutral-600">
                              {lines(s.hours).map((h, j) => (
                                <span key={j} className="block">
                                  {h}
                                </span>
                              ))}
                            </p>
                          ) : null}
                        </li>
                      ))}
                    </ul>
                  ) : null}
                </div>
              ) : null}
              {hasBring ? (
                <div className="rounded-2xl bg-white p-6 ring-1 ring-neutral-200 sm:p-8">
                  <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{bringHeading}</Sub>
                  {bring.length ? (
                    <ul role="list" className="mt-5 space-y-3">
                      {bring.map((b, i) => (
                        <li key={i} className="flex gap-3 text-sm leading-6 text-neutral-700">
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-700">
                            <path fillRule="evenodd" d={check} clipRule="evenodd" />
                          </svg>
                          <span className="min-w-0">{b}</span>
                        </li>
                      ))}
                    </ul>
                  ) : null}
                  {bringNote ? <p className="mt-5 border-t border-neutral-200 pt-4 text-sm leading-6 text-pretty text-neutral-600">{bringNote}</p> : null}
                </div>
              ) : null}
            </div>
          ) : null}

          {accessibilityHeading ? (
            <div className="mt-6 grid grid-cols-1 gap-6 rounded-2xl bg-indigo-50 p-6 ring-1 ring-indigo-600/15 sm:p-8 lg:grid-cols-3 lg:gap-12">
              <div className="flex gap-4">
                <span aria-hidden="true" className="grid size-11 shrink-0 place-items-center rounded-full bg-indigo-700 text-white">
                  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.75} strokeLinecap="round" strokeLinejoin="round" className="size-6">
                    <path d="M12 5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM9 8h6m-3 0v6h4l2 5M9.5 11.5a5 5 0 1 0 6 7" />
                  </svg>
                </span>
                <div className="min-w-0">
                  <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{accessibilityHeading}</Sub>
                  {accessibilityText ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-700">{accessibilityText}</p> : null}
                </div>
              </div>
              {access.length ? (
                <ul role="list" className="grid grid-cols-1 gap-x-8 gap-y-3 sm:grid-cols-2 lg:col-span-2">
                  {access.map((a, i) => (
                    <li key={i} className="flex gap-3 text-sm leading-6 text-neutral-800">
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-700">
                        <path fillRule="evenodd" d={check} clipRule="evenodd" />
                      </svg>
                      <span className="min-w-0">{a}</span>
                    </li>
                  ))}
                </ul>
              ) : null}
            </div>
          ) : null}

          {officeName ? (
            <p className="mt-8 flex flex-col gap-x-6 text-sm text-neutral-700 sm:flex-row sm:flex-wrap sm:items-center">
              <span className="font-semibold text-neutral-950">Questions? {officeName}</span>
              {tel ? (
                <a href={`tel:${tel}`} className={`inline-flex min-h-11 items-center rounded font-semibold text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                  {officePhone}
                </a>
              ) : null}
              {officeEmail ? (
                <a href={`mailto:${officeEmail}`} className={`inline-flex min-h-11 items-center rounded font-semibold break-all text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                  {officeEmail}
                </a>
              ) : null}
            </p>
          ) : null}
        </div>
      </section>
    );
  },
};
```
