index.tsx 694 B

123456789101112131415161718192021222324252627
  1. import { type FC, Fragment } from 'react'
  2. import type { Step } from './step'
  3. import { StepperStep } from './step'
  4. export type StepperProps = {
  5. steps: Step[]
  6. activeIndex: number
  7. }
  8. export const Stepper: FC<StepperProps> = (props) => {
  9. const { steps, activeIndex } = props
  10. return <div className='flex items-center gap-3'>
  11. {steps.map((step, index) => {
  12. const isLast = index === steps.length - 1
  13. return (
  14. <Fragment key={index}>
  15. <StepperStep
  16. {...step}
  17. activeIndex={activeIndex}
  18. index={index}
  19. />
  20. {!isLast && <div className='h-px w-4 bg-divider-deep' />}
  21. </Fragment>
  22. )
  23. })}
  24. </div>
  25. }