import classNames from "@calcom/lib/classNames"; type StepWithNav = { maxSteps: number; currentStep: number; navigateToStep: (step: number) => void; disableNavigation?: false; stepLabel?: (currentStep: number, maxSteps: number) => string; }; type StepWithoutNav = { maxSteps: number; currentStep: number; navigateToStep?: undefined; disableNavigation: true; stepLabel?: (currentStep: number, maxSteps: number) => string; }; // Discriminative union on disableNavigation prop type StepsProps = StepWithNav | StepWithoutNav; const Steps = (props: StepsProps) => { const { maxSteps, currentStep, navigateToStep, disableNavigation = false, stepLabel = (currentStep, totalSteps) => `Step ${currentStep} of ${totalSteps}`, } = props; return (

{stepLabel(currentStep, maxSteps)}

{new Array(maxSteps).fill(0).map((_s, index) => { return index <= currentStep - 1 ? (
navigateToStep?.(index)} className={classNames( "bg-inverted h-1 w-full rounded-[1px]", index < currentStep - 1 && !disableNavigation ? "cursor-pointer" : "" )} data-testid={`step-indicator-${index}`} /> ) : (
); })}
); }; export { Steps };