import removeIcon from 'assets/images/icon-remove.svg'; import { BigNumber } from 'bignumber.js'; import React from 'react'; import { formatNumber } from 'utils/formatters'; import './TokenRow.scss'; interface Props { balance: BigNumber; symbol: string; custom?: boolean; onRemove(symbol: string): void; } interface State { showLongBalance: boolean; } export default class TokenRow extends React.Component { public state = { showLongBalance: false }; public render() { const { balance, symbol, custom } = this.props; const { showLongBalance } = this.state; return ( {!!custom && } {showLongBalance ? balance.toString() : formatNumber(balance)} {symbol} ); } public toggleShowLongBalance = ( // TODO: don't use any e: any ) => { e.preventDefault(); this.setState(state => { return { showLongBalance: !state.showLongBalance }; }); }; public onRemove = () => { this.props.onRemove(this.props.symbol); }; }