import { cn } from '@/lib/utils'; import { Check, Circle } from 'lucide-react'; /** * Props shared by all step components */ interface StepProps { /** Whether this is the last step in the sequence */ isLastStep?: boolean; /** The total number of steps */ totalSteps: number; /** The index of this step */ index: number; } /** * Common styles for the step circle container */ const stepCircleStyles = 'flex aspect-square w-8 items-center justify-center rounded-full border-2'; /** * Common styles for the connecting line between steps */ const stepLineStyles = 'h-0.5 flex-grow'; /** * Renders a completed step with a checkmark */ const CompletedStep = ({ isLastStep = false }: Pick) => { return ( <>
{!isLastStep &&
} ); }; /** * Renders the current active step */ const CurrentStep = ({ index, totalSteps }: Pick) => { return ( <>
{index + 1 < totalSteps &&
} ); }; /** * Renders an upcoming step that hasn't been completed yet */ const NextStep = ({ index, totalSteps }: Pick) => { return ( <>
{index + 1 < totalSteps &&
} ); }; interface AssetFormProgressProps { /** The current active step (0-based index) */ currentStep: number; /** The total number of steps in the form */ totalSteps: number; } /** * Displays a progress indicator for multi-step forms * Shows completed steps with checkmarks, the current step with a filled circle, * and upcoming steps with empty circles */ export function AssetFormProgress({ currentStep, totalSteps }: AssetFormProgressProps) { if (totalSteps < 2) { return null; } return ( {Array.from({ length: totalSteps }, (_, index) => { const props = { index, totalSteps, isLastStep: index === totalSteps - 1 }; if (index < currentStep) { return ; } if (index === currentStep) { return ; } return ; })} ); }