# Add the "Media Room" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/media-room) to this Pantheon Content Publisher (P1) Next.js project. Newsroom section with dated press releases, a media contact card, brand asset downloads and boilerplate text.

## Steps

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

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

/**
 * Media Room — a newsroom page section: dated press releases, a media contact card,
 * brand asset downloads, and an "about us" boilerplate reporters can copy.
 * Register: `MediaRoomBlock: mediaRoomBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

export type MediaRoomProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  releasesLabel: string;
  releases: { date: string; title: string; summary: string; href: string }[];
  allReleasesLabel: string;
  allReleasesHref: string;
  contactLabel: string;
  contactName: string;
  contactTitle: string;
  contactEmail: string;
  contactPhone: string;
  contactNote: string;
  assetsLabel: string;
  assets: { label: string; meta: string; href: string }[];
  boilerplateLabel: string;
  boilerplate: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };
const grandchild: Record<Heading, "h3" | "h4" | "h5" | "h6"> = { h1: "h3", h2: "h4", h3: "h5", h4: "h6" };

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

export const mediaRoomBlock: ComponentConfig<MediaRoomProps> = {
  label: "Media Room",
  fields: {
    heading: { type: "textarea", label: "Heading" },
    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." },
    },
    intro: { type: "textarea", label: "Intro" },
    releasesLabel: { type: "text", label: "Releases heading" },
    releases: {
      type: "array",
      label: "Press releases",
      min: 0,
      max: 10,
      getItemSummary: (item) => [item?.date, item?.title].filter(Boolean).join(" · ") || "Release",
      defaultItemProps: { date: "2026-01-15", title: "New press release", summary: "", href: "/news" },
      arrayFields: {
        date: { type: "text", label: "Date", metadata: { help: "Use YYYY-MM-DD, like 2026-03-04. Shown as a readable date." } },
        title: { type: "text", label: "Headline" },
        summary: { type: "textarea", label: "Summary", metadata: { help: "Optional. One sentence." } },
        href: { type: "text", label: "Link", metadata: { help: "The release page or PDF." } },
      },
    },
    allReleasesLabel: { type: "text", label: "All releases link text", metadata: { help: "Leave blank to hide it." } },
    allReleasesHref: { type: "text", label: "All releases link" },
    contactLabel: { type: "text", label: "Contact heading" },
    contactName: { type: "text", label: "Contact name" },
    contactTitle: { type: "text", label: "Contact title" },
    contactEmail: { type: "text", label: "Contact email" },
    contactPhone: { type: "text", label: "Contact phone" },
    contactNote: { type: "text", label: "Contact note", metadata: { help: "Like response times or after-hours instructions." } },
    assetsLabel: { type: "text", label: "Brand assets heading" },
    assets: {
      type: "array",
      label: "Brand assets",
      min: 0,
      max: 8,
      getItemSummary: (item) => item?.label || "Asset",
      defaultItemProps: { label: "Logo pack", meta: "ZIP · 2 MB", href: "/files/logo-pack.zip" },
      arrayFields: {
        label: { type: "text", label: "Label" },
        meta: { type: "text", label: "File details", metadata: { help: "Format and size, like ZIP · 4.2 MB." } },
        href: { type: "text", label: "File link" },
      },
    },
    boilerplateLabel: { type: "text", label: "Boilerplate heading", metadata: { help: "Like About Fernbrook Land Trust." } },
    boilerplate: { type: "textarea", label: "Boilerplate", metadata: { help: "The standard paragraph that closes every press release. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Media room",
    headingLevel: "h2",
    intro: "News, contacts and brand assets for journalists covering Fernbrook Land Trust. We aim to answer every media request within one business day.",
    releasesLabel: "Press releases",
    releases: [
      { date: "2026-09-22", title: "Fernbrook Land Trust closes the Millbrook wildlife corridor with 410-acre Harlan farm easement", summary: "The agreement keeps a working orchard in the family and links two state forests.", href: "/news/harlan-easement" },
      { date: "2026-06-14", title: "Weller Meadow accessible trail opens to the public", summary: "", href: "/news/weller-meadow-trail" },
      { date: "2026-04-02", title: "Native brook trout documented in Cold Spring Run after culvert removal", summary: "", href: "/news/cold-spring-trout" },
      { date: "2026-01-20", title: "Fernbrook Land Trust names Dana Whitlock executive director", summary: "", href: "/news/new-executive-director" },
    ],
    allReleasesLabel: "All press releases",
    allReleasesHref: "/news",
    contactLabel: "Media contact",
    contactName: "Jordan Ellery",
    contactTitle: "Communications Manager",
    contactEmail: "press@fernbrooktrust.org",
    contactPhone: "(555) 018-4471",
    contactNote: "For deadlines after 5 p.m., call or text.",
    assetsLabel: "Brand assets",
    assets: [
      { label: "Logo pack", meta: "ZIP · SVG, PNG · 3.1 MB", href: "/files/fernbrook-logos.zip" },
      { label: "Brand guidelines", meta: "PDF · 12 pages · 2.4 MB", href: "/files/fernbrook-brand.pdf" },
      { label: "Press photos", meta: "ZIP · 18 photos · 64 MB", href: "/files/fernbrook-photos.zip" },
      { label: "Leadership headshots", meta: "ZIP · 6 photos · 22 MB", href: "/files/fernbrook-headshots.zip" },
    ],
    boilerplateLabel: "About Fernbrook Land Trust",
    boilerplate:
      "Fernbrook Land Trust is a member-supported nonprofit that protects farms, forests and rivers in the Fernbrook watershed. Since 1987, the trust has conserved more than 14,000 acres and maintains 40 miles of public trails. Learn more at fernbrooktrust.org.",
  },
  render: ({ id, heading, headingLevel, intro, releasesLabel, releases, allReleasesLabel, allReleasesHref, contactLabel, contactName, contactTitle, contactEmail, contactPhone, contactNote, assetsLabel, assets, boilerplateLabel, boilerplate }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const Item = releasesLabel ? (grandchild[H] ?? "h4") : Sub;
    const uid = id || "media";
    const list = (releases ?? []).filter((r) => r?.title);
    const files = (assets ?? []).filter((a) => a?.label);
    const hasContact = Boolean(contactName || contactEmail || contactPhone);
    const tel = (contactPhone || "").replace(/[^0-9+]/g, "");
    const formatDate = (d: string) => {
      const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(d || "");
      if (!m) return d;
      const date = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3]));
      return Number.isNaN(date.getTime()) ? d : date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", timeZone: "UTC" });
    };

    return (
      <section 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-7xl">
          <div className="max-w-2xl">
            {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
            {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
          </div>

          <div className="mt-12 grid grid-cols-1 gap-12 lg:mt-14 lg:grid-cols-12 lg:gap-16">
            <div className="min-w-0 lg:col-span-7">
              {list.length ? (
                <>
                  {releasesLabel ? (
                    <Sub id={`${uid}-releases`} className="text-sm font-semibold tracking-wide text-neutral-950 uppercase">
                      {releasesLabel}
                    </Sub>
                  ) : null}
                  <ol role="list" aria-labelledby={releasesLabel ? `${uid}-releases` : undefined} className={`divide-y divide-neutral-200 border-y border-neutral-200 ${releasesLabel ? "mt-4" : ""}`}>
                    {list.map((r, i) => (
                      <li key={`${r.title}-${i}`}>
                        <article className="group relative flex flex-col gap-1 py-6 sm:flex-row sm:gap-6">
                          {r.date ? (
                            <time dateTime={/^\d{4}-\d{2}-\d{2}$/.test(r.date) ? r.date : undefined} className="text-sm text-neutral-600 tabular-nums sm:w-32 sm:shrink-0 sm:pt-0.5">
                              {formatDate(r.date)}
                            </time>
                          ) : (
                            <span className="hidden sm:block sm:w-32 sm:shrink-0" />
                          )}
                          <div className="min-w-0">
                            <Item className="text-base font-semibold text-pretty text-neutral-950 group-hover:text-indigo-700">
                              {r.href ? (
                                <a href={r.href} className={linkFocus}>
                                  <span aria-hidden="true" className="absolute inset-0" />
                                  {r.title}
                                </a>
                              ) : (
                                r.title
                              )}
                            </Item>
                            {r.summary ? <p className="mt-1.5 text-sm leading-6 text-neutral-600">{r.summary}</p> : null}
                          </div>
                        </article>
                      </li>
                    ))}
                  </ol>
                  {allReleasesLabel ? (
                    <a
                      href={allReleasesHref || "#"}
                      className={`mt-4 inline-flex min-h-11 items-center gap-1.5 text-sm font-semibold text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${linkFocus}`}
                    >
                      {allReleasesLabel}
                    </a>
                  ) : null}
                </>
              ) : null}

              {boilerplate ? (
                <div className="mt-12 rounded-2xl bg-neutral-50 p-6 ring-1 ring-neutral-200 sm:p-8">
                  {boilerplateLabel ? <Sub className="text-sm font-semibold tracking-wide text-neutral-950 uppercase">{boilerplateLabel}</Sub> : null}
                  <p className={`text-base leading-7 text-pretty text-neutral-700 select-all ${boilerplateLabel ? "mt-3" : ""}`}>{boilerplate}</p>
                </div>
              ) : null}
            </div>

            <aside className="space-y-10 lg:col-span-5">
              {hasContact ? (
                <div className="rounded-2xl bg-indigo-950 p-6 text-white sm:p-8">
                  {contactLabel ? <Sub className="text-sm font-semibold tracking-wide text-indigo-200 uppercase">{contactLabel}</Sub> : null}
                  {contactName ? (
                    <p className={contactLabel ? "mt-4" : ""}>
                      <span className="block text-xl font-semibold tracking-tight">{contactName}</span>
                      {contactTitle ? <span className="block text-sm text-indigo-200">{contactTitle}</span> : null}
                    </p>
                  ) : null}
                  <div className="mt-4 flex flex-col text-sm">
                    {contactEmail ? (
                      <a href={`mailto:${contactEmail}`} className="inline-flex min-h-11 max-w-full items-center font-semibold break-all text-white underline decoration-indigo-400 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white">
                        {contactEmail}
                      </a>
                    ) : null}
                    {contactPhone ? (
                      <a href={`tel:${tel}`} className="inline-flex min-h-11 items-center font-semibold text-white underline decoration-indigo-400 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white">
                        {contactPhone}
                      </a>
                    ) : null}
                  </div>
                  {contactNote ? <p className="mt-3 text-sm text-indigo-200">{contactNote}</p> : null}
                </div>
              ) : null}

              {files.length ? (
                <div>
                  {assetsLabel ? (
                    <Sub id={`${uid}-assets`} className="text-sm font-semibold tracking-wide text-neutral-950 uppercase">
                      {assetsLabel}
                    </Sub>
                  ) : null}
                  <ul role="list" aria-labelledby={assetsLabel ? `${uid}-assets` : undefined} className={`grid grid-cols-1 gap-3 ${assetsLabel ? "mt-4" : ""}`}>
                    {files.map((f, i) => (
                      <li key={`${f.label}-${i}`}>
                        <a
                          href={f.href || "#"}
                          download
                          className={`group flex min-h-14 items-center gap-4 rounded-xl px-4 py-3 ring-1 ring-neutral-200 transition ring-inset hover:bg-indigo-50 hover:ring-indigo-300 ${linkFocus}`}
                        >
                          <span aria-hidden="true" className="grid size-10 shrink-0 place-items-center rounded-lg bg-neutral-100 text-neutral-700 transition group-hover:bg-white group-hover:text-indigo-700">
                            <svg viewBox="0 0 20 20" fill="currentColor" className="size-5">
                              <path d="M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z" />
                              <path d="M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z" />
                            </svg>
                          </span>
                          <span className="min-w-0 flex-1">
                            <span className="block text-sm font-semibold text-neutral-950 group-hover:text-indigo-700">{f.label}</span>
                            {f.meta ? <span className="block text-sm text-neutral-600">{f.meta}</span> : null}
                          </span>
                        </a>
                      </li>
                    ))}
                  </ul>
                </div>
              ) : null}
            </aside>
          </div>
        </div>
      </section>
    );
  },
};
```
