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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/header-simple) to this Pantheon Content Publisher (P1) Next.js project. Wordmark, a short row of links, a quiet secondary link and one button, with an optional sticky mode and a no-JavaScript phone menu.

## Steps

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

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

/**
 * Header (Simple) — wordmark or logo, a short row of links, a quiet sign-in link and one button.
 * The phone menu is a native <details>, so it opens by tap or keyboard with no JavaScript.
 * Register: `HeaderSimpleBlock: headerSimpleBlock` in puck.config.tsx.
 */

export type HeaderSimpleProps = {
  logoText: string;
  logoImageUrl: string;
  logoImageAlt: string;
  logoHref: string;
  navLabel: string;
  links: { label: string; href: string }[];
  currentPath: string;
  secondaryLabel: string;
  secondaryHref: string;
  ctaLabel: string;
  ctaHref: string;
  menuLabel: string;
  sticky: "yes" | "no";
};

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

export const headerSimpleBlock: ComponentConfig<HeaderSimpleProps> = {
  label: "Header (Simple)",
  fields: {
    logoText: { type: "text", label: "Site name", metadata: { help: "Shown beside the logo image, or on its own as a wordmark." } },
    logoImageUrl: { type: "text", label: "Logo image URL", metadata: { help: "Optional. SVG or PNG. 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." } },
    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: 6,
      getItemSummary: (item) => item?.label || "Link",
      defaultItemProps: { label: "New link", href: "/" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        href: { type: "text", label: "Link" },
      },
      metadata: { help: "Four or five links read best. More than six belongs in a mega menu." },
    },
    currentPath: {
      type: "text",
      label: "Current section",
      metadata: { help: "Optional. A path like /programs. The matching link is marked and announced as the current page." },
    },
    secondaryLabel: { type: "text", label: "Secondary link text", metadata: { help: "A quiet text link before the button, like Sign in. Leave blank to hide it." } },
    secondaryHref: { type: "text", label: "Secondary link" },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    ctaHref: { type: "text", label: "Button link", metadata: { help: "A path (/donate), full URL, #anchor, mailto: or tel:." } },
    menuLabel: { type: "text", label: "Mobile menu label", metadata: { help: "The word on the phone-size menu button." } },
    sticky: {
      type: "radio",
      label: "Stick to top",
      options: [
        { label: "No", value: "no" },
        { label: "Yes", value: "yes" },
      ],
      metadata: { help: "Keeps the header pinned while people scroll. Works only when the header is a direct child of the page body." },
    },
  },
  defaultProps: {
    logoText: "Northfield Food Collective",
    logoImageUrl: "",
    logoImageAlt: "",
    logoHref: "/",
    navLabel: "Main",
    links: [
      { label: "Get food", href: "/get-food" },
      { label: "Our pantries", href: "/pantries" },
      { label: "Volunteer", href: "/volunteer" },
      { label: "About", href: "/about" },
    ],
    currentPath: "/get-food",
    secondaryLabel: "Partner login",
    secondaryHref: "/partners",
    ctaLabel: "Give a meal",
    ctaHref: "/give",
    menuLabel: "Menu",
    sticky: "no",
  },
  render: ({ logoText, logoImageUrl, logoImageAlt, logoHref, navLabel, links, currentPath, secondaryLabel, secondaryHref, ctaLabel, ctaHref, menuLabel, sticky }) => {
    const items = (links ?? []).filter((l) => l?.label);
    const label = navLabel || "Main";
    const hasMenu = items.length > 0 || Boolean(secondaryLabel) || Boolean(ctaLabel);

    return (
      <header className={`${sticky === "yes" ? "sticky top-0" : "relative"} z-30 border-b border-neutral-200 bg-white`}>
        <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-9 w-auto shrink-0" /> : null}
              {logoText ? <span className="text-base leading-tight font-semibold tracking-tight text-balance sm:text-lg text-neutral-950">{logoText}</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={`relative inline-flex min-h-11 items-center rounded-lg px-3 text-sm font-medium text-neutral-700 transition hover:text-neutral-950 aria-[current=page]:font-semibold aria-[current=page]:text-neutral-950 aria-[current=page]:after:absolute aria-[current=page]:after:inset-x-3 aria-[current=page]:after:bottom-1.5 aria-[current=page]:after:h-0.5 aria-[current=page]:after:rounded-full aria-[current=page]:after:bg-indigo-600 ${focusRing}`}
                    >
                      {item.label}
                    </a>
                  </li>
                ))}
              </ul>
            </nav>
          ) : null}

          <div className="flex shrink-0 items-center gap-2 sm:gap-4">
            {secondaryLabel ? (
              <a
                href={secondaryHref || "#"}
                className={`hidden min-h-11 items-center rounded-lg px-2 text-sm font-semibold text-neutral-700 transition hover:text-neutral-950 lg:inline-flex ${focusRing}`}
              >
                {secondaryLabel}
              </a>
            ) : null}
            {ctaLabel ? (
              <a
                href={ctaHref || "#"}
                className={`hidden min-h-11 items-center justify-center rounded-full bg-neutral-950 px-5 py-2.5 text-sm font-semibold text-white transition hover:bg-indigo-700 sm:inline-flex ${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-full px-4 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 6.75A.75.75 0 0 1 2.75 6h14.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 6.75Zm0 6.5a.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={`${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 justify-between rounded-lg px-3 text-base font-semibold text-neutral-900 hover:bg-neutral-50 aria-[current=page]:text-indigo-700 ${focusRing}`}
                            >
                              {item.label}
                              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 text-neutral-400">
                                <path fillRule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
                              </svg>
                            </a>
                          </li>
                        ))}
                      </ul>
                    </nav>
                  ) : null}
                  {secondaryLabel || ctaLabel ? (
                    <div className="mt-4 grid grid-cols-1 gap-3 border-t border-neutral-200 pt-4">
                      {ctaLabel ? (
                        <a
                          href={ctaHref || "#"}
                          className={`inline-flex min-h-11 items-center justify-center rounded-full bg-neutral-950 px-5 py-2.5 text-base font-semibold text-white sm:hidden ${focusRing}`}
                        >
                          {ctaLabel}
                        </a>
                      ) : null}
                      {secondaryLabel ? (
                        <a
                          href={secondaryHref || "#"}
                          className={`inline-flex min-h-11 items-center justify-center rounded-full px-5 text-base font-semibold text-neutral-900 ring-1 ring-neutral-300 ring-inset ${focusRing}`}
                        >
                          {secondaryLabel}
                        </a>
                      ) : null}
                    </div>
                  ) : null}
                </div>
              </details>
            ) : null}
          </div>
        </div>
      </header>
    );
  },
};
```
