# Add the "Patient Portal" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/patient-portal) to this Pantheon Content Publisher (P1) Next.js project. Patient portal call to action: what you can do online, sign-in and enroll buttons, app note and help line.

## Steps

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

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

/**
 * Patient Portal — a call to action for the online patient portal: what people can do there
 * (messages, results, refills, appointments), sign-in and enroll buttons, app availability
 * and a help line for portal questions.
 * Register: `PatientPortalBlock: patientPortalBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Icon = "message" | "results" | "refill" | "calendar" | "bill" | "video";

export type PatientPortalProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  features: { icon: Icon; title: string; text: string }[];
  signInLabel: string;
  signInHref: string;
  enrollLabel: string;
  enrollHref: string;
  appNote: string;
  helpText: string;
  helpPhone: string;
  privacyNote: string;
};

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

const iconPaths: Record<Icon, string> = {
  message:
    "M3.43 2.524A41.29 41.29 0 0 1 10 2c2.236 0 4.43.18 6.57.524 1.437.231 2.43 1.49 2.43 2.902v5.148c0 1.413-.993 2.67-2.43 2.902a41.202 41.202 0 0 1-5.183.501.78.78 0 0 0-.528.224l-3.579 3.58A.75.75 0 0 1 6 17.25v-3.443a41.033 41.033 0 0 1-2.57-.33C1.993 13.244 1 11.986 1 10.573V5.426c0-1.413.993-2.67 2.43-2.902Z",
  results:
    "M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",
  refill:
    "M15.312 11.424a5.5 5.5 0 0 1-9.201 2.466l-.312-.311h2.433a.75.75 0 0 0 0-1.5H3.989a.75.75 0 0 0-.75.75v4.242a.75.75 0 0 0 1.5 0v-2.43l.31.31a7 7 0 0 0 11.712-3.138.75.75 0 0 0-1.449-.39Zm1.23-3.723a.75.75 0 0 0 .219-.53V2.929a.75.75 0 0 0-1.5 0V5.36l-.31-.31A7 7 0 0 0 3.239 8.188a.75.75 0 1 0 1.448.389A5.5 5.5 0 0 1 13.89 6.11l.311.31h-2.432a.75.75 0 0 0 0 1.5h4.243a.75.75 0 0 0 .53-.219Z",
  calendar:
    "M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z",
  bill: "M2.5 4A1.5 1.5 0 0 0 1 5.5V6h18v-.5A1.5 1.5 0 0 0 17.5 4h-15ZM19 8.5H1v6A1.5 1.5 0 0 0 2.5 16h15a1.5 1.5 0 0 0 1.5-1.5v-6ZM3 13.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5h-1.5a.75.75 0 0 1-.75-.75Zm4.75-.75a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5Z",
  video: "M3.25 4A2.25 2.25 0 0 0 1 6.25v7.5A2.25 2.25 0 0 0 3.25 16h7.5A2.25 2.25 0 0 0 13 13.75v-7.5A2.25 2.25 0 0 0 10.75 4h-7.5ZM19 4.75a.75.75 0 0 0-1.28-.53l-3 3a.75.75 0 0 0-.22.53v4.5c0 .199.079.39.22.53l3 3a.75.75 0 0 0 1.28-.53V4.75Z",
};

export const patientPortalBlock: ComponentConfig<PatientPortalProps> = {
  label: "Patient Portal",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "A short label above the heading, like the portal's name. Leave blank to hide." } },
    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. Feature titles use the next level down." },
    },
    intro: { type: "textarea", label: "Intro" },
    features: {
      type: "array",
      label: "What you can do",
      min: 1,
      max: 6,
      getItemSummary: (item) => item?.title || "Feature",
      defaultItemProps: { icon: "message", title: "New feature", text: "" },
      arrayFields: {
        icon: {
          type: "select",
          label: "Icon",
          options: [
            { label: "Message", value: "message" },
            { label: "Test results", value: "results" },
            { label: "Refill", value: "refill" },
            { label: "Calendar", value: "calendar" },
            { label: "Bill", value: "bill" },
            { label: "Video", value: "video" },
          ],
        },
        title: { type: "text", label: "Title" },
        text: { type: "textarea", label: "Text" },
      },
    },
    signInLabel: { type: "text", label: "Sign-in button text", metadata: { help: "Leave blank to hide the button." } },
    signInHref: { type: "text", label: "Sign-in link" },
    enrollLabel: { type: "text", label: "Enroll button text", metadata: { help: "Leave blank to hide the button." } },
    enrollHref: { type: "text", label: "Enroll link" },
    appNote: { type: "text", label: "App note", metadata: { help: "Like Get the free app for iPhone and Android. Leave blank to hide." } },
    helpText: { type: "text", label: "Help line text", metadata: { help: "Like Trouble signing in? Leave blank and remove the phone to hide." } },
    helpPhone: { type: "text", label: "Help line phone" },
    privacyNote: { type: "text", label: "Privacy note", metadata: { help: "A short reassurance about privacy. Leave blank to hide." } },
  },
  defaultProps: {
    eyebrow: "MyLakeshore patient portal",
    heading: "Your health, online any time",
    headingLevel: "h2",
    intro: "Skip the phone tag. Use the portal on your phone or computer to stay in touch with your care team, day or night.",
    features: [
      { icon: "message", title: "Message your care team", text: "Ask a question and get an answer within two business days." },
      { icon: "results", title: "See test results", text: "Most lab results show up as soon as your provider reviews them." },
      { icon: "refill", title: "Request refills", text: "Ask for a refill and pick it up at any Lakeshore pharmacy." },
      { icon: "calendar", title: "Book appointments", text: "Pick a time that works, or change a visit you already have." },
    ],
    signInLabel: "Sign in",
    signInHref: "https://portal.lakeshorehealth.example.org",
    enrollLabel: "Create an account",
    enrollHref: "https://portal.lakeshorehealth.example.org/enroll",
    appNote: "Get the free MyLakeshore app for iPhone and Android.",
    helpText: "Trouble signing in?",
    helpPhone: "(555) 010-2300",
    privacyNote: "Your information is private and protected.",
  },
  render: ({ eyebrow, heading, headingLevel, intro, features, signInLabel, signInHref, enrollLabel, enrollHref, appNote, helpText, helpPhone, privacyNote }) => {
    const H = headingLevel || "h2";
    const Sub = childLevel[H] ?? "h3";
    const list = (features ?? []).filter((f) => f?.title);
    const tel = (helpPhone || "").replace(/[^\d+]/g, "");

    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 overflow-hidden rounded-3xl bg-indigo-950 text-white">
          <div className="grid grid-cols-1 gap-12 p-6 sm:p-10 lg:grid-cols-12 lg:gap-16 lg:p-16">
            <div className="lg:col-span-6">
              {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-200">{eyebrow}</p> : null}
              {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance text-white sm:text-4xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-indigo-100">{intro}</p> : null}

              {signInLabel || enrollLabel ? (
                <div className="mt-8 flex flex-col gap-3 sm:flex-row">
                  {signInLabel ? (
                    <a
                      href={signInHref || "#"}
                      className="inline-flex min-h-12 items-center justify-center gap-2 rounded-lg bg-white px-6 py-3 text-base font-semibold text-indigo-950 shadow-sm transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                    >
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                        <path fillRule="evenodd" d="M10 1a4.5 4.5 0 0 0-4.5 4.5V9H5a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6a2 2 0 0 0-2-2h-.5V5.5A4.5 4.5 0 0 0 10 1Zm3 8V5.5a3 3 0 1 0-6 0V9h6Z" clipRule="evenodd" />
                      </svg>
                      {signInLabel}
                    </a>
                  ) : null}
                  {enrollLabel ? (
                    <a
                      href={enrollHref || "#"}
                      className="inline-flex min-h-12 items-center justify-center rounded-lg px-6 py-3 text-base font-semibold text-white ring-1 ring-white/30 transition ring-inset hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                    >
                      {enrollLabel}
                    </a>
                  ) : null}
                </div>
              ) : null}

              {appNote || privacyNote ? (
                <ul role="list" className="mt-8 space-y-2 text-sm leading-6 text-indigo-100">
                  {appNote ? (
                    <li className="flex gap-2.5">
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-300">
                        <path d="M8 16.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z" />
                        <path fillRule="evenodd" d="M4 4a3 3 0 0 1 3-3h6a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V4Zm4-1.5v.75c0 .414.336.75.75.75h2.5a.75.75 0 0 0 .75-.75V2.5h1A1.5 1.5 0 0 1 14.5 4v12a1.5 1.5 0 0 1-1.5 1.5H7A1.5 1.5 0 0 1 5.5 16V4A1.5 1.5 0 0 1 7 2.5h1Z" clipRule="evenodd" />
                      </svg>
                      {appNote}
                    </li>
                  ) : null}
                  {privacyNote ? (
                    <li className="flex gap-2.5">
                      <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-300">
                        <path fillRule="evenodd" d="M9.661 2.237a.531.531 0 0 1 .678 0 11.947 11.947 0 0 0 7.078 2.749.5.5 0 0 1 .479.425c.069.52.104 1.05.104 1.59 0 5.162-3.26 9.563-7.834 11.256a.48.48 0 0 1-.332 0C5.26 16.564 2 12.163 2 7c0-.538.035-1.069.104-1.589a.5.5 0 0 1 .48-.425 11.947 11.947 0 0 0 7.077-2.75Zm4.196 5.954a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clipRule="evenodd" />
                      </svg>
                      {privacyNote}
                    </li>
                  ) : null}
                </ul>
              ) : null}

              {helpText || tel ? (
                <p className="mt-6 text-sm text-indigo-100">
                  {helpText ? `${helpText} ` : null}
                  {tel ? (
                    <>
                      Call{" "}
                      <a
                        href={`tel:${tel}`}
                        className="-my-3 inline-flex min-h-11 items-center rounded font-semibold text-white tabular-nums underline decoration-indigo-300 underline-offset-4 hover:decoration-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                      >
                        {helpPhone}
                      </a>
                    </>
                  ) : null}
                </p>
              ) : null}
            </div>

            {list.length ? (
              <ul role="list" className="grid grid-cols-1 gap-4 self-center sm:grid-cols-2 lg:col-span-6">
                {list.map((f, i) => (
                  <li key={`${f.title}-${i}`} className={`rounded-2xl bg-white p-5 text-neutral-950 shadow-sm ${i % 2 === 1 ? "sm:translate-y-6" : ""}`}>
                    <span aria-hidden="true" className="grid size-10 place-items-center rounded-xl bg-indigo-100 text-indigo-700">
                      <svg viewBox="0 0 20 20" fill="currentColor" className="size-5">
                        <path fillRule="evenodd" d={iconPaths[f.icon] ?? iconPaths.message} clipRule="evenodd" />
                      </svg>
                    </span>
                    <Sub className="mt-4 text-base font-semibold text-neutral-950">{f.title}</Sub>
                    {f.text ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-600">{f.text}</p> : null}
                  </li>
                ))}
              </ul>
            ) : null}
          </div>
        </div>
      </section>
    );
  },
};
```
