1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-26 03:06:49 +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:
claudiaHash 2022-04-13 18:24:19 +03:00 committed by GitHub
parent 9ebddd814d
commit 1256c20904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -29,7 +29,7 @@ export interface InputProps {
options?: string[]
sortOptions?: boolean
additionalComponent?: ReactElement
value?: string
value?: string | number
onChange?(
e:
| FormEvent<HTMLInputElement>

View File

@ -61,15 +61,16 @@ export default function TradeInput({
placeholder="0"
field={field}
form={form}
disabled={!accountId || disabled}
additionalComponent={<Error meta={meta} />}
value={`${field.value}`}
{...field}
onChange={(e: ChangeEvent<HTMLInputElement>) => {
handleChange(e)
handleValueChange(name, Number(e.target.value))
// debounce needed to avoid validating the wrong (pass) value
debounce(() => validateForm(), 100)
}}
disabled={!accountId || disabled}
additionalComponent={<Error meta={meta} />}
/>
)}
</Field>