Added stepper component
This commit is contained in:
1 parent
862e420c9e
commit
360e5da912
3 files changed
+71
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,58 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Step, Stepper, StepLabel, Typography } from "@mui/material";
|
||||||
|
import RadioButtonCheckedIcon from "@mui/icons-material/RadioButtonChecked";
|
||||||
|
import CheckCircle from "@mui/icons-material/CheckCircle";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
const CustomStepIcon = (props) => {
|
||||||
|
const { completed, active } = props;
|
||||||
|
return completed ? (
|
||||||
|
<CheckCircle color="primary" />
|
||||||
|
) : (
|
||||||
|
<RadioButtonCheckedIcon color={active ? "primary" : "disabled"} />
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
CustomStepIcon.propTypes = {
|
||||||
|
completed: PropTypes.bool.isRequired,
|
||||||
|
active: PropTypes.bool.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @component
|
||||||
|
* @param {Object} props
|
||||||
|
* @param {Array} props.steps
|
||||||
|
*/
|
||||||
|
|
||||||
|
const ProgressStepper = ({ steps }) => {
|
||||||
|
const [activeStep, setActiveStep] = React.useState(1);
|
||||||
|
return (
|
||||||
|
<Stepper activeStep={activeStep} alternativeLabel>
|
||||||
|
{steps.map((step, index) => {
|
||||||
|
const color = activeStep === index ? "primary" : "inherit";
|
||||||
|
return (
|
||||||
|
<Step key={step.label} onClick={() => setActiveStep(index)}>
|
||||||
|
<StepLabel StepIconComponent={CustomStepIcon}>
|
||||||
|
<Typography
|
||||||
|
variant="body1"
|
||||||
|
color={color}
|
||||||
|
sx={{ fontWeight: "bold" }}
|
||||||
|
>
|
||||||
|
{step.label}
|
||||||
|
</Typography>
|
||||||
|
</StepLabel>
|
||||||
|
<Typography variant="body1" color={color}>
|
||||||
|
{step.content}
|
||||||
|
</Typography>
|
||||||
|
</Step>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Stepper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
ProgressStepper.propTypes = {
|
||||||
|
steps: PropTypes.array.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ProgressStepper;
|
||||||
@@ -3,6 +3,7 @@ import Button from "../../Components/Button";
|
|||||||
import Link from "../../Components/Link";
|
import Link from "../../Components/Link";
|
||||||
import ColoredLabel from "../../Components/Label/ColoredLabel";
|
import ColoredLabel from "../../Components/Label/ColoredLabel";
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
useTheme,
|
useTheme,
|
||||||
Switch,
|
Switch,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
@@ -16,6 +17,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import StatusLabel from "../../Components/Label/StautsLabel";
|
import StatusLabel from "../../Components/Label/StautsLabel";
|
||||||
import Avatar from "../../Components/Avatar/Avatar";
|
import Avatar from "../../Components/Avatar/Avatar";
|
||||||
|
import ProgressStepper from "../../Components/ProgressStepper/ProgressStepper";
|
||||||
import avatarImage from "../../assets/Images/avatar_placeholder.png";
|
import avatarImage from "../../assets/Images/avatar_placeholder.png";
|
||||||
import { DataGrid } from "@mui/x-data-grid";
|
import { DataGrid } from "@mui/x-data-grid";
|
||||||
|
|
||||||
@@ -76,6 +78,12 @@ const rows = ((count) => {
|
|||||||
return arr;
|
return arr;
|
||||||
})(100);
|
})(100);
|
||||||
|
|
||||||
|
const steps = [
|
||||||
|
{ label: "Your details", content: "Please provide your name and email" },
|
||||||
|
{ label: "Company details", content: "A few details about your company" },
|
||||||
|
{ label: "Invite your team", content: "Start collaborating with your team" },
|
||||||
|
];
|
||||||
|
|
||||||
const Demo = () => {
|
const Demo = () => {
|
||||||
const [radio, setRadio] = React.useState(1);
|
const [radio, setRadio] = React.useState(1);
|
||||||
const [tab, setTab] = React.useState("departments");
|
const [tab, setTab] = React.useState("departments");
|
||||||
@@ -211,6 +219,11 @@ const Demo = () => {
|
|||||||
</LocalizationProvider>
|
</LocalizationProvider>
|
||||||
<h4>{date}</h4>
|
<h4>{date}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h4>Stepper</h4>
|
||||||
|
<div>
|
||||||
|
<ProgressStepper steps={steps}></ProgressStepper>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user