# Add the "Health Alert" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/health-alert) to this Pantheon Content Publisher (P1) Next.js project. A public health advisory with level, what's happening, steps to take, who's at higher risk and a 911 line.

## Steps

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

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

/**
 * Health Alert — a public health advisory with a level (Information, Advisory, Warning)
 * shown as icon + text + color, what's happening, what to do, who's at higher risk,
 * an updated time, a 911 line and a more-info link.
 * Register: `HealthAlertBlock: healthAlertBlock` in puck.config.tsx.
 */

// spec: status-colors

type Heading = "h1" | "h2" | "h3" | "h4";
type Level = "info" | "advisory" | "warning";

export type HealthAlertProps = {
  level: Level;
  title: string;
  headingLevel: Heading;
  issuedBy: string;
  updated: string;
  updatedIso: string;
  summary: string;
  actionsHeading: string;
  actions: string;
  riskHeading: string;
  risk: string;
  emergencyNote: string;
  moreLabel: string;
  moreHref: string;
  phoneLabel: string;
  phone: string;
};

const childLevel = { 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-600";

const levels: Record<Level, { label: string; band: string; badge: string; icon: string; bullet: string }> = {
  info: {
    label: "Information",
    band: "border-indigo-600 bg-indigo-50/60",
    badge: "bg-indigo-600 text-white",
    bullet: "bg-indigo-600",
    icon: "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",
  },
  advisory: {
    label: "Advisory",
    band: "border-amber-500 bg-amber-50/70",
    badge: "bg-amber-400 text-amber-950",
    bullet: "bg-amber-600",
    icon: "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-8-5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-1.5 0v-4.5A.75.75 0 0 1 10 5Zm0 10a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
  },
  warning: {
    label: "Warning",
    band: "border-red-700 bg-red-50/70",
    badge: "bg-red-700 text-white",
    bullet: "bg-red-700",
    icon: "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",
  },
};

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

export const healthAlertBlock: ComponentConfig<HealthAlertProps> = {
  label: "Health Alert",
  fields: {
    level: {
      type: "radio",
      label: "Alert level",
      options: [
        { label: "Information", value: "info" },
        { label: "Advisory", value: "advisory" },
        { label: "Warning", value: "warning" },
      ],
      metadata: { help: "Sets the color, icon and label. The level is always written out, so it never relies on color alone." },
    },
    title: { type: "text", label: "Title" },
    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. Section titles inside use the next level down." },
    },
    issuedBy: { type: "text", label: "Issued by", metadata: { help: "Who issued the alert. Leave blank to hide." } },
    updated: { type: "text", label: "Updated (as shown)", metadata: { help: "Like October 8, 2026 at 2:00 p.m." } },
    updatedIso: { type: "text", label: "Updated (machine-readable)", metadata: { help: "Like 2026-10-08T14:00. Tells screen readers and search the exact time. Optional." } },
    summary: { type: "textarea", label: "What's happening", metadata: { help: "Two or three short sentences in plain words." } },
    actionsHeading: { type: "text", label: "Actions heading" },
    actions: { type: "textarea", label: "What you should do", metadata: { help: "One step per line. Follow official guidance and keep it short. Leave blank to hide." } },
    riskHeading: { type: "text", label: "Risk heading" },
    risk: { type: "textarea", label: "Who's at higher risk", metadata: { help: "One group per line. Leave blank to hide." } },
    emergencyNote: { type: "text", label: "Emergency line", metadata: { help: "Always shown. Left blank, it reads In an emergency, call 911." } },
    moreLabel: { type: "text", label: "More info link text", metadata: { help: "Leave blank to hide." } },
    moreHref: { type: "text", label: "More info link" },
    phoneLabel: { type: "text", label: "Phone label", metadata: { help: "Like Questions? Call our health line." } },
    phone: { type: "text", label: "Phone", metadata: { help: "Leave blank to hide." } },
  },
  defaultProps: {
    level: "advisory",
    title: "Extreme heat advisory through Sunday",
    headingLevel: "h2",
    issuedBy: "Lakeshore County Health Department",
    updated: "October 8, 2026 at 2:00 p.m.",
    updatedIso: "2026-10-08T14:00",
    summary: "The National Weather Service expects heat index values near 100°F from Friday to Sunday. Heat can make anyone sick, and it is most dangerous in the afternoon. Cooling centers will be open across the county.",
    actionsHeading: "What you should do",
    actions: "Drink water often, even if you don't feel thirsty.\nStay in air conditioning during the hottest hours. Cooling centers are free.\nNever leave children or pets in a parked car.\nCheck on neighbors, older family members and anyone who lives alone.",
    riskHeading: "Who's at higher risk",
    risk: "Adults 65 and older\nBabies and young children\nPeople who work or exercise outside\nPeople with heart or lung conditions\nPeople without air conditioning",
    emergencyNote: "In an emergency, call 911.",
    moreLabel: "Find a cooling center",
    moreHref: "/heat/cooling-centers",
    phoneLabel: "Questions? Call our health line",
    phone: "(555) 010-2400",
  },
  render: ({ id, level, title, headingLevel, issuedBy, updated, updatedIso, summary, actionsHeading, actions, riskHeading, risk, emergencyNote, moreLabel, moreHref, phoneLabel, phone }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const lv = levels[level] ?? levels.info;
    const steps = lines(actions);
    const groups = lines(risk);
    const titleId = `ha-${id || "block"}-title`;
    const tel = (phone || "").replace(/[^\d+]/g, "");

    return (
      <section aria-labelledby={title ? titleId : undefined} aria-label={title ? undefined : `${lv.label} health alert`} 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 rounded-2xl border-l-4 p-6 ring-1 ring-neutral-950/5 sm:border-l-8 sm:p-10 ${lv.band}`}>
          <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
            <span className={`inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-bold tracking-wide uppercase ${lv.badge}`}>
              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                <path fillRule="evenodd" d={lv.icon} clipRule="evenodd" />
              </svg>
              <span>
                <span className="sr-only">Alert level: </span>
                {lv.label}
              </span>
            </span>
            {issuedBy ? <span className="text-sm font-medium text-neutral-700">{issuedBy}</span> : null}
          </div>

          {title ? (
            <H id={titleId} className="mt-5 text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">
              {title}
            </H>
          ) : null}
          {updated ? (
            <p className="mt-2 text-sm text-neutral-700">
              Updated {updatedIso ? <time dateTime={updatedIso}>{updated}</time> : updated}
            </p>
          ) : null}
          {summary ? <p className="mt-5 max-w-3xl text-lg leading-8 text-pretty text-neutral-800">{summary}</p> : null}

          {steps.length || groups.length ? (
            <div className={`mt-8 grid grid-cols-1 gap-6 ${steps.length && groups.length ? "md:grid-cols-5" : ""}`}>
              {steps.length ? (
                <div className={`rounded-xl bg-white p-5 ring-1 ring-neutral-950/5 sm:p-6 ${groups.length ? "md:col-span-3" : ""}`}>
                  <Sub className="text-lg font-semibold text-neutral-950">{actionsHeading || "What you should do"}</Sub>
                  <ol role="list" className="mt-4 space-y-3">
                    {steps.map((s, i) => (
                      <li key={i} className="flex gap-3 text-base leading-7 text-neutral-800">
                        <span aria-hidden="true" className="mt-0.5 grid size-6 shrink-0 place-items-center rounded-full bg-neutral-950 text-xs font-semibold text-white tabular-nums">
                          {i + 1}
                        </span>
                        <span className="min-w-0 text-pretty">{s}</span>
                      </li>
                    ))}
                  </ol>
                </div>
              ) : null}
              {groups.length ? (
                <div className={`rounded-xl bg-white/60 p-5 ring-1 ring-neutral-950/5 sm:p-6 ${steps.length ? "md:col-span-2" : ""}`}>
                  <Sub className="text-lg font-semibold text-neutral-950">{riskHeading || "Who's at higher risk"}</Sub>
                  <ul role="list" className="mt-4 space-y-2.5">
                    {groups.map((g, i) => (
                      <li key={i} className="flex gap-3 text-base leading-7 text-neutral-800">
                        <span aria-hidden="true" className={`mt-2.5 size-2 shrink-0 rounded-full ${lv.bullet}`} />
                        <span className="min-w-0 text-pretty">{g}</span>
                      </li>
                    ))}
                  </ul>
                </div>
              ) : null}
            </div>
          ) : null}

          <div className="mt-8 flex flex-col gap-4 border-t border-neutral-950/10 pt-6 lg:flex-row lg:items-center lg:justify-between">
            <p className="flex items-center gap-2.5 text-base font-bold text-red-800">
              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 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.745l-1.051.35a.5.5 0 0 0-.31.637 10.48 10.48 0 0 0 6.548 6.548.5.5 0 0 0 .637-.31l.35-1.05a1.5 1.5 0 0 1 1.745-1.021l2.31.513A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15C7.82 18 2 12.18 2 5V3.5Z" clipRule="evenodd" />
              </svg>
              <a href="tel:911" className={`-my-2 inline-flex min-h-11 items-center rounded underline decoration-red-300 underline-offset-4 hover:decoration-red-800 ${focusRing}`}>
                {emergencyNote || "In an emergency, call 911."}
              </a>
            </p>
            <div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center">
              {tel ? (
                <p className="text-sm text-neutral-700">
                  {phoneLabel ? `${phoneLabel}: ` : null}
                  <a href={`tel:${tel}`} className={`-my-3 inline-flex min-h-11 items-center rounded font-semibold text-neutral-950 tabular-nums underline decoration-neutral-400 underline-offset-4 hover:decoration-indigo-600 ${focusRing}`}>
                    {phone}
                  </a>
                </p>
              ) : null}
              {moreLabel ? (
                <a
                  href={moreHref || "#"}
                  className={`inline-flex min-h-11 items-center justify-center gap-2 rounded-lg bg-neutral-950 px-5 py-2.5 text-sm font-semibold text-white shadow-xs transition hover:bg-neutral-800 ${focusRing}`}
                >
                  {moreLabel}
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4">
                    <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>
              ) : null}
            </div>
          </div>
        </div>
      </section>
    );
  },
};
```
