-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBottomStepper.tsx
More file actions
61 lines (60 loc) · 1.54 KB
/
BottomStepper.tsx
File metadata and controls
61 lines (60 loc) · 1.54 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 { type Dispatch, type SetStateAction } from "react";
import { useRouter } from "next/router";
import { BottomNavigation, MobileStepper } from "@mui/material";
import CommonButton from "./CommonButton";
export default function BottomStepper({
selectedStep,
setSelectedStep,
length,
}: {
selectedStep: number;
setSelectedStep: Dispatch<SetStateAction<number>>;
length: number;
}): JSX.Element {
const router = useRouter();
return (
<BottomNavigation>
<MobileStepper
variant="progress"
steps={length}
position="bottom"
activeStep={selectedStep}
backButton={
<CommonButton
disabled={selectedStep === 0}
onClick={() => {
if (selectedStep > 0) {
setSelectedStep(selectedStep - 1);
}
}}
>
前へ
</CommonButton>
}
nextButton={
selectedStep !== length - 1 ? (
<CommonButton
disabled={selectedStep === length - 1}
onClick={() => {
if (selectedStep < length - 1) {
setSelectedStep(selectedStep + 1);
}
}}
>
次へ
</CommonButton>
) : (
<CommonButton
variant="contained"
onClick={async () => {
await router.push("/");
}}
>
終了
</CommonButton>
)
}
/>
</BottomNavigation>
);
}