-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVerticalStepper.tsx
85 lines (78 loc) · 2.61 KB
/
VerticalStepper.tsx
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
78
79
80
81
82
83
84
85
/* eslint-disable */
import React, { useState } from 'react';
import { Box, Stepper, Step, StepLabel, StepContent, Button, Paper, Typography } from '@mui/material';
const steps = [
{
label: 'Eligibility Requirements',
description: 'Ensure you meet all the eligibility criteria to become a seller on our platform.',
},
{
label: 'Account Setup',
description: 'Create your seller account by providing your personal and business details.',
},
{
label: 'Seller Fees',
description: 'Understand the fees associated with selling on our platform, including listing and transaction fees.',
},
{
label: 'Product Listing',
description: 'Learn how to list your products, including setting prices, uploading images, and writing descriptions.',
},
{
label: 'Terms & Conditions',
description: 'Review and agree to the terms and conditions to start selling on our platform.',
},
];
const VerticalStepper = () => {
const [activeStep, setActiveStep] = useState(0);
const handleNext = () => {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
};
const handleBack = () => {
setActiveStep((prevActiveStep) => prevActiveStep - 1);
};
const handleReset = () => {
setActiveStep(0);
};
return (
<Box sx={{ maxWidth: 400 }}>
<Stepper activeStep={activeStep} orientation="vertical">
{steps.map((step, index) => (
<Step key={step.label}>
<StepLabel>{step.label}</StepLabel>
<StepContent>
<Typography>{step.description}</Typography>
<Box sx={{ mb: 2 }}>
<div>
<Button
variant="contained"
onClick={handleNext}
sx={{ mt: 1, mr: 1 }}
>
{index === steps.length - 1 ? 'Finish' : 'Continue'}
</Button>
<Button
disabled={index === 0}
onClick={handleBack}
sx={{ mt: 1, mr: 1 }}
>
Back
</Button>
</div>
</Box>
</StepContent>
</Step>
))}
</Stepper>
{activeStep === steps.length && (
<Paper square elevation={0} sx={{ p: 3 }}>
<Typography>All steps completed - you're now a seller!</Typography>
<Button onClick={handleReset} sx={{ mt: 1, mr: 1 }}>
Reset
</Button>
</Paper>
)}
</Box>
);
};
export default VerticalStepper;