diff options
Diffstat (limited to 'packages/website')
-rw-r--r-- | packages/website/ts/components/inputs/balance_bounded_input.tsx | 33 | ||||
-rw-r--r-- | packages/website/ts/components/wallet/wrap_ether_item.tsx | 6 |
2 files changed, 17 insertions, 22 deletions
diff --git a/packages/website/ts/components/inputs/balance_bounded_input.tsx b/packages/website/ts/components/inputs/balance_bounded_input.tsx index f91a99355..e5b502b25 100644 --- a/packages/website/ts/components/inputs/balance_bounded_input.tsx +++ b/packages/website/ts/components/inputs/balance_bounded_input.tsx @@ -105,19 +105,15 @@ export class BalanceBoundedInput extends React.Component<BalanceBoundedInputProp ); } private _onValueChange(e: any, amountString: string): void { - this._setAmountState( - amountString, - this.props.balance, - () => { - const isValid = _.isUndefined(this._validate(amountString, this.props.balance)); - const isPositiveNumber = utils.isNumeric(amountString) && !_.includes(amountString, '-'); - if (isPositiveNumber) { - this.props.onChange(isValid, new BigNumber(amountString)); - } else { - this.props.onChange(isValid); - } - }, - ); + this._setAmountState(amountString, this.props.balance, () => { + const isValid = _.isUndefined(this._validate(amountString, this.props.balance)); + const isPositiveNumber = utils.isNumeric(amountString) && !_.includes(amountString, '-'); + if (isPositiveNumber) { + this.props.onChange(isValid, new BigNumber(amountString)); + } else { + this.props.onChange(isValid); + } + }); } private _validate(amountString: string, balance: BigNumber): React.ReactNode { if (!utils.isNumeric(amountString)) { @@ -163,9 +159,12 @@ export class BalanceBoundedInput extends React.Component<BalanceBoundedInputProp private _setAmountState(amount: string, balance: BigNumber, callback: () => void = _.noop): void { const errorMsg = this._validate(amount, balance); this.props.onErrorMsgChange(errorMsg); - this.setState({ - amountString: amount, - errMsg: errorMsg, - }, callback); + this.setState( + { + amountString: amount, + errMsg: errorMsg, + }, + callback, + ); } } diff --git a/packages/website/ts/components/wallet/wrap_ether_item.tsx b/packages/website/ts/components/wallet/wrap_ether_item.tsx index 581d2ba97..db0983407 100644 --- a/packages/website/ts/components/wallet/wrap_ether_item.tsx +++ b/packages/website/ts/components/wallet/wrap_ether_item.tsx @@ -172,11 +172,7 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther ); } private _renderErrorMsg(): React.ReactNode { - return ( - <div style={styles.errorMsg}> - {this.state.errorMsg} - </div> - ); + return <div style={styles.errorMsg}>{this.state.errorMsg}</div>; } private async _wrapEtherConfirmationActionAsync(): Promise<void> { this.setState({ |