mirror of
https://github.com/oceanprotocol/market.git
synced 2024-06-30 22:01:44 +02:00
Trade input accepts decimals with leading 0 (#1294)
* input accepts number with leading 0 decimals * input fields changes * value type fix Co-authored-by: ClaudiaHolhos <claudia@oceanprotocol.com>
This commit is contained in:
parent
9ebddd814d
commit
1256c20904
|
@ -29,7 +29,7 @@ export interface InputProps {
|
||||||
options?: string[]
|
options?: string[]
|
||||||
sortOptions?: boolean
|
sortOptions?: boolean
|
||||||
additionalComponent?: ReactElement
|
additionalComponent?: ReactElement
|
||||||
value?: string
|
value?: string | number
|
||||||
onChange?(
|
onChange?(
|
||||||
e:
|
e:
|
||||||
| FormEvent<HTMLInputElement>
|
| FormEvent<HTMLInputElement>
|
||||||
|
|
|
@ -61,15 +61,16 @@ export default function TradeInput({
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
field={field}
|
field={field}
|
||||||
form={form}
|
form={form}
|
||||||
|
disabled={!accountId || disabled}
|
||||||
|
additionalComponent={<Error meta={meta} />}
|
||||||
value={`${field.value}`}
|
value={`${field.value}`}
|
||||||
|
{...field}
|
||||||
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
||||||
handleChange(e)
|
handleChange(e)
|
||||||
handleValueChange(name, Number(e.target.value))
|
handleValueChange(name, Number(e.target.value))
|
||||||
// debounce needed to avoid validating the wrong (pass) value
|
// debounce needed to avoid validating the wrong (pass) value
|
||||||
debounce(() => validateForm(), 100)
|
debounce(() => validateForm(), 100)
|
||||||
}}
|
}}
|
||||||
disabled={!accountId || disabled}
|
|
||||||
additionalComponent={<Error meta={meta} />}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user