| 53 | } |
| 54 | |
| 55 | export const OnboardingSteps = ({ className }: Props) => { |
| 56 | const location = useLocation(); |
| 57 | const path = location.pathname; |
| 58 | const steps = useSteps(path); |
| 59 | const currentIndex = steps.findIndex((i) => i.status === 'current'); |
| 60 | return ( |
| 61 | <div className="relative"> |
| 62 | <div className="absolute bottom-4 left-4 top-4 w-px bg-def-200" /> |
| 63 | <div |
| 64 | className="absolute left-4 top-4 w-px bg-highlight" |
| 65 | style={{ |
| 66 | height: `calc(${((currentIndex + 1) / steps.length) * 100}% - 3.5rem)`, |
| 67 | }} |
| 68 | /> |
| 69 | <div |
| 70 | className={cn( |
| 71 | 'relative flex gap-4 overflow-hidden md:-ml-3 md:flex-col md:gap-8', |
| 72 | className, |
| 73 | )} |
| 74 | > |
| 75 | {steps.map((step, index) => ( |
| 76 | <div |
| 77 | className={cn( |
| 78 | 'flex flex-shrink-0 items-center gap-4 self-start px-3 py-1.5', |
| 79 | step.status === 'current' && |
| 80 | 'rounded-xl border border-border bg-card', |
| 81 | step.status === 'completed' && |
| 82 | index !== currentIndex - 1 && |
| 83 | 'max-md:hidden', |
| 84 | )} |
| 85 | key={step.name} |
| 86 | > |
| 87 | <div |
| 88 | className={cn( |
| 89 | 'relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-white', |
| 90 | )} |
| 91 | > |
| 92 | <div |
| 93 | className={cn( |
| 94 | 'absolute inset-0 z-0 rounded-full bg-highlight', |
| 95 | step.status === 'pending' && 'bg-def-400', |
| 96 | )} |
| 97 | /> |
| 98 | {step.status === 'current' && ( |
| 99 | <div className="absolute inset-1 z-0 animate-ping-slow rounded-full bg-highlight" /> |
| 100 | )} |
| 101 | <div className="relative"> |
| 102 | {step.status === 'completed' && <CheckCheckIcon size={14} />} |
| 103 | {/* {step.status === 'current' && ( |
| 104 | <ArrowRightCircleIcon size={14} /> |
| 105 | )} */} |
| 106 | {(step.status === 'pending' || step.status === 'current') && |
| 107 | index + 1} |
| 108 | </div> |
| 109 | </div> |
| 110 | |
| 111 | <div className="font-medium">{step.name}</div> |
| 112 | </div> |