Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

step-indicator.tsx 658B

123456789101112131415161718192021222324252627282930313233
  1. import cn from '@/utils/classnames'
  2. import React from 'react'
  3. export type Step = {
  4. label: string
  5. value: string
  6. }
  7. type StepIndicatorProps = {
  8. currentStep: number
  9. steps: Step[]
  10. }
  11. const StepIndicator = ({
  12. currentStep,
  13. steps,
  14. }: StepIndicatorProps) => {
  15. return (
  16. <div className='flex gap-x-1'>
  17. {steps.map((step, index) => {
  18. const isActive = index === currentStep - 1
  19. return (
  20. <div
  21. key={step.value}
  22. className={cn('h-1 w-1 rounded-lg bg-divider-solid', isActive && 'w-2 bg-state-accent-solid')}
  23. />
  24. )
  25. })}
  26. </div>
  27. )
  28. }
  29. export default React.memo(StepIndicator)