From 0c29e5d3a8b714be016b24a053ad809a0fc15f16 Mon Sep 17 00:00:00 2001 From: apanizo Date: Fri, 7 Sep 2018 15:48:41 +0200 Subject: [PATCH] Modify Stepper to have it working vertically --- src/components/Stepper/index.jsx | 45 ++++++++++++++------------ src/components/forms/GnoForm/index.jsx | 6 ++-- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/components/Stepper/index.jsx b/src/components/Stepper/index.jsx index 5dc21fb6..f5c6f985 100644 --- a/src/components/Stepper/index.jsx +++ b/src/components/Stepper/index.jsx @@ -2,6 +2,7 @@ import Stepper from '@material-ui/core/Stepper' import FormStep from '@material-ui/core/Step' import StepLabel from '@material-ui/core/StepLabel' +import StepContent from '@material-ui/core/StepContent' import { withStyles } from '@material-ui/core/styles' import * as React from 'react' import GnoForm from '~/components/forms/GnoForm' @@ -123,36 +124,38 @@ class GnoStepper extends React.PureComponent { return ( - - {steps.map(label => ( - - {label} - - ))} - - {(submitting: boolean, validating: boolean) => { + {(submitting: boolean, validating: boolean, ...rest: any) => { const disabled = disabledWhenValidating ? submitting || validating : submitting return ( - - - - - + + {steps.map(label => ( + + {label} + + {activePage(rest)} + + + + + + + + ))} + ) }} diff --git a/src/components/forms/GnoForm/index.jsx b/src/components/forms/GnoForm/index.jsx index 9a0a5e76..f808048f 100644 --- a/src/components/forms/GnoForm/index.jsx +++ b/src/components/forms/GnoForm/index.jsx @@ -15,7 +15,6 @@ type Props = { padding: number, validation?: (values: Object) => Object | Promise, initialValues?: Object, - render: Function, } const stylesBasedOn = (padding: number): $Shape => ({ @@ -26,7 +25,7 @@ const stylesBasedOn = (padding: number): $Shape => ({ }) const GnoForm = ({ - onSubmit, validation, initialValues, children, padding, render, + onSubmit, validation, initialValues, children, padding, }: Props) => (
( - {render(rest)} - {children(rest.submitting, rest.validating)} + {children(rest.submitting, rest.validating, rest)}
)} />