# Add the "Site Header" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/site-header) to this Pantheon Content Publisher (P1) Next.js project. Logo, main menu with dropdowns, a button and a skip link. Menus use native disclosure, so they work without JavaScript.

## Steps

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

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

/**
 * Site Header — logo, main navigation with optional dropdowns, and one call-to-action button.
 * Menus are native <details>, so they open by keyboard or tap with no JavaScript.
 * Register: `SiteHeaderBlock: siteHeaderBlock` in puck.config.tsx.
 */

type ChildLink = { label: string; href: string; description: string };
type NavLink = { label: string; href: string; children: ChildLink[] };

export type SiteHeaderProps = {
  logoText: string;
  logoImageUrl: string;
  logoImageAlt: string;
  logoHref: string;
  skipLinkLabel: string;
  skipLinkTarget: string;
  navLabel: string;
  currentPath: string;
  links: NavLink[];
  ctaLabel: string;
  ctaHref: string;
  menuLabel: string;
};

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

const chevron = (
  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-neutral-500 transition group-open: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>
);

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

export const siteHeaderBlock: ComponentConfig<SiteHeaderProps> = {
  label: "Site Header",
  fields: {
    logoText: { type: "text", label: "Site name", metadata: { help: "Shown beside the logo image, or on its own if there's no image." } },
    logoImageUrl: { type: "text", label: "Logo image URL", metadata: { help: "A square or wide logo, ideally SVG or PNG. Leave blank to show the site name only." } },
    logoImageAlt: {
      type: "text",
      label: "Logo alt text",
      metadata: { help: "Leave blank when the site name is shown 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." } },
    skipLinkLabel: { type: "text", label: "Skip link text", metadata: { help: "Appears only when a keyboard user presses Tab first. Leave blank to hide it." } },
    skipLinkTarget: {
      type: "text",
      label: "Skip link target",
      metadata: { help: "Must match the id on your page's <main> element, like #main-content. Without a matching id the skip link goes nowhere." },
    },
    navLabel: { type: "text", label: "Navigation name", metadata: { help: "Read by screen readers, like Main. Name each menu on a page differently." } },
    currentPath: {
      type: "text",
      label: "Current section",
      metadata: { help: "Optional. A path like /programs. The matching link is underlined and announced as the current page." },
    },
    links: {
      type: "array",
      label: "Menu links",
      min: 1,
      max: 7,
      getItemSummary: (item) => (item?.label ? `${item.label}${item?.children?.length ? ` (${item.children.length})` : ""}` : "Link"),
      defaultItemProps: { label: "New link", href: "/", children: [] },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link", metadata: { help: "With sub-links, this becomes an Overview link at the top of the dropdown." } },
        children: {
          type: "array",
          label: "Sub-links",
          min: 0,
          max: 8,
          getItemSummary: (item) => item?.label || "Sub-link",
          defaultItemProps: { label: "New page", href: "/", description: "" },
          arrayFields: {
            label: { type: "text", label: "Label" },
            href: { type: "text", label: "Link" },
            description: { type: "text", label: "Description", metadata: { help: "One short line under the label. Leave blank to hide it." } },
          },
        },
      },
    },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    ctaHref: { type: "text", label: "Button link" },
    menuLabel: { type: "text", label: "Mobile menu label", metadata: { help: "The word on the phone-size menu button." } },
  },
  defaultProps: {
    logoText: "Riverbend Parks",
    logoImageUrl: "",
    logoImageAlt: "",
    logoHref: "/",
    skipLinkLabel: "Skip to main content",
    skipLinkTarget: "#main-content",
    navLabel: "Main",
    currentPath: "/programs",
    links: [
      {
        label: "Parks & trails",
        href: "/parks",
        children: [
          { label: "Find a park", href: "/parks/map", description: "Search 42 parks by amenity and neighborhood." },
          { label: "Trail conditions", href: "/parks/trails", description: "Closures and surface updates, posted daily." },
          { label: "Reserve a shelter", href: "/parks/shelters", description: "Book picnic shelters up to six months out." },
        ],
      },
      {
        label: "Programs",
        href: "/programs",
        children: [
          { label: "Youth & teens", href: "/programs/youth", description: "Camps, sports leagues and after-school clubs." },
          { label: "Adults & seniors", href: "/programs/adults", description: "Fitness, art classes and walking groups." },
          { label: "Financial aid", href: "/programs/aid", description: "Reduced fees for qualifying households." },
        ],
      },
      { label: "Events", href: "/events", children: [] },
      { label: "About", href: "/about", children: [] },
    ],
    ctaLabel: "Register",
    ctaHref: "/register",
    menuLabel: "Menu",
  },
  render: ({ id, logoText, logoImageUrl, logoImageAlt, logoHref, skipLinkLabel, skipLinkTarget, navLabel, currentPath, links, ctaLabel, ctaHref, menuLabel }) => {
    const items = (links ?? []).filter((l) => l?.label);
    const group = `site-header-${id}`;
    const skipTarget = (skipLinkTarget || "").trim();

    const cta = 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;

    return (
      <header className="relative z-30 border-b border-neutral-200 bg-white">
        {skipLinkLabel && skipTarget ? (
          <a
            href={skipTarget.startsWith("#") ? skipTarget : `#${skipTarget}`}
            className={`sr-only rounded-lg bg-indigo-600 px-4 py-3 text-sm font-semibold text-white focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-50 ${focusRing}`}
          >
            {skipLinkLabel}
          </a>
        ) : null}
        <div className="mx-auto flex min-h-16 max-w-7xl items-center justify-between gap-4 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-9 w-auto shrink-0" /> : null}
              {logoText ? <span className="truncate text-lg font-semibold tracking-tight text-neutral-950">{logoText}</span> : null}
            </a>
          ) : (
            <span />
          )}

          {items.length ? (
            <nav aria-label={navLabel || "Main"} className="hidden lg:block">
              <ul role="list" className="flex items-center gap-1">
                {items.map((item, i) => {
                  const kids = (item.children ?? []).filter((c) => c?.label);
                  const current = isCurrent(item.href, currentPath) || kids.some((c) => isCurrent(c.href, currentPath));
                  const base = `inline-flex min-h-11 items-center gap-1 rounded-lg px-3 text-sm font-semibold text-neutral-800 transition hover:bg-neutral-50 hover:text-neutral-950 ${focusRing} ${
                    current ? "underline decoration-indigo-600 decoration-2 underline-offset-8" : ""
                  }`;
                  if (!kids.length) {
                    return (
                      <li key={`${item.label}-${i}`}>
                        <a href={item.href || "#"} aria-current={isCurrent(item.href, currentPath) ? "page" : undefined} className={base}>
                          {item.label}
                        </a>
                      </li>
                    );
                  }
                  return (
                    <li key={`${item.label}-${i}`}>
                      <details name={group} className="group relative">
                        <summary className={`${base} cursor-pointer list-none [&::-webkit-details-marker]:hidden`}>
                          {item.label}
                          {chevron}
                        </summary>
                        <div className="absolute top-full left-1/2 z-40 mt-3 w-80 -translate-x-1/2 rounded-2xl bg-white p-2 shadow-xl ring-1 ring-neutral-950/5">
                          <ul role="list">
                            {item.href ? (
                              <li>
                                <a
                                  href={item.href}
                                  aria-current={isCurrent(item.href, currentPath) ? "page" : undefined}
                                  className={`flex min-h-11 items-center justify-between gap-3 rounded-xl px-4 py-3 text-sm font-semibold text-indigo-700 hover:bg-indigo-50 ${focusRing}`}
                                >
                                  <span>
                                    {item.label} overview
                                  </span>
                                  <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>
                              </li>
                            ) : null}
                            {kids.map((kid, j) => (
                              <li key={`${kid.label}-${j}`}>
                                <a
                                  href={kid.href || "#"}
                                  aria-current={isCurrent(kid.href, currentPath) ? "page" : undefined}
                                  className={`block min-h-11 rounded-xl px-4 py-3 transition hover:bg-neutral-50 aria-[current=page]:bg-indigo-50 ${focusRing}`}
                                >
                                  <span className="block text-sm font-semibold text-neutral-950">{kid.label}</span>
                                  {kid.description ? <span className="mt-0.5 block text-sm leading-5 text-neutral-600">{kid.description}</span> : null}
                                </a>
                              </li>
                            ))}
                          </ul>
                        </div>
                      </details>
                    </li>
                  );
                })}
              </ul>
            </nav>
          ) : null}

          <div className="flex shrink-0 items-center gap-2">
            {cta ? <div className="hidden sm:block">{cta}</div> : null}
            {items.length || cta ? (
              <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-2 pb-6 shadow-lg sm:px-6">
                  {items.length ? (
                    <nav aria-label={`${navLabel || "Main"} (mobile)`}>
                      <ul role="list" className="divide-y divide-neutral-100">
                        {items.map((item, i) => {
                          const kids = (item.children ?? []).filter((c) => c?.label);
                          return (
                            <li key={`${item.label}-${i}`} className="py-2">
                              {item.href ? (
                                <a
                                  href={item.href}
                                  aria-current={isCurrent(item.href, currentPath) ? "page" : undefined}
                                  className={`flex min-h-11 items-center rounded-lg px-3 text-base font-semibold text-neutral-950 hover:bg-neutral-50 aria-[current=page]:text-indigo-700 ${focusRing}`}
                                >
                                  {item.label}
                                </a>
                              ) : (
                                <p className="flex min-h-11 items-center px-3 text-base font-semibold text-neutral-950">{item.label}</p>
                              )}
                              {kids.length ? (
                                <ul role="list" className="mt-1 ml-3 border-l border-neutral-200 pl-3">
                                  {kids.map((kid, j) => (
                                    <li key={`${kid.label}-${j}`}>
                                      <a
                                        href={kid.href || "#"}
                                        aria-current={isCurrent(kid.href, currentPath) ? "page" : undefined}
                                        className={`flex min-h-11 items-center rounded-lg px-3 text-base text-neutral-700 hover:bg-neutral-50 hover:text-neutral-950 aria-[current=page]:font-semibold aria-[current=page]:text-indigo-700 ${focusRing}`}
                                      >
                                        {kid.label}
                                      </a>
                                    </li>
                                  ))}
                                </ul>
                              ) : null}
                            </li>
                          );
                        })}
                      </ul>
                    </nav>
                  ) : null}
                  {cta ? <div className="mt-4 grid grid-cols-1 sm:hidden">{cta}</div> : null}
                </div>
              </details>
            ) : null}
          </div>
        </div>
      </header>
    );
  },
};
```
