// This file is part of MinIO Console Server // Copyright (c) 2021 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . import React, { useState } from "react"; import { createStyles, Theme, withStyles } from "@material-ui/core/styles"; import { IWizardMain } from "./types"; import WizardPage from "./WizardPage"; import { Grid } from "@material-ui/core"; const styles = (theme: Theme) => createStyles({ wizardMain: { display: "flex", width: "100%", height: "100%", flexGrow: 1, }, wizFromContainer: { height: "calc(100vh - 365px)", minHeight: 450, padding: "0 30px", }, wizardSteps: { minWidth: 180, marginRight: 10, borderRight: "#eaeaea 1px solid", display: "flex", flexGrow: 1, flexDirection: "column", height: "100%", "& ul": { padding: "0 15px 0 40px", marginTop: "0px", "& li": { listStyle: "lower-roman", marginBottom: 12, }, }, }, buttonList: { backgroundColor: "transparent", border: "none", cursor: "pointer", "&:not(:disabled):hover": { textDecoration: "underline", }, "&:selected, &:active, &:focus, &:focus:active": { border: "none", outline: 0, boxShadow: "none", }, }, paddedContentGrid: { padding: "0 10px", }, stepsLabel: { fontSize: 20, color: "#393939", fontWeight: 600, margin: "15px 12px", }, }); const GenericWizard = ({ classes, wizardSteps }: IWizardMain) => { const [currentStep, setCurrentStep] = useState(0); const pageChange = (toElement: string | number) => { const lastPage = wizardSteps.length - 1; if (toElement === "++") { let nextPage = currentStep + 1; if (nextPage > lastPage) { nextPage = lastPage; } setCurrentStep(nextPage); } if (toElement === "--") { let prevPage = currentStep - 1; if (prevPage < 0) { prevPage = 0; } setCurrentStep(prevPage); } if (typeof toElement === "number") { let pg = toElement; if (toElement < 0) { pg = 0; } if (toElement > lastPage) { pg = lastPage; } setCurrentStep(pg); } }; if (wizardSteps.length === 0) { return null; } return (
Steps
    {wizardSteps.map((step, index) => { return (
  • ); })}
); }; export default withStyles(styles)(GenericWizard);