diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-26 09:35:06 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-26 09:35:06 +0800 |
commit | d5d99b9d2e3c793a95c68c1035246644b3ae80c6 (patch) | |
tree | 880f13fd7dba96285c23986e505f3166de099a4c /packages/instant/src/components/scaling_amount_input.tsx | |
parent | ab2759f43105c0f2d441790e138840706c6759f8 (diff) | |
download | dexon-0x-contracts-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.gz dexon-0x-contracts-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.tar.zst dexon-0x-contracts-d5d99b9d2e3c793a95c68c1035246644b3ae80c6.zip |
chore: dont override toString of BigNumber and other PR feedback
Diffstat (limited to 'packages/instant/src/components/scaling_amount_input.tsx')
-rw-r--r-- | packages/instant/src/components/scaling_amount_input.tsx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/instant/src/components/scaling_amount_input.tsx b/packages/instant/src/components/scaling_amount_input.tsx index 23a15305a..655ae2b74 100644 --- a/packages/instant/src/components/scaling_amount_input.tsx +++ b/packages/instant/src/components/scaling_amount_input.tsx @@ -1,9 +1,8 @@ -import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { ColorOption } from '../style/theme'; -import { BigNumberInput } from '../util/big_number'; +import { BigNumberInput } from '../util/big_number_input'; import { util } from '../util/util'; import { ScalingInput } from './scaling_input'; @@ -12,8 +11,8 @@ export interface ScalingAmountInputProps { maxFontSizePx: number; textLengthThreshold: number; fontColor?: ColorOption; - value?: BigNumber; - onChange: (value?: BigNumber) => void; + value?: BigNumberInput; + onChange: (value?: BigNumberInput) => void; onFontSizeChange: (fontSizePx: number) => void; } @@ -31,7 +30,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps> onFontSizeChange={onFontSizeChange} fontColor={fontColor} onChange={this._handleChange} - value={!_.isUndefined(value) ? value.toString() : ''} + value={!_.isUndefined(value) ? value.toDisplayString() : ''} placeholder="0.00" emptyInputWidthCh={3.5} /> @@ -42,7 +41,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps> let bigNumberValue; if (!_.isEmpty(value)) { try { - bigNumberValue = new BigNumberInput(event.target.value); + bigNumberValue = new BigNumberInput(value); } catch { // We don't want to allow values that can't be a BigNumber, so don't even call onChange. return; |