mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
prepare disabling button based on form validation
This commit is contained in:
parent
1fee0cfc66
commit
d58a5f1f1b
@ -37,10 +37,9 @@
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
color: rgba($brand-white, .7);
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
opacity: .8;
|
||||
opacity: .5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ interface ButtonProps {
|
||||
link?: boolean
|
||||
href?: string
|
||||
onClick?: any
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
export default class Button extends PureComponent<ButtonProps, any> {
|
||||
|
@ -26,7 +26,17 @@ interface StepProps {
|
||||
content?: string
|
||||
}
|
||||
|
||||
export default class Step extends PureComponent<StepProps, {}> {
|
||||
interface StepState {
|
||||
inputInvalid: boolean
|
||||
}
|
||||
|
||||
export default class Step extends PureComponent<StepProps, StepState> {
|
||||
public state = {
|
||||
// TODO: manipulate with some form validation for every step,
|
||||
// should be 'true' by default here
|
||||
inputInvalid: false
|
||||
}
|
||||
|
||||
public previousButton() {
|
||||
let { currentStep, prev } = this.props
|
||||
|
||||
@ -42,9 +52,14 @@ export default class Step extends PureComponent<StepProps, {}> {
|
||||
|
||||
public nextButton() {
|
||||
let { currentStep, next, totalSteps } = this.props
|
||||
const { inputInvalid } = this.state
|
||||
|
||||
if (currentStep < totalSteps) {
|
||||
return <Button onClick={next}>Next →</Button>
|
||||
return (
|
||||
<Button disabled={inputInvalid} onClick={next}>
|
||||
Next →
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -108,7 +108,8 @@ class Publish extends Component<{}, PublishState> {
|
||||
publishingError: '',
|
||||
isPublishing: true
|
||||
})
|
||||
const account = await this.context.ocean.getAccounts()
|
||||
const { ocean } = this.context
|
||||
const account = await ocean.getAccounts()
|
||||
const newAsset = {
|
||||
// OEP-08 Attributes
|
||||
// https://github.com/oceanprotocol/OEPs/tree/master/8
|
||||
@ -138,10 +139,7 @@ class Publish extends Component<{}, PublishState> {
|
||||
}
|
||||
|
||||
try {
|
||||
const asset = await this.context.ocean.registerAsset(
|
||||
newAsset,
|
||||
account[0]
|
||||
)
|
||||
const asset = await ocean.registerAsset(newAsset, account[0])
|
||||
this.setState({
|
||||
publishedDid: asset.id,
|
||||
isPublished: true
|
||||
|
Loading…
Reference in New Issue
Block a user