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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/emergency-info) to this Pantheon Content Publisher (P1) Next.js project. A call-911 panel, tap-to-call non-emergency numbers, alert sign-up and preparedness links.

## Steps

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

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

/**
 * Emergency Info — a high-contrast "call 911" panel, tap-to-call non-emergency numbers,
 * an alert sign-up and preparedness links. Red is reserved for the 911 panel alone.
 * Register: `EmergencyInfoBlock: emergencyInfoBlock` in puck.config.tsx.
 */

// spec: status-colors

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

export type EmergencyInfoProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  emergencyTitle: string;
  emergencyText: string;
  emergencyNumber: string;
  numbersHeading: string;
  numbers: {
    label: string;
    phone: string;
    note: string;
  }[];
  alertHeading: string;
  alertText: string;
  alertLabel: string;
  alertHref: string;
  prepHeading: string;
  prepLinks: {
    label: string;
    href: string;
  }[];
};

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

const tel = (phone: string) => `tel:${phone.replace(/[^\d+]/g, "")}`;

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

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 phoneIcon =
  "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.837l-.88.29a.75.75 0 0 0-.461.946 11.04 11.04 0 0 0 6.677 6.677.75.75 0 0 0 .946-.46l.29-.881a1.5 1.5 0 0 1 1.837-1.02l2.31.513A1.5 1.5 0 0 1 18 14.852V16.5a1.5 1.5 0 0 1-1.5 1.5H15c-7.18 0-13-5.82-13-13V3.5Z";

export const emergencyInfoBlock: ComponentConfig<EmergencyInfoProps> = {
  label: "Emergency Info",
  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" },
    emergencyTitle: { type: "text", label: "Emergency panel title", metadata: { help: "Keep it short and direct, like In an emergency, call 911." } },
    emergencyText: { type: "textarea", label: "Emergency panel text", metadata: { help: "When to call 911, in plain words. Mention text-to-911 if your area supports it." } },
    emergencyNumber: { type: "text", label: "Emergency number", metadata: { help: "Shown as a large tap-to-call button. Leave blank to hide the button." } },
    numbersHeading: { type: "text", label: "Numbers heading" },
    numbers: {
      type: "array",
      label: "Non-emergency numbers",
      min: 1,
      max: 12,
      getItemSummary: (item) => (item?.label ? `${item.label}${item.phone ? ` · ${item.phone}` : ""}` : "Number"),
      defaultItemProps: { label: "New number", phone: "", note: "" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        phone: { type: "text", label: "Phone", metadata: { help: "Written the way people read it, like (555) 555-0100. It becomes a tap-to-call link." } },
        note: { type: "text", label: "Hours or note", metadata: { help: "Optional. Like 24 hours, or Weekdays 8 a.m. to 5 p.m." } },
      },
    },
    alertHeading: { type: "text", label: "Alert sign-up heading", metadata: { help: "Leave blank to hide the sign-up panel." } },
    alertText: { type: "textarea", label: "Alert sign-up text" },
    alertLabel: { type: "text", label: "Alert button text" },
    alertHref: { type: "text", label: "Alert button link", metadata: { help: "Your emergency notification sign-up page." } },
    prepHeading: { type: "text", label: "Preparedness heading", metadata: { help: "Leave blank and remove all links to hide this row." } },
    prepLinks: {
      type: "array",
      label: "Preparedness links",
      min: 0,
      max: 8,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
    },
  },
  defaultProps: {
    heading: "Emergency information",
    headingLevel: "h2",
    intro: "Know who to call, how to get alerts and what to do before a storm, flood or heat wave reaches Millbrook.",
    emergencyTitle: "In an emergency, call 911",
    emergencyText: "Call 911 if someone is hurt, in danger, or you see a fire or a crime happening now. If you can't speak safely, you can text 911.",
    emergencyNumber: "911",
    numbersHeading: "Non-emergency numbers",
    numbers: [
      { label: "Police non-emergency", phone: "(555) 555-0110", note: "24 hours" },
      { label: "Fire department, non-emergency", phone: "(555) 555-0120", note: "Weekdays 8 a.m. to 5 p.m." },
      { label: "Water main breaks and sewer backups", phone: "(555) 555-0130", note: "24 hours" },
      { label: "Downed trees and blocked roads", phone: "(555) 555-0140", note: "Public Works, 24 hours" },
      { label: "Poison Control", phone: "(800) 222-1222", note: "Free and confidential, 24 hours" },
    ],
    alertHeading: "Get emergency alerts",
    alertText: "MillbrookAlert sends texts, calls and emails about severe weather, boil-water notices and evacuations. It's free and takes two minutes.",
    alertLabel: "Sign up for MillbrookAlert",
    alertHref: "/alerts",
    prepHeading: "Get prepared",
    prepLinks: [
      { label: "Build an emergency kit", href: "/prepare/kit" },
      { label: "Evacuation routes", href: "/prepare/evacuation" },
      { label: "Cooling and warming centers", href: "/prepare/centers" },
      { label: "Flood zone map", href: "/prepare/flood-map" },
    ],
  },
  render: ({
    heading,
    headingLevel,
    intro,
    emergencyTitle,
    emergencyText,
    emergencyNumber,
    numbersHeading,
    numbers,
    alertHeading,
    alertText,
    alertLabel,
    alertHref,
    prepHeading,
    prepLinks,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (numbers ?? []).filter((n) => n?.label && n?.phone);
    const links = (prepLinks ?? []).filter((l) => l?.label);
    const hasEmergency = Boolean(emergencyTitle || emergencyText || emergencyNumber);
    const hasHeader = Boolean(heading || intro);
    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="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>
          ) : null}

          <div className={`grid gap-6 lg:grid-cols-12 lg:gap-8 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
            {hasEmergency || alertHeading ? (
              <div className="flex flex-col gap-6 lg:col-span-5">
                {hasEmergency ? (
                  <div className="rounded-2xl bg-red-700 p-6 text-white shadow-sm sm:p-8">
                    <div className="flex items-start gap-4">
                      <span aria-hidden="true" className="grid size-11 shrink-0 place-items-center rounded-full bg-white text-red-700">
                        <svg viewBox="0 0 20 20" fill="currentColor" className="size-6">
                          <path fillRule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" clipRule="evenodd" />
                        </svg>
                      </span>
                      <div className="min-w-0">
                        {emergencyTitle ? <Sub className="text-2xl leading-tight font-bold tracking-tight text-balance sm:text-3xl">{emergencyTitle}</Sub> : null}
                        {emergencyText ? <p className="mt-3 text-base leading-7 text-pretty text-white">{emergencyText}</p> : null}
                      </div>
                    </div>
                    {emergencyNumber ? (
                      <a
                        href={tel(emergencyNumber)}
                        className="mt-6 flex min-h-14 items-center justify-center gap-3 rounded-xl bg-white px-6 py-3 text-xl font-bold text-red-800 shadow-sm transition hover:bg-red-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                      >
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-6">
                          <path fillRule="evenodd" d={phoneIcon} clipRule="evenodd" />
                        </svg>
                        Call {emergencyNumber}
                      </a>
                    ) : null}
                  </div>
                ) : null}

                {alertHeading ? (
                  <div className="rounded-2xl bg-indigo-50 p-6 ring-1 ring-indigo-600/15 ring-inset sm:p-8">
                    <Sub className="text-lg font-semibold text-neutral-950">{alertHeading}</Sub>
                    {alertText ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-700">{alertText}</p> : null}
                    {alertLabel ? (
                      <a
                        href={alertHref || "#"}
                        className={`mt-5 inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-lg bg-indigo-600 px-5 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-500 sm:w-auto ${focusRing}`}
                      >
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                          <path fillRule="evenodd" d="M10 2a6 6 0 0 0-6 6c0 1.887-.454 3.665-1.257 5.234a.75.75 0 0 0 .515 1.076 32.91 32.91 0 0 0 3.256.508 3.5 3.5 0 0 0 6.972 0 32.903 32.903 0 0 0 3.256-.508.75.75 0 0 0 .515-1.076A11.448 11.448 0 0 1 16 8a6 6 0 0 0-6-6ZM8.05 14.943a33.54 33.54 0 0 0 3.9 0 2 2 0 0 1-3.9 0Z" clipRule="evenodd" />
                        </svg>
                        {alertLabel}
                      </a>
                    ) : null}
                  </div>
                ) : null}
              </div>
            ) : null}

            {list.length ? (
              <div className={hasEmergency || alertHeading ? "lg:col-span-7" : "lg:col-span-12"}>
                <div className="h-full rounded-2xl p-6 ring-1 ring-neutral-200 sm:p-8">
                  {numbersHeading ? <Sub className="text-lg font-semibold text-neutral-950">{numbersHeading}</Sub> : null}
                  <ul role="list" className={`divide-y divide-neutral-200 ${numbersHeading ? "mt-4" : ""}`}>
                    {list.map((n, i) => (
                      <li key={`${n.label}-${i}`} className="flex flex-col gap-1 py-4 first:pt-0 last:pb-0 sm:flex-row sm:items-center sm:justify-between sm:gap-6">
                        <div className="min-w-0">
                          <p className="text-base font-medium text-pretty text-neutral-950">{n.label}</p>
                          {n.note ? <p className="text-sm leading-6 text-neutral-600">{n.note}</p> : null}
                        </div>
                        <a
                          href={tel(n.phone)}
                          className={`inline-flex min-h-11 shrink-0 items-center gap-2 self-start rounded-lg text-base font-semibold whitespace-nowrap text-indigo-700 tabular-nums underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 sm:self-auto ${focusRing}`}
                        >
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 text-indigo-600">
                            <path fillRule="evenodd" d={phoneIcon} clipRule="evenodd" />
                          </svg>
                          {n.phone}
                          <span className="sr-only">, {n.label}</span>
                        </a>
                      </li>
                    ))}
                  </ul>
                </div>
              </div>
            ) : null}
          </div>

          {links.length ? (
            <nav aria-label={prepHeading || "Emergency preparedness"} className="mt-12 border-t border-neutral-200 pt-10">
              {prepHeading ? <Sub className="text-lg font-semibold text-neutral-950">{prepHeading}</Sub> : null}
              <ul role="list" className={`grid gap-3 sm:grid-cols-2 lg:grid-cols-4 ${prepHeading ? "mt-4" : ""}`}>
                {links.map((l, i) => (
                  <li key={`${l.label}-${i}`}>
                    <a
                      href={l.href || "#"}
                      className={`group flex min-h-14 items-center justify-between gap-3 rounded-xl bg-neutral-50 px-4 py-3 text-sm font-semibold text-neutral-950 ring-1 ring-neutral-200 transition ring-inset hover:bg-white hover:ring-indigo-300 ${focusRing}`}
                    >
                      <span className="min-w-0 text-pretty">{l.label}</span>
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-600 transition group-hover:translate-x-0.5">
                        <path fillRule="evenodd" d={arrow} clipRule="evenodd" />
                      </svg>
                    </a>
                  </li>
                ))}
              </ul>
            </nav>
          ) : null}
        </div>
      </section>
    );
  },
};
```
