Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

1.4 KB
Raw Blame
import { Icon } from "@dub/ui";
import { cn } from "@dub/utils";
import { Crown } from "lucide-react";
import { PropsWithChildren, ReactNode } from "react";

export function StepPage({
  children,
  title,
  description,
  paidPlanRequired,
  badge,
  className,
  headingTestId,
}: PropsWithChildren<{
  title: ReactNode;
  description: ReactNode;
  paidPlanRequired?: boolean;
  badge?: {
    icon: Icon;
    label: string;
  };
  className?: string;
  headingTestId?: string;
}>) {
  const BadgeIcon = badge?.icon ?? Crown;

  return (
    <div
      className={cn(
        "mx-auto flex w-full max-w-[430px] flex-col items-center",
        "animate-slide-up-fade [--offset:10px] [animation-duration:1s] [animation-fill-mode:both]",
        className,
      )}
    >
      {Boolean(badge || paidPlanRequired) && (
        <div className="mb-3 flex items-center gap-2 rounded-full border border-neutral-200 bg-neutral-100 px-2.5 py-0.5 text-xs font-medium text-neutral-600">
          <BadgeIcon className="size-3" />
          {badge?.label ?? "Paid plan required"}
        </div>
      )}
      <h1
        className="text-center text-xl font-semibold"
        data-testid={headingTestId}
      >
        {title}
      </h1>
      <div className="mt-2 text-balance text-center text-base text-neutral-500">
        {description}
      </div>
      <div className="mt-8 w-full">{children}</div>
    </div>
  );
}