Skip to content

Commit

Permalink
Harmonize disabling wizard stepper buttons across all instances
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKniephoff committed Jun 4, 2024
1 parent 427072c commit 4fc919b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/shared/wizard/WizardStepperEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import {
useStepperStyle,
} from "../../../utils/wizardUtils";
import CustomStepIcon from "./CustomStepIcon";
import { FormikProps } from "formik";

const WizardStepperEvent = ({
steps,
page,
setPage,
formik,
completed,
} : {
steps: {
Expand All @@ -22,6 +24,7 @@ const WizardStepperEvent = ({
}[],
page: number,
setPage: (num: number) => void,
formik: FormikProps<any>,
completed: Record<number, boolean>,
}) => {
const { t } = useTranslation();
Expand Down Expand Up @@ -50,6 +53,8 @@ const WizardStepperEvent = ({
}
};

const disabled = !(formik.dirty && formik.isValid);

return (
<Stepper
activeStep={page}
Expand All @@ -61,7 +66,7 @@ const WizardStepperEvent = ({
{steps.map((label, key) =>
label.hidden || (
<Step key={label.translation} completed={completed[key]}>
<StepButton onClick={() => handleOnClick(key)}>
<StepButton onClick={() => handleOnClick(key)} disabled={disabled}>
<StepLabel className={labelClasses.root} StepIconComponent={CustomStepIcon}>
{t(label.translation)}
</StepLabel>
Expand Down

0 comments on commit 4fc919b

Please sign in to comment.