# Hero with deployment panel (带部署面板的首屏)

Left-aligned hero with an oversized headline and a wide deployment detail panel that runs off the bottom edge: pipeline, live build log, preview URL and one-click rollback.

- Ref: `component/hero-product-panel` (component · hero)
- Page: https://uifino.com/en/components/hero/hero-product-panel
- Markdown: https://uifino.com/md/components/hero-product-panel.md
- Preview image: https://uifino.com/blocks/covers/hero-product-panel-dark.webp

## Install

- shadcn: `npx shadcn@latest add "https://uifino.com/r/blocks/hero-product-panel.json"`
- UIFino CLI: `npx uifino@latest add component/hero-product-panel`

## Dependencies

`lucide-react`

## shadcn/ui components it builds on

- `badge`, `button`, `progress`, `separator`. The shadcn CLI installs them together with the block.

## Layout borrowed from

- https://linear.app: Layout skeleton and restraint only

## Theme

The block reads the project's shadcn theme variables, so it follows whatever DESIGN.md the project uses and needs no options of its own.
To give the project the look of a UIFino brand or style, install its theme: `npx shadcn@latest add "https://uifino.com/r/themes/linear.json"`.

## Usage

The files under `examples/` show the block wired with content, including its loading, empty and error states where it has them.

## Files

| Path | Role | Size |
| :--- | :--- | ---: |
| components/blocks/hero-product-panel/examples/building.tsx | demo | 364 B |
| components/blocks/hero-product-panel/examples/content.ts | demo | 5.2 KB |
| components/blocks/hero-product-panel/examples/default.tsx | demo | 238 B |
| components/blocks/hero-product-panel/hero-product-panel.tsx | source | 9.2 KB |

### components/blocks/hero-product-panel/hero-product-panel.tsx

```tsx
import type { ComponentProps, CSSProperties, ReactNode } from "react";
import { ArrowUpRight, Check, GitBranch, LoaderCircle, RotateCcw } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Progress } from "@/components/ui/progress";
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils";

export interface HeroProductPanelAction {
  readonly label: string;
  readonly href?: string;
  readonly onClick?: () => void;
}

export interface HeroProductPanelProgress {
  readonly label: string;
  readonly value: number;
}

export interface HeroProductPanelStep {
  readonly id: string;
  readonly label: string;
  readonly duration: string;
  readonly state: "done" | "active" | "running" | "pending";
}

export interface HeroProductPanelLog {
  readonly time: string;
  readonly text: string;
  readonly tone: "default" | "muted" | "ok";
}

export interface HeroProductPanelDeployment {
  readonly project: string;
  readonly environment: string;
  readonly commit: string;
  readonly meta: string;
  readonly status: string;
  readonly steps: readonly HeroProductPanelStep[];
  readonly logTitle: string;
  readonly logs: readonly HeroProductPanelLog[];
  readonly previewLabel: string;
  readonly previewUrl: string;
  readonly progress?: HeroProductPanelProgress;
  readonly visit: HeroProductPanelAction;
  readonly rollbackTitle: string;
  readonly rollbackMeta: string;
  readonly rollback: HeroProductPanelAction;
  readonly checksTitle: string;
  readonly checks: readonly string[];
}

export interface HeroProductPanelProps {
  readonly title: string;
  readonly description: string;
  readonly primaryAction: HeroProductPanelAction;
  readonly secondaryAction: HeroProductPanelAction;
  readonly deployment: HeroProductPanelDeployment;
  readonly fadeFrom?: number;
}

const logTone: Record<HeroProductPanelLog["tone"], string> = {
  default: "text-foreground",
  muted: "text-muted-foreground",
  ok: "text-chart-2"
};

function ActionButton({
  action,
  children,
  iconFirst = false,
  ...props
}: {
  readonly action: HeroProductPanelAction;
  readonly iconFirst?: boolean;
  readonly children?: ReactNode;
} & Omit<ComponentProps<typeof Button>, "asChild" | "onClick" | "children">) {
  if (action.href) {
    return (
      <Button asChild {...props}>
        <a href={action.href} onClick={action.onClick}>
          {iconFirst ? children : null}
          {action.label}
          {iconFirst ? null : children}
        </a>
      </Button>
    );
  }
  return (
    <Button onClick={action.onClick} {...props}>
      {iconFirst ? children : null}
      {action.label}
      {iconFirst ? null : children}
    </Button>
  );
}

export function HeroProductPanel({
  title,
  description,
  primaryAction,
  secondaryAction,
  deployment,
  fadeFrom = 55
}: HeroProductPanelProps) {
  return (
    <section className="@container relative flex flex-col overflow-hidden bg-background text-foreground">
      <div className="mx-auto w-full max-w-6xl px-4 pt-16 @3xl:px-8 @3xl:pt-24">
        <h1 className="font-heading max-w-3xl text-4xl whitespace-pre-line font-medium tracking-tight text-balance @3xl:text-6xl @3xl:leading-[1.05]">
          {title}
        </h1>
        <div className="mt-6 flex flex-col gap-6 @3xl:mt-8 @3xl:flex-row @3xl:items-center @3xl:justify-between">
          <p className="max-w-xl text-base text-muted-foreground @3xl:text-lg">{description}</p>
          <div className="flex shrink-0 flex-wrap items-center gap-3">
            <ActionButton size="lg" action={primaryAction} />
            <ActionButton size="lg" variant="ghost" action={secondaryAction}>
              <ArrowUpRight />
            </ActionButton>
          </div>
        </div>
      </div>

      <div
        className="mx-auto mt-12 w-full max-w-6xl overflow-hidden px-4 pb-12 @3xl:mt-16 @3xl:h-112 @3xl:px-8 @3xl:pb-0 @3xl:mask-b-from-(--fade-from)"
        style={{ "--fade-from": `${fadeFrom}%` } as CSSProperties}
      >
        <div className="rounded-xl border bg-card @3xl:min-h-128 @3xl:rounded-b-none @3xl:border-b-0">
          <div className="flex flex-col gap-3 p-4 @3xl:flex-row @3xl:items-center @3xl:justify-between @3xl:p-5">
            <div className="min-w-0">
              <div className="flex items-center gap-2 text-sm text-muted-foreground">
                <span className="font-medium text-foreground">{deployment.project}</span>
                <span>/</span>
                <span>{deployment.environment}</span>
              </div>
              <p className="mt-1 truncate text-base font-medium">{deployment.commit}</p>
              <p className="mt-1 flex items-center gap-1.5 truncate text-sm text-muted-foreground">
                <GitBranch className="size-3.5 shrink-0" />
                <span className="truncate">{deployment.meta}</span>
              </p>
            </div>
            <Badge variant="secondary" className="w-fit shrink-0 gap-1.5">
              <span
                className={cn(
                  "size-1.5 rounded-full",
                  deployment.steps.some((step) => step.state === "running") ? "bg-chart-4" : "bg-chart-2"
                )}
              />
              {deployment.status}
            </Badge>
          </div>

          <Separator />

          <ol className="grid grid-cols-2 gap-px bg-border @3xl:grid-cols-4">
            {deployment.steps.map((step) => (
              <li key={step.id} className="flex items-center gap-3 bg-card px-4 py-3 @3xl:px-5">
                <span
                  className={cn(
                    "flex size-5 shrink-0 items-center justify-center rounded-full",
                    step.state === "active" || step.state === "running"
                      ? "bg-primary text-primary-foreground"
                      : step.state === "pending"
                        ? "border border-dashed"
                        : "bg-muted text-muted-foreground"
                  )}
                >
                  {step.state === "running" ? (
                    <LoaderCircle className="size-3 animate-spin" />
                  ) : step.state === "pending" ? null : (
                    <Check className="size-3" />
                  )}
                </span>
                <span
                  className={cn("text-sm font-medium", step.state === "pending" && "text-muted-foreground")}
                >
                  {step.label}
                </span>
                <span className="ml-auto text-sm text-muted-foreground">{step.duration}</span>
              </li>
            ))}
          </ol>

          <Separator />

          <div className="grid min-w-0 @3xl:grid-cols-[minmax(0,1fr)_20rem]">
            <div className="min-w-0 p-4 @3xl:p-5">
              <p className="text-sm font-medium">{deployment.logTitle}</p>
              <ul className="mt-3 flex flex-col gap-1.5 font-mono text-sm">
                {deployment.logs.map((line, index) => (
                  <li key={`${index}-${line.time}`} className="flex gap-3">
                    <span className="shrink-0 text-muted-foreground">{line.time}</span>
                    <span className={cn("min-w-0 break-words", logTone[line.tone])}>{line.text}</span>
                  </li>
                ))}
              </ul>
              {deployment.progress ? (
                <div className="mt-3 flex flex-col gap-2">
                  <p className="font-mono text-sm text-muted-foreground">{deployment.progress.label}</p>
                  <Progress value={deployment.progress.value} aria-label={deployment.progress.label} />
                </div>
              ) : null}
            </div>

            <div className="flex min-w-0 flex-col gap-4 border-t p-4 @3xl:border-t-0 @3xl:border-l @3xl:p-5">
              <div>
                <p className="text-sm text-muted-foreground">{deployment.previewLabel}</p>
                <div className="mt-2 flex items-center gap-2 rounded-md border bg-background py-1 pr-1 pl-3">
                  <span className="min-w-0 flex-1 truncate text-sm">{deployment.previewUrl}</span>
                  <ActionButton size="sm" variant="secondary" action={deployment.visit} />
                </div>
              </div>
              <div>
                <p className="text-sm text-muted-foreground">{deployment.rollbackTitle}</p>
                <div className="mt-2 flex items-center justify-between gap-2">
                  <span className="min-w-0 truncate text-sm">{deployment.rollbackMeta}</span>
                  <ActionButton size="sm" variant="outline" iconFirst action={deployment.rollback}>
                    <RotateCcw />
                  </ActionButton>
                </div>
              </div>
              <div>
                <p className="text-sm text-muted-foreground">{deployment.checksTitle}</p>
                <ul className="mt-2 flex flex-col gap-1.5 text-sm">
                  {deployment.checks.map((check) => (
                    <li key={check} className="flex items-center gap-2">
                      <Check className="size-3.5 shrink-0 text-chart-2" />
                      <span className="truncate">{check}</span>
                    </li>
                  ))}
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}
```

Not inlined (3 files, 5.8 KB). Full sources: https://uifino.com/r/blocks/hero-product-panel.json
