File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
frontend/src/app/onboard/_components Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { cn } from "@/lib/utils" ;
2
+ import { Separator } from "@radix-ui/react-dropdown-menu" ;
3
+ import React from "react" ;
4
+
5
+ interface Activatable {
6
+ isActive : boolean ;
7
+ }
8
+
9
+ interface StepperComponentProps {
10
+ totalSteps : number ;
11
+ currStep : number ;
12
+ }
13
+
14
+ export default function StepperComponent ( {
15
+ totalSteps,
16
+ currStep,
17
+ } : StepperComponentProps ) {
18
+ return (
19
+ < div className = "flex items-center gap-1 px-2" >
20
+ { Array . from ( { length : totalSteps } , ( e , i ) => (
21
+ < >
22
+ < StepComponent isActive = { i + 1 <= currStep } value = { i + 1 } key = { i } />
23
+ { i < totalSteps - 1 && < SeparatorComponent isActive = { ( i + 1 ) < currStep } /> }
24
+ </ >
25
+ ) ) }
26
+ </ div >
27
+ ) ;
28
+ }
29
+
30
+ interface StepComponentProps extends Activatable {
31
+ value : number ;
32
+ }
33
+
34
+ function StepComponent ( { isActive, value } : StepComponentProps ) {
35
+ return (
36
+ < div
37
+ className = { cn ( "w-6 h-6 text-center align-middle rounded-full" , {
38
+ "bg-primary" : isActive ,
39
+ "outline outline-1 outline-background-100" : ! isActive ,
40
+ } ) }
41
+ >
42
+ < small > { value } </ small >
43
+ </ div >
44
+ ) ;
45
+ }
46
+
47
+ interface SeparatorComponentProps extends Activatable { }
48
+
49
+ function SeparatorComponent ( { isActive } : SeparatorComponentProps ) {
50
+ return < Separator className = { cn ( "flex-1 h-[2px]" , { "bg-primary" : isActive , "bg-background-100" : ! isActive } ) } />
51
+ }
You can’t perform that action at this time.
0 commit comments