# Add the "Header — Government" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/header-civic) to this Pantheon Content Publisher (P1) Next.js project. Official-website banner with a "Here's how you know" disclosure, seal and agency name, search, quick service links and a full-width nav bar.

## Steps

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

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

/**
 * Header (Government) — an "official website" banner with a "Here's how you know" disclosure,
 * seal and name, site search, quick service links and a full-width navigation bar.
 * All disclosure is native <details>. Register: `HeaderCivicBlock: headerCivicBlock` in puck.config.tsx.
 */

export type HeaderCivicProps = {
  officialText: string;
  howLabel: string;
  domainTitle: string;
  domainBody: string;
  secureTitle: string;
  secureBody: string;
  sealImageUrl: string;
  sealImageAlt: string;
  agencyName: string;
  agencySubtitle: string;
  homeHref: string;
  searchAction: string;
  searchParam: string;
  searchLabel: string;
  quickLinks: { label: string; href: string }[];
  navLabel: string;
  links: { label: string; href: string }[];
  currentPath: string;
  menuLabel: string;
};

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

function same(href: string, currentPath: string) {
  const a = (href || "").trim().replace(/\/+$/, "");
  const b = (currentPath || "").trim().replace(/\/+$/, "");
  return Boolean(a) && a === b;
}

const searchIcon = (
  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
    <path fillRule="evenodd" d="M9 3.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Z" clipRule="evenodd" />
  </svg>
);

const sealFallback = (
  <svg aria-hidden="true" viewBox="0 0 64 64" className="size-12 shrink-0 text-indigo-900 sm:size-14">
    <circle cx="32" cy="32" r="31" fill="currentColor" />
    <circle cx="32" cy="32" r="26" fill="none" stroke="white" strokeWidth="1.25" strokeDasharray="2 2.6" />
    <circle cx="32" cy="32" r="20" fill="none" stroke="white" strokeOpacity="0.55" strokeWidth="1" />
    <path fill="white" d="M32 18.5l3.1 9.6h10.1l-8.2 5.9 3.1 9.6-8.1-5.9-8.1 5.9 3.1-9.6-8.2-5.9h10.1z" />
  </svg>
);

export const headerCivicBlock: ComponentConfig<HeaderCivicProps> = {
  label: "Header (Government)",
  fields: {
    officialText: { type: "text", label: "Official site line", metadata: { help: "The top banner, like An official website of the City of Riverbend. Leave blank to hide the banner." } },
    howLabel: { type: "text", label: "Disclosure label", metadata: { help: "Opens the explanation below. Leave blank to show the line without it." } },
    domainTitle: { type: "text", label: "Domain title" },
    domainBody: { type: "textarea", label: "Domain explanation", metadata: { help: "How people can tell your address is official, like a .gov ending." } },
    secureTitle: { type: "text", label: "Security title" },
    secureBody: { type: "textarea", label: "Security explanation" },
    sealImageUrl: { type: "text", label: "Seal image URL", metadata: { help: "Your seal or logo, ideally a square SVG. Leave blank for a generic emblem." } },
    sealImageAlt: { type: "text", label: "Seal alt text", metadata: { help: "Usually blank: the agency name beside it already names the link." } },
    agencyName: { type: "text", label: "Agency name" },
    agencySubtitle: { type: "text", label: "Subtitle", metadata: { help: "A line under the name, like the state or department. Leave blank to hide it." } },
    homeHref: { type: "text", label: "Home link", metadata: { help: "Usually /." } },
    searchAction: { type: "text", label: "Search page", metadata: { help: "Where the search form sends people, like /search. Leave blank to hide search." } },
    searchParam: { type: "text", label: "Search parameter", metadata: { help: "The query name your search page reads, usually q." } },
    searchLabel: { type: "text", label: "Search label", metadata: { help: "Read by screen readers and shown as the placeholder." } },
    quickLinks: {
      type: "array",
      label: "Quick links",
      min: 0,
      max: 3,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "/" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
      metadata: { help: "The top tasks residents come for, like Pay a bill. Shown beside search on wide screens and in the menu on phones." },
    },
    navLabel: { type: "text", label: "Navigation name", metadata: { help: "Read by screen readers, like Main. Name each menu on a page differently." } },
    links: {
      type: "array",
      label: "Menu 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" },
      },
    },
    currentPath: { type: "text", label: "Current section", metadata: { help: "Optional. A path like /services. The matching link is marked as the current page." } },
    menuLabel: { type: "text", label: "Mobile menu label" },
  },
  defaultProps: {
    officialText: "An official website of the City of Riverbend",
    howLabel: "Here's how you know",
    domainTitle: "Official websites use .gov",
    domainBody: "A .gov address means it belongs to an official government organization in the United States.",
    secureTitle: "Secure .gov websites use HTTPS",
    secureBody: "A lock or https:// means you've safely connected to the .gov website. Share sensitive information only on official, secure websites.",
    sealImageUrl: "",
    sealImageAlt: "",
    agencyName: "City of Riverbend",
    agencySubtitle: "Office of the Mayor & City Council",
    homeHref: "/",
    searchAction: "/search",
    searchParam: "q",
    searchLabel: "Search city services",
    quickLinks: [
      { label: "Pay a bill", href: "/pay" },
      { label: "Report an issue (311)", href: "/311" },
    ],
    navLabel: "Main",
    links: [
      { label: "Residents", href: "/residents" },
      { label: "Business", href: "/business" },
      { label: "Departments", href: "/departments" },
      { label: "Government", href: "/government" },
      { label: "Public meetings", href: "/meetings" },
      { label: "News", href: "/news" },
    ],
    currentPath: "/residents",
    menuLabel: "Menu",
  },
  render: ({ officialText, howLabel, domainTitle, domainBody, secureTitle, secureBody, sealImageUrl, sealImageAlt, agencyName, agencySubtitle, homeHref, searchAction, searchParam, searchLabel, quickLinks, navLabel, links, currentPath, menuLabel }) => {
    const items = (links ?? []).filter((l) => l?.label);
    const quick = (quickLinks ?? []).filter((l) => l?.label);
    const label = navLabel || "Main";
    const action = (searchAction || "").trim();
    const q = searchParam || "q";
    const searchText = searchLabel || "Search";
    const hasExplainer = Boolean(howLabel) && Boolean(domainTitle || domainBody || secureTitle || secureBody);
    const hasMenu = items.length > 0 || quick.length > 0 || Boolean(action);

    const searchForm = (mobile: boolean) => (
      <form role="search" action={action} method="get" className={mobile ? "" : "w-full max-w-sm"}>
        <div className="flex">
          <label className="relative block min-w-0 flex-1">
            <span className="sr-only">{searchText}</span>
            <input
              type="search"
              name={q}
              placeholder={searchText}
              className="block min-h-11 w-full rounded-l-lg border-0 bg-white px-3 text-base text-neutral-950 ring-1 ring-neutral-400 ring-inset placeholder:text-neutral-500 focus:z-10 focus:ring-2 focus:ring-indigo-700 focus:outline-none sm:text-sm"
            />
          </label>
          <button type="submit" className={`inline-flex min-h-11 min-w-11 items-center justify-center rounded-r-lg bg-indigo-800 px-3 text-white hover:bg-indigo-900 ${focusRing}`}>
            {searchIcon}
            <span className="sr-only">Search</span>
          </button>
        </div>
      </form>
    );

    return (
      <header className="relative z-30 bg-white">
        {officialText ? (
          <div className="bg-neutral-100 text-xs text-neutral-800 sm:text-sm">
            {hasExplainer ? (
              <details className="group/how">
                <summary className="mx-auto flex min-h-11 max-w-7xl cursor-pointer list-none flex-wrap items-center gap-x-2 rounded px-4 py-1 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-indigo-600 sm:px-6 lg:px-8 [&::-webkit-details-marker]:hidden">
                  <svg aria-hidden="true" viewBox="0 0 20 14" className="h-3 w-4 shrink-0 text-indigo-900">
                    <rect width="20" height="14" rx="1" fill="currentColor" />
                    <path d="M0 4h20M0 8h20M0 12h20" stroke="white" strokeOpacity="0.5" />
                    <rect width="8" height="7" fill="currentColor" />
                  </svg>
                  <span>{officialText}</span>
                  <span className="inline-flex items-center gap-1 font-semibold text-indigo-800 underline underline-offset-2 group-hover/how:text-indigo-950">
                    {howLabel}
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition group-open/how:rotate-180">
                      <path fillRule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
                    </svg>
                  </span>
                </summary>
                <div className="mx-auto grid max-w-7xl grid-cols-1 gap-6 px-4 pt-3 pb-6 sm:px-6 md:grid-cols-2 lg:px-8">
                  {domainTitle || domainBody ? (
                    <div className="flex gap-3">
                      <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="mt-0.5 size-8 shrink-0 text-indigo-800">
                        <path d="M3 21h18M4 10h16M12 3 3 8h18l-9-5ZM6 10v8M10 10v8M14 10v8M18 10v8" strokeLinecap="round" strokeLinejoin="round" />
                      </svg>
                      <p className="leading-6">
                        {domainTitle ? <strong className="block text-neutral-950">{domainTitle}</strong> : null}
                        {domainBody}
                      </p>
                    </div>
                  ) : null}
                  {secureTitle || secureBody ? (
                    <div className="flex gap-3">
                      <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="mt-0.5 size-8 shrink-0 text-indigo-800">
                        <rect x="4.5" y="10.5" width="15" height="10" rx="2" />
                        <path d="M8 10.5V7.5a4 4 0 0 1 8 0v3" strokeLinecap="round" />
                      </svg>
                      <p className="leading-6">
                        {secureTitle ? <strong className="block text-neutral-950">{secureTitle}</strong> : null}
                        {secureBody}
                      </p>
                    </div>
                  ) : null}
                </div>
              </details>
            ) : (
              <p className="mx-auto max-w-7xl px-4 py-3 sm:px-6 lg:px-8">{officialText}</p>
            )}
          </div>
        ) : null}

        <div className="border-b border-neutral-200">
          <div className="mx-auto flex max-w-7xl items-center justify-between gap-6 px-4 py-4 sm:px-6 lg:px-8 lg:py-6">
            {agencyName || sealImageUrl ? (
              <a href={homeHref || "/"} className={`-m-1.5 inline-flex min-h-11 min-w-0 items-center gap-3 rounded-lg p-1.5 sm:gap-4 ${focusRing}`}>
                {sealImageUrl ? <img src={sealImageUrl} alt={sealImageAlt || (agencyName ? "" : "Home")} className="size-12 shrink-0 sm:size-14" /> : sealFallback}
                {agencyName ? (
                  <span className="flex min-w-0 flex-col">
                    <span className="text-lg leading-tight font-bold tracking-tight text-balance text-neutral-950 sm:text-2xl">{agencyName}</span>
                    {agencySubtitle ? <span className="mt-0.5 hidden text-sm text-neutral-600 sm:block">{agencySubtitle}</span> : null}
                  </span>
                ) : null}
              </a>
            ) : (
              <span />
            )}

            <div className="hidden min-w-0 flex-1 flex-col items-end gap-2 lg:flex">
              {quick.length ? (
                <ul role="list" className="flex flex-wrap justify-end gap-x-5">
                  {quick.map((l, i) => (
                    <li key={`${l.label}-${i}`}>
                      <a href={l.href || "#"} className={`inline-flex min-h-11 items-center rounded text-sm font-semibold text-indigo-800 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-800 ${focusRing}`}>
                        {l.label}
                      </a>
                    </li>
                  ))}
                </ul>
              ) : null}
              {action ? searchForm(false) : null}
            </div>

            {hasMenu ? (
              <details className="group/menu shrink-0 lg:hidden">
                <summary
                  className={`inline-flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-lg bg-indigo-800 px-3 text-sm font-semibold text-white hover:bg-indigo-900 [&::-webkit-details-marker]:hidden ${focusRing}`}
                >
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 group-open/menu:hidden">
                    <path fillRule="evenodd" d="M2 4.75A.75.75 0 0 1 2.75 4h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 4.75ZM2 10a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 10Zm0 5.25a.75.75 0 0 1 .75-.75h14.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z" clipRule="evenodd" />
                  </svg>
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="hidden size-5 group-open/menu:block">
                    <path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" />
                  </svg>
                  {menuLabel || "Menu"}
                </summary>
                <div className="absolute inset-x-0 top-full z-40 max-h-svh overflow-y-auto border-b border-neutral-200 bg-white px-4 pt-4 pb-6 shadow-lg sm:px-6">
                  {action ? <div className="mb-4">{searchForm(true)}</div> : null}
                  {items.length ? (
                    <nav aria-label={`${label} (mobile)`}>
                      <ul role="list" className="divide-y divide-neutral-200 border-y border-neutral-200">
                        {items.map((item, i) => (
                          <li key={`${item.label}-${i}`}>
                            <a
                              href={item.href || "#"}
                              aria-current={same(item.href, currentPath) ? "page" : undefined}
                              className={`flex min-h-12 items-center border-l-4 border-transparent px-3 text-base font-semibold text-neutral-900 hover:bg-neutral-50 aria-[current=page]:border-indigo-800 aria-[current=page]:text-indigo-800 ${focusRing}`}
                            >
                              {item.label}
                            </a>
                          </li>
                        ))}
                      </ul>
                    </nav>
                  ) : null}
                  {quick.length ? (
                    <ul role="list" className="mt-4 grid grid-cols-1 gap-2">
                      {quick.map((l, i) => (
                        <li key={`${l.label}-${i}`}>
                          <a href={l.href || "#"} className={`flex min-h-11 items-center rounded-lg px-3 text-base font-semibold text-indigo-800 ring-1 ring-indigo-200 ring-inset hover:bg-indigo-50 ${focusRing}`}>
                            {l.label}
                          </a>
                        </li>
                      ))}
                    </ul>
                  ) : null}
                </div>
              </details>
            ) : null}
          </div>
        </div>

        {items.length ? (
          <nav aria-label={label} className="hidden bg-indigo-900 lg:block">
            <ul role="list" className="mx-auto flex max-w-7xl flex-wrap px-4 sm:px-6 lg:px-8">
              {items.map((item, i) => (
                <li key={`${item.label}-${i}`}>
                  <a
                    href={item.href || "#"}
                    aria-current={same(item.href, currentPath) ? "page" : undefined}
                    className={`inline-flex min-h-12 items-center border-b-4 border-transparent px-4 pt-1 text-sm font-semibold text-white transition hover:bg-indigo-800 aria-[current=page]:border-white aria-[current=page]:bg-indigo-950 focus-visible:outline-2 focus-visible:-outline-offset-4 focus-visible:outline-white`}
                  >
                    {item.label}
                  </a>
                </li>
              ))}
            </ul>
          </nav>
        ) : null}
      </header>
    );
  },
};
```
