# Add the "Resource Downloads" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/resource-downloads) to this Pantheon Content Publisher (P1) Next.js project. Agendas, reports and forms with file type and size spoken to screen reader users.

## Steps

1. Create `components/puck/resource-downloads-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 { resourceDownloadsBlock } from "./components/puck/resource-downloads-block";`
3. Register it under `components` as `ResourceDownloadsBlock: resourceDownloadsBlock`.
4. Add `"ResourceDownloadsBlock"` to the best-fitting entry in `categories` (this block's library category is "Civic & utility"). 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/resource-downloads-block.tsx`

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

/**
 * Resource Downloads — a document list for agendas, minutes, reports and forms. Each row
 * labels its file type in text and tells screen readers the format and size before they click.
 * Register: `ResourceDownloadsBlock: resourceDownloadsBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type FileType = "PDF" | "DOC" | "XLS" | "ZIP" | "Link";

export type ResourceDownloadsProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  files: {
    title: string;
    description: string;
    fileType: FileType;
    fileSize: string;
    date: string;
    href: string;
  }[];
};

export const resourceDownloadsBlock: ComponentConfig<ResourceDownloadsProps> = {
  label: "Resource Downloads",
  fields: {
    heading: { type: "text", 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" },
    files: {
      type: "array",
      label: "Documents",
      min: 1,
      max: 30,
      getItemSummary: (item) => (item?.title ? `${item.fileType || "File"} · ${item.title.slice(0, 40)}` : "Document"),
      defaultItemProps: { title: "New document", description: "", fileType: "PDF", fileSize: "", date: "", href: "" },
      arrayFields: {
        title: { type: "text", label: "Title" },
        description: { type: "textarea", label: "Description", metadata: { help: "One short sentence. Leave blank to hide it." } },
        fileType: {
          type: "select",
          label: "File type",
          options: [
            { label: "PDF", value: "PDF" },
            { label: "Word (DOC)", value: "DOC" },
            { label: "Excel (XLS)", value: "XLS" },
            { label: "ZIP archive", value: "ZIP" },
            { label: "Web link", value: "Link" },
          ],
        },
        fileSize: { type: "text", label: "File size", metadata: { help: "Like 2.4 MB. Helps people on slow or metered connections." } },
        date: { type: "text", label: "Date", metadata: { help: "Free text, like Posted Oct 2, 2026." } },
        href: { type: "text", label: "File link", metadata: { help: "Upload the file to your media library and paste its URL." } },
      },
    },
  },
  defaultProps: {
    heading: "Meeting documents",
    headingLevel: "h2",
    intro: "Agendas are posted at least 72 hours before each Park Board meeting. Need a document in another format? Email the board clerk and we'll provide one.",
    files: [
      {
        title: "October 2026 Park Board Agenda",
        description: "Regular meeting, Thursday, October 15 at 6:30 p.m. in Council Chambers.",
        fileType: "PDF",
        fileSize: "412 KB",
        date: "Posted Oct 9, 2026",
        href: "/documents/park-board-agenda-2026-10.pdf",
      },
      {
        title: "FY2027 Proposed Operating Budget",
        description: "Line-item detail for all divisions, with prior-year actuals for comparison.",
        fileType: "XLS",
        fileSize: "1.8 MB",
        date: "Posted Sep 28, 2026",
        href: "/documents/fy2027-proposed-budget.xlsx",
      },
      {
        title: "2025 Annual Report to the Community",
        description: "Attendance, acres maintained, volunteer hours and audited financials.",
        fileType: "PDF",
        fileSize: "6.2 MB",
        date: "Published Mar 3, 2026",
        href: "/documents/annual-report-2025.pdf",
      },
      {
        title: "Shelter and Field Rental Application",
        description: "Fill out and return to any community center front desk.",
        fileType: "DOC",
        fileSize: "88 KB",
        date: "Updated Jan 12, 2026",
        href: "/documents/facility-rental-application.docx",
      },
      {
        title: "Archived Meeting Recordings",
        description: "Video of every Park Board meeting since 2019.",
        fileType: "Link",
        fileSize: "",
        date: "",
        href: "/meetings/archive",
      },
    ],
  },
  render: ({ heading, headingLevel, intro, files }) => {
    const H = headingLevel || "h2";
    const list = (files ?? []).filter((f) => f?.title);
    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-5xl">
          {heading || intro ? (
            <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-base leading-7 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
          ) : null}
          {list.length ? (
            <ul role="list" className={`divide-y divide-neutral-200 border-y border-neutral-200 ${heading || intro ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((file, i) => {
                const type: FileType = file.fileType || "PDF";
                const isLink = type === "Link";
                const srHint = isLink ? "" : ` (${[type, file.fileSize].filter(Boolean).join(", ")})`;
                const meta = [file.date, isLink ? "" : file.fileSize].filter(Boolean);
                return (
                  <li key={`${file.title}-${i}`} className="group">
                    <div className="relative -mx-4 flex items-start gap-4 rounded-2xl px-4 py-5 transition group-hover:bg-neutral-50 sm:-mx-6 sm:items-center sm:gap-6 sm:px-6">
                      <span
                        aria-hidden="true"
                        className={`relative flex h-14 w-11 shrink-0 items-end justify-center rounded-md rounded-tr-2xl pb-1.5 ring-1 ring-inset ${
                          isLink ? "bg-neutral-100 text-neutral-700 ring-neutral-300" : "bg-indigo-50 text-indigo-800 ring-indigo-600/20"
                        }`}
                      >
                        <span className="text-xs font-bold tracking-wide">{isLink ? "LINK" : type}</span>
                      </span>
                      <div className="min-w-0 flex-1">
                        <p className="text-base font-semibold text-pretty text-neutral-950 sm:text-lg">
                          {file.href ? (
                            <a
                              href={file.href}
                              className="rounded-2xl outline-none after:absolute after:inset-0 after:rounded-2xl focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-indigo-600"
                            >
                              {file.title}
                              {srHint ? <span className="sr-only">{srHint}</span> : null}
                            </a>
                          ) : (
                            file.title
                          )}
                        </p>
                        {file.description ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-600">{file.description}</p> : null}
                        {meta.length ? (
                          <p className="mt-2 flex flex-wrap items-center gap-x-2 text-sm leading-6 text-neutral-600">
                            {meta.map((m, j) => (
                              <span key={j} className="flex items-center gap-2">
                                {j > 0 ? <span aria-hidden="true" className="size-1 rounded-full bg-neutral-400" /> : null}
                                {m}
                              </span>
                            ))}
                          </p>
                        ) : null}
                      </div>
                      {file.href ? (
                        <span
                          aria-hidden="true"
                          className="hidden size-11 shrink-0 place-items-center rounded-full text-neutral-500 ring-1 ring-neutral-200 transition group-hover:bg-indigo-600 group-hover:text-white group-hover:ring-indigo-600 sm:grid"
                        >
                          {isLink ? (
                            <svg viewBox="0 0 20 20" fill="currentColor" className="size-5 transition group-hover:translate-x-0.5">
                              <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>
                          ) : (
                            <svg viewBox="0 0 20 20" fill="currentColor" className="size-5 transition group-hover:translate-y-0.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>
                      ) : null}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
