2017-09-25 02:06:28 +00:00
|
|
|
import removeIcon from 'assets/images/icon-remove.svg';
|
2017-07-13 21:02:39 +00:00
|
|
|
import React from 'react';
|
2017-11-12 19:45:52 +00:00
|
|
|
import { TokenValue } from 'libs/units';
|
|
|
|
import { UnitDisplay } from 'components/ui';
|
2017-09-25 02:06:28 +00:00
|
|
|
import './TokenRow.scss';
|
2017-07-13 21:02:39 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
interface Props {
|
2017-11-12 19:45:52 +00:00
|
|
|
balance: TokenValue;
|
2017-09-25 02:06:28 +00:00
|
|
|
symbol: string;
|
|
|
|
custom?: boolean;
|
2017-11-12 19:45:52 +00:00
|
|
|
decimal: number;
|
2017-09-25 02:06:28 +00:00
|
|
|
onRemove(symbol: string): void;
|
|
|
|
}
|
|
|
|
interface State {
|
|
|
|
showLongBalance: boolean;
|
|
|
|
}
|
2017-07-13 21:02:39 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
export default class TokenRow extends React.Component<Props, State> {
|
|
|
|
public state = {
|
2017-07-13 21:02:39 +00:00
|
|
|
showLongBalance: false
|
|
|
|
};
|
2017-11-12 19:45:52 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public render() {
|
2017-11-12 19:45:52 +00:00
|
|
|
const { balance, symbol, custom, decimal } = this.props;
|
2017-07-14 17:04:08 +00:00
|
|
|
const { showLongBalance } = this.state;
|
2017-11-12 19:45:52 +00:00
|
|
|
|
2017-07-13 21:02:39 +00:00
|
|
|
return (
|
Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
* Break out files, style up account info.
* Style up token balances.
* Equivalent values styling.
* Sidebar promos.
* Fix up delete button and add custom form.
* Even spacing.
* Unlog
* Convert Big types to Ether types
* Fix test to expect Ether instead of Big
2017-09-08 19:26:51 +00:00
|
|
|
<tr className="TokenRow">
|
2017-07-13 21:02:39 +00:00
|
|
|
<td
|
Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
* Break out files, style up account info.
* Style up token balances.
* Equivalent values styling.
* Sidebar promos.
* Fix up delete button and add custom form.
* Even spacing.
* Unlog
* Convert Big types to Ether types
* Fix test to expect Ether instead of Big
2017-09-08 19:26:51 +00:00
|
|
|
className="TokenRow-balance"
|
2017-07-13 21:02:39 +00:00
|
|
|
title={`${balance.toString()} (Double-Click)`}
|
|
|
|
onDoubleClick={this.toggleShowLongBalance}
|
|
|
|
>
|
2017-11-12 19:45:52 +00:00
|
|
|
{!!custom && (
|
2017-07-13 21:02:39 +00:00
|
|
|
<img
|
2017-07-14 17:04:08 +00:00
|
|
|
src={removeIcon}
|
Sidebar refactor / style update (#173)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
* Break out files, style up account info.
* Style up token balances.
* Equivalent values styling.
* Sidebar promos.
* Fix up delete button and add custom form.
* Even spacing.
* Unlog
* Convert Big types to Ether types
* Fix test to expect Ether instead of Big
2017-09-08 19:26:51 +00:00
|
|
|
className="TokenRow-balance-remove"
|
2017-07-13 21:02:39 +00:00
|
|
|
title="Remove Token"
|
|
|
|
onClick={this.onRemove}
|
2017-09-25 02:06:28 +00:00
|
|
|
tabIndex={0}
|
2017-11-12 19:45:52 +00:00
|
|
|
/>
|
|
|
|
)}
|
2017-07-13 21:02:39 +00:00
|
|
|
<span>
|
2017-11-12 19:45:52 +00:00
|
|
|
<UnitDisplay
|
|
|
|
value={balance}
|
|
|
|
decimal={decimal}
|
|
|
|
displayShortBalance={!showLongBalance}
|
|
|
|
/>
|
2017-07-13 21:02:39 +00:00
|
|
|
</span>
|
|
|
|
</td>
|
2017-11-12 19:45:52 +00:00
|
|
|
<td className="TokenRow-symbol">{symbol}</td>
|
2017-07-13 21:02:39 +00:00
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public toggleShowLongBalance = (
|
|
|
|
// TODO: don't use any
|
|
|
|
e: any
|
|
|
|
) => {
|
2017-07-13 21:02:39 +00:00
|
|
|
e.preventDefault();
|
|
|
|
this.setState(state => {
|
|
|
|
return {
|
|
|
|
showLongBalance: !state.showLongBalance
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public onRemove = () => {
|
2017-07-13 21:02:39 +00:00
|
|
|
this.props.onRemove(this.props.symbol);
|
|
|
|
};
|
|
|
|
}
|