-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathdebugger-steps.component.tsx
More file actions
77 lines (73 loc) · 2.05 KB
/
debugger-steps.component.tsx
File metadata and controls
77 lines (73 loc) · 2.05 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"use client";
import { ComponentType, useState } from "react";
import styles from "./debugger-steps.module.scss";
import { StepOne, StepTwo, StepThree, StepFour } from "./index";
type Steps = {
id: string;
label: string;
component: ComponentType;
};
const stepsList: Steps[] = [
{
id: "step-one",
label: "Redirect to OpenID Connect Server",
component: StepOne,
},
{
id: "step-two",
label: "Exchange Code from Token",
component: StepTwo,
},
{
id: "step-three",
label: "Verify User Token",
component: StepThree,
},
{
id: "step-four",
label: "The token is valid!",
component: StepFour,
},
];
export const DebuggerSteps = () => {
const [currentStepIndex, setCurrentStepIndex] = useState(2);
return (
<div className={styles.container}>
<div className={styles.wrapper}>
<div className={styles.content}>
{stepsList.map(({ id, label, component: Component }, index) => {
const state =
index < currentStepIndex
? "completed"
: index === currentStepIndex
? "current"
: "upcoming";
return (
<div key={id} className={styles.step_container}>
<div
className={styles.step_title_container}
data-state={state}
aria-current={state === "current" ? "step" : undefined}
aria-label={`${label} ${state}`}
>
<div className={styles.step_title_content}>
{" "}
<div className={styles.step_number}>{index + 1}</div>
<p>{label}</p>
</div>
</div>
<div
className={styles.step_content}
data-open={state === "current"}
aria-hidden={state !== "current"}
>
<Component />
</div>
</div>
);
})}
</div>
</div>
</div>
);
};