2023-10-17 06:46:23 -04:00
|
|
|
import classNames from 'classnames'
|
2023-11-24 05:43:31 -05:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2023-10-17 06:46:23 -04:00
|
|
|
|
|
|
|
export function Stepper({ steps, active }: { steps: number; active: number }) {
|
2023-11-24 05:43:31 -05:00
|
|
|
const { t } = useTranslation()
|
2023-10-17 06:46:23 -04:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className="stepper"
|
|
|
|
role="progressbar"
|
2023-11-24 05:43:31 -05:00
|
|
|
aria-label={t('progress_bar_percentage')}
|
2023-10-17 06:46:23 -04:00
|
|
|
aria-valuenow={active + 1}
|
|
|
|
aria-valuemax={steps}
|
2023-11-24 05:43:31 -05:00
|
|
|
tabIndex={0}
|
2023-10-17 06:46:23 -04:00
|
|
|
>
|
|
|
|
{Array.from({ length: steps }).map((_, i) => (
|
|
|
|
<div
|
|
|
|
key={i}
|
|
|
|
className={classNames({
|
|
|
|
step: true,
|
|
|
|
active: i === active,
|
|
|
|
completed: i < active,
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|