import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { ColorOption } from '../style/theme'; import { util } from '../util/util'; import { Container, Input } from './ui'; export interface AmountInputProps { fontColor?: ColorOption; fontSize?: string; value?: BigNumber; onChange: (value?: BigNumber) => void; } export class AmountInput extends React.Component { public static defaultProps = { onChange: util.boundNoop, }; public render(): React.ReactNode { const { fontColor, fontSize, value } = this.props; return ( ); } private readonly _handleChange = (event: React.ChangeEvent): void => { const value = event.target.value; let bigNumberValue; if (!_.isEmpty(value)) { try { bigNumberValue = new BigNumber(event.target.value); } catch { // We don't want to allow values that can't be a BigNumber, so don't even call onChange. return; } } this.props.onChange(bigNumberValue); }; }