step.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import type { FC } from 'react'
  2. import classNames from '@/utils/classnames'
  3. export type Step = {
  4. name: string
  5. }
  6. export type StepperStepProps = Step & {
  7. index: number
  8. activeIndex: number
  9. }
  10. export const StepperStep: FC<StepperStepProps> = (props) => {
  11. const { name, activeIndex, index } = props
  12. const isActive = index === activeIndex
  13. const isDisabled = activeIndex < index
  14. const label = isActive ? `STEP ${index + 1}` : `${index + 1}`
  15. return <div className='flex items-center gap-2'>
  16. <div className={classNames(
  17. 'h-5 px-2 py-1 rounded-3xl flex-col justify-center items-center gap-2 inline-flex',
  18. isActive
  19. ? 'bg-state-accent-solid'
  20. : !isDisabled
  21. ? 'border border-text-quaternary'
  22. : 'border border-divider-deep',
  23. )}>
  24. <div className={classNames(
  25. 'text-center system-2xs-semibold-uppercase',
  26. isActive
  27. ? 'text-text-primary-on-surface'
  28. : !isDisabled
  29. ? 'text-text-tertiary'
  30. : 'text-text-quaternary',
  31. )}>
  32. {label}
  33. </div>
  34. </div>
  35. <div className={classNames('system-xs-medium-uppercase',
  36. isActive
  37. ? 'text-text-accent system-xs-semibold-uppercase'
  38. : !isDisabled
  39. ? 'text-text-tertiary'
  40. : 'text-text-quaternary',
  41. )}>{name}</div>
  42. </div>
  43. }