2022-05-23 14:32:51 +00:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
|
|
|
import styles from './Stepper.module.css';
|
|
|
|
|
|
|
|
export interface Step {
|
2023-02-07 03:33:57 +00:00
|
|
|
label: string;
|
2022-05-23 14:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
currentStep: number;
|
|
|
|
steps: Step[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export function Stepper({ currentStep, steps }: Props) {
|
|
|
|
return (
|
|
|
|
<div className={styles.stepperWrapper}>
|
|
|
|
{steps.map((step, index) => (
|
|
|
|
<div
|
2023-02-07 03:33:57 +00:00
|
|
|
key={step.label}
|
2022-05-23 14:32:51 +00:00
|
|
|
className={clsx(styles.stepWrapper, {
|
|
|
|
[styles.active]: index + 1 === currentStep,
|
|
|
|
[styles.completed]: index + 1 < currentStep,
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<div className={styles.step}>
|
|
|
|
<div className={styles.stepCounter}>{index + 1}</div>
|
2023-02-07 03:33:57 +00:00
|
|
|
<div className={styles.stepName}>{step.label}</div>
|
2022-05-23 14:32:51 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|