|
| 1 | +import React from "react"; |
| 2 | +import { makeStyles, withStyles } from "@material-ui/core/styles"; |
| 3 | +import Stepper from '@material-ui/core/Stepper'; |
| 4 | +import Step from '@material-ui/core/Step'; |
| 5 | +import StepLabel from '@material-ui/core/StepLabel'; |
| 6 | +import StepConnector from '@material-ui/core/StepConnector'; |
| 7 | +import clsx from 'clsx'; |
| 8 | +import mock from "../mock"; |
| 9 | + |
| 10 | +const useStyles = makeStyles((theme) => ({ |
| 11 | + root: { |
| 12 | + width: '100%', |
| 13 | + }, |
| 14 | + iconContainer: { |
| 15 | + '& svg': { |
| 16 | + width: 32, |
| 17 | + height: 32, |
| 18 | + }, |
| 19 | + }, |
| 20 | +})); |
| 21 | + |
| 22 | +const stepsData = mock.timelineWidget.timelineData; |
| 23 | + |
| 24 | +const ColorlibConnector = withStyles({ |
| 25 | + active: { |
| 26 | + '& $line': { |
| 27 | + backgroundColor: '#4D53E0', |
| 28 | + }, |
| 29 | + }, |
| 30 | + completed: { |
| 31 | + '& $line': { |
| 32 | + backgroundColor: '#4D53E0', |
| 33 | + }, |
| 34 | + }, |
| 35 | + line: { |
| 36 | + border: 0, |
| 37 | + width: 3, |
| 38 | + backgroundColor: '#4D53E0', |
| 39 | + borderRadius: 0, |
| 40 | + }, |
| 41 | + vertical: { |
| 42 | + padding: 0, |
| 43 | + marginLeft: 14, |
| 44 | + marginTop: -8, |
| 45 | + marginBottom: -8, |
| 46 | + '& span': { |
| 47 | + minHeight: 40, |
| 48 | + } |
| 49 | + } |
| 50 | +})(StepConnector); |
| 51 | + |
| 52 | +export default function TasksStepper() { |
| 53 | + const classes = useStyles(); |
| 54 | + const [activeStep, setActiveStep] = React.useState(3); |
| 55 | + |
| 56 | + const handleClick = (e) => { |
| 57 | + setActiveStep(e) |
| 58 | + } |
| 59 | + |
| 60 | + return ( |
| 61 | + <div className={classes.root}> |
| 62 | + |
| 63 | + <Stepper activeStep={activeStep} orientation="vertical" connector={<ColorlibConnector />}> |
| 64 | + {stepsData.map((item, index) => ( |
| 65 | + |
| 66 | + <Step key={index} onClick={() => handleClick(index)}> |
| 67 | + <StepLabel className={classes.iconContainer}> |
| 68 | + <div key={index} className="d-flex flex-row align-self-baseline ml-3"> |
| 69 | + <img src={item.img} alt="item pic"/> |
| 70 | + <div className="d-flex flex-column ml-3"> |
| 71 | + <p className="body-2">{item.title}</p> |
| 72 | + <p className="body-3 muted">{item.label}</p> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + </StepLabel> |
| 76 | + </Step> |
| 77 | + |
| 78 | + ))} |
| 79 | + </Stepper> |
| 80 | + |
| 81 | + </div> |
| 82 | + ) |
| 83 | +} |
| 84 | + |
| 85 | + |
| 86 | +// <Stepper alternativeLabel activeStep={activeStep} connector={<ColorlibConnector />}> |
| 87 | +// {steps.map((label) => ( |
| 88 | +// <Step key={label}> |
| 89 | +// <StepLabel StepIconComponent={ColorlibStepIcon}>{label}</StepLabel> |
| 90 | +// </Step> |
| 91 | +// ))} |
| 92 | +// </Stepper> |
| 93 | + |
0 commit comments