-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathStepper.tsx
More file actions
61 lines (59 loc) · 1.47 KB
/
Stepper.tsx
File metadata and controls
61 lines (59 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Check } from "react-feather";
interface StepperProps {
currentTx: number;
userTxs: [];
}
export const Stepper = (props: StepperProps) => {
const { currentTx, userTxs } = props;
return (
<div className="skt-w flex">
{userTxs?.map((x, index) => {
return (
<Step
active={currentTx === index}
lastItem={index === userTxs?.length - 1}
key={index}
completed={currentTx > index}
/>
);
})}
</div>
);
};
const Step = (props: {
active?: boolean;
completed?: boolean;
lastItem?: boolean;
}) => {
const { active, completed, lastItem } = props;
return (
<div
className={`skt-w flex flex-row items-center ${
!lastItem ? "flex-grow" : ""
}`}
>
{/* circle */}
<span
className={`skt-w relative w-4 h-4 rounded-full flex justify-center items-center ${
completed ? "bg-widget-accent border-0" : ""
} ${
active
? "border-2 border-widget-accent"
: "border border-widget-secondary-text border-opacity-40"
} `}
>
{completed && <Check className="skt-w text-widget-onAccent w-3 h-3" />}
</span>
{/* line */}
{!lastItem && (
<span
className={`skt-w h-px flex-grow ${
completed
? "bg-widget-accent"
: "bg-widget-secondary-text bg-opacity-40"
}`}
></span>
)}
</div>
);
};