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)}