# Add the "Event List" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/event-list) to this Pantheon Content Publisher (P1) Next.js project. Upcoming events with date tiles, times, locations and categories.

## Steps

1. Create `components/puck/event-list-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 { eventListBlock } from "./components/puck/event-list-block";`
3. Register it under `components` as `EventListBlock: eventListBlock`.
4. Add `"EventListBlock"` 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/event-list-block.tsx`

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

/**
 * Event List — upcoming events as calendar-tile rows with time, place and category.
 * Each row is one large link target. Register: `EventListBlock: eventListBlock` in puck.config.tsx.
 */

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

type EventItem = {
  month: string;
  day: string;
  datetime: string;
  title: string;
  time: string;
  location: string;
  category: string;
  href: string;
};

export type EventListProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  allLabel: string;
  allHref: string;
  events: EventItem[];
};

const childLevel = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;

export const eventListBlock: ComponentConfig<EventListProps> = {
  label: "Event List",
  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" },
    allLabel: { type: "text", label: "All events link text", metadata: { help: "Leave blank to hide it." } },
    allHref: { type: "text", label: "All events link" },
    events: {
      type: "array",
      label: "Events",
      min: 1,
      max: 12,
      getItemSummary: (item) => [item?.month, item?.day].filter(Boolean).join(" ") + (item?.title ? ` · ${item.title.slice(0, 40)}` : "") || "Event",
      defaultItemProps: {
        month: "NOV",
        day: "1",
        datetime: "",
        title: "New event",
        time: "10:00 a.m. – 12:00 p.m.",
        location: "Community Center",
        category: "",
        href: "",
      },
      arrayFields: {
        month: { type: "text", label: "Month", metadata: { help: "Short form, like OCT." } },
        day: { type: "text", label: "Day", metadata: { help: "Day of the month, like 18." } },
        datetime: { type: "text", label: "Machine-readable date", metadata: { help: "Optional. YYYY-MM-DD (2026-10-18) helps search engines and assistive tech read the date." } },
        title: { type: "text", label: "Title" },
        time: { type: "text", label: "Time", metadata: { help: "Free text, like 9:00 a.m. – noon." } },
        location: { type: "text", label: "Location" },
        category: { type: "text", label: "Category", metadata: { help: "Short tag, like Family or Volunteer. Leave blank to hide it." } },
        href: { type: "text", label: "Event link", metadata: { help: "Leave blank if there's no detail page." } },
      },
    },
  },
  defaultProps: {
    heading: "Upcoming events",
    headingLevel: "h2",
    intro: "Free and low-cost ways to get outside, meet your neighbors and pitch in this season.",
    allLabel: "View the full calendar",
    allHref: "/events",
    events: [
      {
        month: "OCT",
        day: "18",
        datetime: "2026-10-18",
        title: "Riverside Trail Cleanup",
        time: "9:00 a.m. – noon",
        location: "Riverside Park, north pavilion",
        category: "Volunteer",
        href: "/events/riverside-trail-cleanup",
      },
      {
        month: "OCT",
        day: "24",
        datetime: "2026-10-24",
        title: "Fall Harvest Festival",
        time: "11:00 a.m. – 4:00 p.m.",
        location: "Oak Hollow Community Center",
        category: "Family",
        href: "/events/fall-harvest-festival",
      },
      {
        month: "NOV",
        day: "4",
        datetime: "2026-11-04",
        title: "Parks Master Plan Public Meeting",
        time: "6:30 – 8:00 p.m.",
        location: "City Hall, Council Chambers",
        category: "Civic",
        href: "/events/master-plan-meeting",
      },
      {
        month: "NOV",
        day: "15",
        datetime: "2026-11-15",
        title: "Guided Birding Walk for Beginners",
        time: "7:30 – 9:00 a.m.",
        location: "Heron Marsh Nature Preserve",
        category: "Nature",
        href: "/events/beginner-birding-walk",
      },
    ],
  },
  render: ({ heading, headingLevel, intro, allLabel, allHref, events }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (events ?? []).filter((e) => e?.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-7xl">
          {heading || intro || allLabel ? (
            <div className="flex flex-col gap-6 sm:flex-row sm:items-end sm:justify-between">
              <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>
              {allLabel ? (
                <a
                  href={allHref || "#"}
                  className="group inline-flex min-h-11 shrink-0 items-center gap-1.5 self-start rounded font-semibold text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:self-auto"
                >
                  {allLabel}
                  <svg aria-hidden="true" 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>
                </a>
              ) : null}
            </div>
          ) : null}
          {list.length ? (
            <ul role="list" className={`divide-y divide-neutral-200 border-y border-neutral-200 ${heading || intro || allLabel ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((event, i) => {
                const DateTag = event.datetime ? "time" : "div";
                return (
                  <li key={`${event.title}-${i}`} className="group">
                    <div className="relative -mx-4 flex gap-4 rounded-2xl px-4 py-6 transition group-hover:bg-neutral-50 sm:-mx-6 sm:gap-6 sm:px-6">
                      <DateTag
                        {...(event.datetime ? { dateTime: event.datetime } : {})}
                        className="flex w-16 shrink-0 flex-col self-start overflow-hidden rounded-xl bg-white text-center ring-1 ring-neutral-200 sm:w-20"
                      >
                        {event.month ? (
                          <span className="bg-indigo-600 py-1 text-xs font-semibold tracking-widest text-white uppercase">{event.month}</span>
                        ) : null}
                        {event.day ? (
                          <span className="py-2 text-2xl font-semibold tracking-tight text-neutral-950 tabular-nums sm:text-3xl">{event.day}</span>
                        ) : null}
                      </DateTag>
                      <div className="min-w-0 flex-1 sm:flex sm:items-center sm:gap-6">
                        <div className="min-w-0 flex-1">
                          {event.category ? (
                            <p className="mb-2 inline-flex rounded-full bg-indigo-50 px-2.5 py-0.5 text-xs font-medium text-indigo-700 ring-1 ring-indigo-600/15 ring-inset">
                              {event.category}
                            </p>
                          ) : null}
                          <Sub className="text-lg font-semibold tracking-tight text-pretty text-neutral-950 sm:text-xl">
                            {event.href ? (
                              <a
                                href={event.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"
                              >
                                {event.title}
                              </a>
                            ) : (
                              event.title
                            )}
                          </Sub>
                          {event.time || event.location ? (
                            <dl className="mt-3 flex flex-col gap-2 text-sm leading-6 text-neutral-600 sm:flex-row sm:flex-wrap sm:gap-x-6">
                              {event.time ? (
                                <div className="flex items-start gap-2">
                                  <dt>
                                    <span className="sr-only">Time</span>
                                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 text-neutral-400">
                                      <path fillRule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z" clipRule="evenodd" />
                                    </svg>
                                  </dt>
                                  <dd>{event.time}</dd>
                                </div>
                              ) : null}
                              {event.location ? (
                                <div className="flex items-start gap-2">
                                  <dt>
                                    <span className="sr-only">Location</span>
                                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 text-neutral-400">
                                      <path fillRule="evenodd" d="m9.69 18.933.003.001C9.89 19.02 10 19 10 19s.11.02.308-.066l.002-.001.006-.003.018-.008a5.741 5.741 0 0 0 .281-.14c.186-.096.446-.24.757-.433.62-.384 1.445-.966 2.274-1.765C15.302 14.988 17 12.493 17 9A7 7 0 1 0 3 9c0 3.492 1.698 5.988 3.355 7.584a13.731 13.731 0 0 0 2.273 1.765 11.842 11.842 0 0 0 .976.544l.062.029.018.008.006.003ZM10 11.25a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Z" clipRule="evenodd" />
                                    </svg>
                                  </dt>
                                  <dd className="min-w-0">{event.location}</dd>
                                </div>
                              ) : null}
                            </dl>
                          ) : null}
                        </div>
                        {event.href ? (
                          <span
                            aria-hidden="true"
                            className="hidden size-11 shrink-0 place-items-center rounded-full text-neutral-400 ring-1 ring-neutral-200 transition group-hover:bg-indigo-600 group-hover:text-white group-hover:ring-indigo-600 sm:grid"
                          >
                            <svg viewBox="0 0 20 20" fill="currentColor" className="size-5 transition group-hover:translate-x-0.5">
                              <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>
                          </span>
                        ) : null}
                      </div>
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
