// @flow import React from 'react'; import Big from 'bignumber.js'; import { formatNumber } from 'utils/formatters'; import removeIcon from 'assets/images/icon-remove.svg'; export default class TokenRow extends React.Component { props: { balance: Big, symbol: string, custom?: boolean, onRemove: (symbol: string) => void }; state = { showLongBalance: false }; render() { const { balance, symbol, custom } = this.props; const { showLongBalance } = this.state; return ( {!!custom && } {showLongBalance ? balance.toString() : formatNumber(balance)} {symbol} ); } toggleShowLongBalance = (e: SyntheticInputEvent) => { e.preventDefault(); this.setState(state => { return { showLongBalance: !state.showLongBalance }; }); }; onRemove = () => { this.props.onRemove(this.props.symbol); }; }