Implementing back on stepper when it is first page
This commit is contained in:
parent
1b4cca91a9
commit
0fc735187e
|
@ -8,6 +8,7 @@ import * as React from 'react'
|
||||||
import GnoForm from '~/components/forms/GnoForm'
|
import GnoForm from '~/components/forms/GnoForm'
|
||||||
import Hairline from '~/components/layout/Hairline'
|
import Hairline from '~/components/layout/Hairline'
|
||||||
import Button from '~/components/layout/Button'
|
import Button from '~/components/layout/Button'
|
||||||
|
import { history } from '~/store'
|
||||||
import Controls from './Controls'
|
import Controls from './Controls'
|
||||||
|
|
||||||
export { default as Step } from './Step'
|
export { default as Step } from './Step'
|
||||||
|
@ -96,10 +97,17 @@ class GnoStepper extends React.PureComponent<Props, State> {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
previous = () =>
|
previous = () => {
|
||||||
this.setState(state => ({
|
const firstPage = this.state.page === 0
|
||||||
|
|
||||||
|
if (firstPage) {
|
||||||
|
return history.goBack()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.setState(state => ({
|
||||||
page: Math.max(state.page - 1, 0),
|
page: Math.max(state.page - 1, 0),
|
||||||
}))
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
handleSubmit = async (values: Object) => {
|
handleSubmit = async (values: Object) => {
|
||||||
const { children, onSubmit } = this.props
|
const { children, onSubmit } = this.props
|
||||||
|
|
Loading…
Reference in New Issue