# Add the "Header — Utility Bar" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/header-utility) to this Pantheon Content Publisher (P1) Next.js project. A dark top strip for phone, language links, small links and site search above the main bar with logo, menu and button.

## Steps

1. Create `components/puck/header-utility-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 { headerUtilityBlock } from "./components/puck/header-utility-block";`
3. Register it under `components` as `HeaderUtilityBlock: headerUtilityBlock`.
4. Add `"HeaderUtilityBlock"` 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-utility-block.tsx`

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

/**
 * Header (Utility Bar) — a dark strip for phone, languages, small links and site search,
 * above the main bar with logo, menu and button. Search is a plain GET form; menus are native <details>.
 * Register: `HeaderUtilityBlock: headerUtilityBlock` in puck.config.tsx.
 */

export type HeaderUtilityProps = {
  contactLabel: string;
  contactHref: string;
  languages: { label: string; href: string; lang: string }[];
  utilityLinks: { label: string; href: string }[];
  searchAction: string;
  searchParam: string;
  searchLabel: string;
  logoText: string;
  logoImageUrl: string;
  logoImageAlt: string;
  logoHref: string;
  tagline: string;
  navLabel: string;
  links: { label: string; href: string }[];
  currentPath: string;
  ctaLabel: string;
  ctaHref: string;
  menuLabel: string;
};

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

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>
);

export const headerUtilityBlock: ComponentConfig<HeaderUtilityProps> = {
  label: "Header (Utility Bar)",
  fields: {
    contactLabel: { type: "text", label: "Contact text", metadata: { help: "First item in the top strip, like a phone number. Leave blank to hide it." } },
    contactHref: { type: "text", label: "Contact link", metadata: { help: "A tel: or mailto: link, or a path like /contact." } },
    languages: {
      type: "array",
      label: "Languages",
      min: 0,
      max: 6,
      getItemSummary: (item) => item?.label || "Language",
      defaultItemProps: { label: "Español", href: "/es", lang: "es" },
      arrayFields: {
        label: { type: "text", label: "Label", metadata: { help: "Write each language in that language, like Español or Tiếng Việt." } },
        href: { type: "text", label: "Link" },
        lang: { type: "text", label: "Language code", metadata: { help: "Like es, vi or zh-Hans, so screen readers pronounce the label correctly." } },
      },
    },
    utilityLinks: {
      type: "array",
      label: "Top strip links",
      min: 0,
      max: 4,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "/" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
      metadata: { help: "Small secondary links like News or Careers. On phones they move into the menu." },
    },
    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, like Search the site." } },
    logoText: { type: "text", label: "Site name" },
    logoImageUrl: { type: "text", label: "Logo image URL", metadata: { help: "Optional. Leave blank for a text wordmark." } },
    logoImageAlt: {
      type: "text",
      label: "Logo alt text",
      metadata: { help: "Leave blank when the site name shows next to the logo, so screen readers don't hear the name twice." },
    },
    logoHref: { type: "text", label: "Logo link", metadata: { help: "Usually / for the home page." } },
    tagline: { type: "text", label: "Tagline", metadata: { help: "A short line under the site name on wide screens. Leave blank to hide it." } },
    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: 7,
      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." } },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Stays visible on phones beside the menu. Leave blank to hide it." } },
    ctaHref: { type: "text", label: "Button link" },
    menuLabel: { type: "text", label: "Mobile menu label" },
  },
  defaultProps: {
    contactLabel: "Helpline (502) 555-0144",
    contactHref: "tel:+15025550144",
    languages: [
      { label: "English", href: "/", lang: "en" },
      { label: "Español", href: "/es", lang: "es" },
      { label: "Tiếng Việt", href: "/vi", lang: "vi" },
    ],
    utilityLinks: [
      { label: "News", href: "/news" },
      { label: "Careers", href: "/careers" },
    ],
    searchAction: "/search",
    searchParam: "q",
    searchLabel: "Search the site",
    logoText: "Bluegrass Legal Aid",
    logoImageUrl: "",
    logoImageAlt: "",
    logoHref: "/",
    tagline: "Free civil legal help since 1966",
    navLabel: "Main",
    links: [
      { label: "Get help", href: "/help" },
      { label: "Housing", href: "/housing" },
      { label: "Family law", href: "/family" },
      { label: "Clinics", href: "/clinics" },
      { label: "About", href: "/about" },
    ],
    currentPath: "",
    ctaLabel: "Donate",
    ctaHref: "/donate",
    menuLabel: "Menu",
  },
  render: ({ contactLabel, contactHref, languages, utilityLinks, searchAction, searchParam, searchLabel, logoText, logoImageUrl, logoImageAlt, logoHref, tagline, navLabel, links, currentPath, ctaLabel, ctaHref, menuLabel }) => {
    const langs = (languages ?? []).filter((l) => l?.label);
    const utility = (utilityLinks ?? []).filter((l) => l?.label);
    const items = (links ?? []).filter((l) => l?.label);
    const label = navLabel || "Main";
    const action = (searchAction || "").trim();
    const q = searchParam || "q";
    const searchText = searchLabel || "Search";
    const hasStrip = Boolean(contactLabel) || langs.length > 0 || utility.length > 0 || Boolean(action);
    const hasMenu = items.length > 0 || utility.length > 0 || Boolean(action);

    return (
      <header className="relative z-30 bg-white">
        {hasStrip ? (
          <div className="bg-neutral-950 text-sm text-neutral-300">
            <div className="mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-x-6 px-4 sm:px-6 lg:px-8">
              {contactLabel ? (
                <a href={contactHref || "#"} className={`inline-flex min-h-11 items-center gap-2 rounded font-medium text-white hover:text-indigo-200 ${focusRingDark}`}>
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 shrink-0 text-indigo-300">
                    <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-.97.33a.75.75 0 0 0-.457.975 11.026 11.026 0 0 0 6.29 6.29.75.75 0 0 0 .975-.456l.33-.97a1.5 1.5 0 0 1 1.745-1.02l2.31.513A1.5 1.5 0 0 1 18 15.352V16.5a1.5 1.5 0 0 1-1.5 1.5H15c-1.149 0-2.263-.15-3.326-.43A13.022 13.022 0 0 1 2.43 8.326 13.019 13.019 0 0 1 2 5V3.5Z" clipRule="evenodd" />
                  </svg>
                  {contactLabel}
                </a>
              ) : (
                <span />
              )}
              <div className="flex flex-wrap items-center gap-x-6">
                {langs.length ? (
                  <nav aria-label="Language">
                    <ul role="list" className="flex flex-wrap items-center gap-x-1">
                      {langs.map((l, i) => (
                        <li key={`${l.label}-${i}`} className="flex items-center gap-x-1">
                          {i > 0 ? <span aria-hidden="true" className="text-neutral-600">/</span> : null}
                          <a
                            href={l.href || "#"}
                            lang={l.lang || undefined}
                            hrefLang={l.lang || undefined}
                            className={`inline-flex min-h-11 items-center rounded px-1 hover:text-white hover:underline hover:underline-offset-4 ${focusRingDark}`}
                          >
                            {l.label}
                          </a>
                        </li>
                      ))}
                    </ul>
                  </nav>
                ) : null}
                {utility.length ? (
                  <ul role="list" className="hidden items-center gap-x-4 lg:flex">
                    {utility.map((u, i) => (
                      <li key={`${u.label}-${i}`}>
                        <a href={u.href || "#"} className={`inline-flex min-h-11 items-center rounded hover:text-white hover:underline hover:underline-offset-4 ${focusRingDark}`}>
                          {u.label}
                        </a>
                      </li>
                    ))}
                  </ul>
                ) : null}
                {action ? (
                  <form role="search" action={action} method="get" className="hidden py-1 lg:block">
                    <label className="relative block">
                      <span className="sr-only">{searchText}</span>
                      <span className="pointer-events-none absolute inset-y-0 left-3 flex items-center text-neutral-400">{searchIcon}</span>
                      <input
                        type="search"
                        name={q}
                        placeholder={searchText}
                        className="block min-h-11 w-60 rounded-full border-0 bg-neutral-800 py-1.5 pr-4 pl-10 text-sm text-white ring-1 ring-neutral-700 ring-inset placeholder:text-neutral-400 focus:ring-2 focus:ring-white focus:outline-none"
                      />
                    </label>
                  </form>
                ) : null}
              </div>
            </div>
          </div>
        ) : null}

        <div className="border-b border-neutral-200">
          <div className="mx-auto flex min-h-16 max-w-7xl items-center justify-between gap-6 px-4 py-2 sm:px-6 lg:min-h-20 lg:px-8">
            {logoText || logoImageUrl ? (
              <a href={logoHref || "/"} className={`-m-1.5 inline-flex min-h-11 min-w-0 items-center gap-3 rounded-lg p-1.5 ${focusRing}`}>
                {logoImageUrl ? <img src={logoImageUrl} alt={logoImageAlt || ""} className="h-10 w-auto shrink-0" /> : null}
                {logoText ? (
                  <span className="flex min-w-0 flex-col">
                    <span className="text-base leading-tight font-semibold text-balance sm:text-lg tracking-tight text-neutral-950">{logoText}</span>
                    {tagline ? <span className="hidden truncate text-xs text-neutral-600 sm:block">{tagline}</span> : null}
                  </span>
                ) : null}
              </a>
            ) : (
              <span />
            )}

            {items.length ? (
              <nav aria-label={label} className="hidden lg:block">
                <ul role="list" className="flex items-center gap-1">
                  {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-11 items-center rounded-lg px-3 text-sm font-semibold text-neutral-800 transition hover:bg-neutral-100 hover:text-neutral-950 aria-[current=page]:bg-indigo-50 aria-[current=page]:text-indigo-800 ${focusRing}`}
                      >
                        {item.label}
                      </a>
                    </li>
                  ))}
                </ul>
              </nav>
            ) : null}

            <div className="flex shrink-0 items-center gap-2">
              {ctaLabel ? (
                <a
                  href={ctaHref || "#"}
                  className={`inline-flex min-h-11 items-center justify-center rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-700 ${focusRing}`}
                >
                  {ctaLabel}
                </a>
              ) : null}
              {hasMenu ? (
                <details className="group lg:hidden">
                  <summary
                    className={`inline-flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-lg px-3 text-sm font-semibold text-neutral-900 ring-1 ring-neutral-300 ring-inset hover:bg-neutral-50 [&::-webkit-details-marker]:hidden ${focusRing}`}
                  >
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 group-open: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: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 ? (
                      <form role="search" action={action} method="get" className="mb-3">
                        <label className="relative block">
                          <span className="sr-only">{searchText}</span>
                          <span className="pointer-events-none absolute inset-y-0 left-3 flex items-center text-neutral-500">{searchIcon}</span>
                          <input
                            type="search"
                            name={q}
                            placeholder={searchText}
                            className="block min-h-12 w-full rounded-lg border-0 bg-white py-2 pr-4 pl-10 text-base text-neutral-950 ring-1 ring-neutral-300 ring-inset placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none"
                          />
                        </label>
                      </form>
                    ) : null}
                    {items.length ? (
                      <nav aria-label={`${label} (mobile)`}>
                        <ul role="list" className="divide-y divide-neutral-100">
                          {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 rounded-lg px-3 text-base font-semibold text-neutral-900 hover:bg-neutral-50 aria-[current=page]:text-indigo-700 ${focusRing}`}
                              >
                                {item.label}
                              </a>
                            </li>
                          ))}
                        </ul>
                      </nav>
                    ) : null}
                    {utility.length ? (
                      <ul role="list" className="mt-3 flex flex-wrap gap-x-4 border-t border-neutral-200 pt-3">
                        {utility.map((u, i) => (
                          <li key={`${u.label}-${i}`}>
                            <a href={u.href || "#"} className={`inline-flex min-h-11 items-center rounded px-3 text-sm font-medium text-neutral-700 hover:text-neutral-950 ${focusRing}`}>
                              {u.label}
                            </a>
                          </li>
                        ))}
                      </ul>
                    ) : null}
                  </div>
                </details>
              ) : null}
            </div>
          </div>
        </div>
      </header>
    );
  },
};
```
