mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
disable form fields when form is submitting
This commit is contained in:
parent
8bfa030bed
commit
a67a35e508
@ -3,6 +3,11 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.field[data-is-submitting] {
|
||||
pointer-events: none;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.field .field {
|
||||
margin-bottom: calc(var(--spacer) / 2);
|
||||
}
|
||||
|
@ -3,7 +3,8 @@ import InputElement from './InputElement'
|
||||
import Help from './Help'
|
||||
import Label from './Label'
|
||||
import styles from './index.module.css'
|
||||
import { ErrorMessage } from 'formik'
|
||||
import { ErrorMessage, FormikState, FieldProps, FieldInputProps } from 'formik'
|
||||
import { MetadataPublishForm } from '../../../@types/Metadata'
|
||||
|
||||
export interface InputProps {
|
||||
name: string
|
||||
@ -28,19 +29,18 @@ export interface InputProps {
|
||||
pattern?: string
|
||||
min?: string
|
||||
disabled?: boolean
|
||||
field?: {
|
||||
name: string
|
||||
value: string
|
||||
onChange: () => void
|
||||
onBlur: () => void
|
||||
}
|
||||
field?: FieldInputProps<any>
|
||||
form?: FormikState<any>
|
||||
}
|
||||
|
||||
export default function Input(props: Partial<InputProps>): ReactElement {
|
||||
const { required, name, label, help, additionalComponent, field } = props
|
||||
|
||||
return (
|
||||
<div className={styles.field}>
|
||||
<div
|
||||
className={styles.field}
|
||||
data-is-submitting={props.form && props.form.isSubmitting ? true : null}
|
||||
>
|
||||
<Label htmlFor={name} required={required}>
|
||||
{label}
|
||||
</Label>
|
||||
|
@ -86,7 +86,7 @@ export default function PublishForm({
|
||||
])
|
||||
|
||||
// User feedback and redirect to new asset detail page
|
||||
toast.success('asset created successfully')
|
||||
ddo && toast.success('asset created successfully')
|
||||
toast.dismiss(submittingToast)
|
||||
|
||||
// TODO: reset form state and make sure persistant form in localStorage is cleared
|
||||
|
Loading…
Reference in New Issue
Block a user