mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
step & button fixes
This commit is contained in:
parent
e91de4a64d
commit
720705cb6c
@ -100,12 +100,6 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Wallet"
|
||||
},
|
||||
{
|
||||
"title": "Complete"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { PureComponent } from 'react'
|
||||
import React, { PureComponent, FormEvent } from 'react'
|
||||
import Input from '../../components/atoms/Form/Input'
|
||||
import Label from '../../components/atoms/Form/Label'
|
||||
import Row from '../../components/atoms/Form/Row'
|
||||
@ -18,6 +18,7 @@ interface StepProps {
|
||||
title: string
|
||||
next: any
|
||||
prev: any
|
||||
totalSteps: number
|
||||
}
|
||||
|
||||
export default class Step extends PureComponent<StepProps, {}> {
|
||||
@ -31,8 +32,9 @@ export default class Step extends PureComponent<StepProps, {}> {
|
||||
}
|
||||
|
||||
public nextButton() {
|
||||
let { currentStep, next } = this.props
|
||||
if (currentStep < 3) {
|
||||
let { currentStep, next, totalSteps } = this.props
|
||||
|
||||
if (currentStep < totalSteps) {
|
||||
return <Button onClick={next}>Next</Button>
|
||||
}
|
||||
return null
|
||||
@ -47,7 +49,8 @@ export default class Step extends PureComponent<StepProps, {}> {
|
||||
inputChange,
|
||||
inputToArrayChange,
|
||||
files,
|
||||
state
|
||||
state,
|
||||
totalSteps
|
||||
} = this.props
|
||||
|
||||
if (currentStep !== index + 1) {
|
||||
@ -102,6 +105,7 @@ export default class Step extends PureComponent<StepProps, {}> {
|
||||
{this.previousButton()}
|
||||
{this.nextButton()}
|
||||
|
||||
{currentStep === totalSteps && (
|
||||
<User.Consumer>
|
||||
{states =>
|
||||
states.isLogged ? (
|
||||
@ -113,6 +117,7 @@ export default class Step extends PureComponent<StepProps, {}> {
|
||||
)
|
||||
}
|
||||
</User.Consumer>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
@ -70,18 +70,17 @@ class Publish extends Component<{}, PublishState> {
|
||||
|
||||
private next = () => {
|
||||
let { currentStep } = this.state
|
||||
currentStep = currentStep >= 2 ? 3 : currentStep + 1
|
||||
this.setState({
|
||||
currentStep: currentStep
|
||||
})
|
||||
const totalSteps = form.steps.length
|
||||
|
||||
currentStep =
|
||||
currentStep >= totalSteps - 1 ? totalSteps : currentStep + 1
|
||||
this.setState({ currentStep })
|
||||
}
|
||||
|
||||
private prev = () => {
|
||||
let { currentStep } = this.state
|
||||
currentStep = currentStep <= 1 ? 1 : currentStep - 1
|
||||
this.setState({
|
||||
currentStep: currentStep
|
||||
})
|
||||
this.setState({ currentStep })
|
||||
}
|
||||
|
||||
private toStart = () => {
|
||||
@ -186,6 +185,7 @@ class Publish extends Component<{}, PublishState> {
|
||||
state={this.state}
|
||||
next={this.next}
|
||||
prev={this.prev}
|
||||
totalSteps={form.steps.length}
|
||||
/>
|
||||
))}
|
||||
</Form>
|
||||
|
Loading…
Reference in New Issue
Block a user