From b28cc6d7d300d209bee0091369a8e221eaeb4e64 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 20 Jul 2018 10:14:17 -0700 Subject: Show token name dynamically in tooltip --- .../components/inputs/allowance_state_toggle.tsx | 24 ++++++++++++---------- packages/website/ts/components/ui/container.tsx | 1 + packages/website/ts/components/wallet/wallet.tsx | 2 +- .../ts/containers/inputs/allowance_state_toggle.ts | 5 ++++- 4 files changed, 19 insertions(+), 13 deletions(-) (limited to 'packages/website') diff --git a/packages/website/ts/components/inputs/allowance_state_toggle.tsx b/packages/website/ts/components/inputs/allowance_state_toggle.tsx index 8908e457b..bf661dee8 100644 --- a/packages/website/ts/components/inputs/allowance_state_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_state_toggle.tsx @@ -2,18 +2,18 @@ import { colors } from '@0xproject/react-shared'; import * as React from 'react'; import { AllowanceStateView, AllowanceState } from 'ts/components/ui/allowance_state_view'; import { Token, TokenState } from 'ts/types'; +import { Container } from 'ts/components/ui/container'; import ReactTooltip = require('react-tooltip'); -export interface AllowanceStateToggleProps {} +export interface AllowanceStateToggleProps { + token: Token; + tokenState: TokenState; +} export interface AllowanceStateToggleState { allowanceState: AllowanceState; - token?: Token; - tokenState?: TokenState; } -const TOOLTIP_ID = 'AllowanceStateToggleTooltip'; - const flip = () => Math.random() < 0.5; export class AllowanceStateToggle extends React.Component { @@ -21,16 +21,18 @@ export class AllowanceStateToggle extends React.Component - {this._getTooltipContent()} -
+ + {this._getTooltipContent()} +
-
+ ); } private _getTooltipContent(): React.ReactNode { + const symbol = this.props.token.symbol; switch (this.state.allowanceState) { case AllowanceState.Loading: // TODO: support both awaiting confirmation and awaiting transaction. @@ -38,13 +40,13 @@ export class AllowanceStateToggle extends React.Component - Click to enable WETH for trading + Click to enable {symbol} for trading ); case AllowanceState.Unlocked: return ( - WETH is available for trading + {symbol} is available for trading ); default: diff --git a/packages/website/ts/components/ui/container.tsx b/packages/website/ts/components/ui/container.tsx index 427cc6cc7..afc2c08a4 100644 --- a/packages/website/ts/components/ui/container.tsx +++ b/packages/website/ts/components/ui/container.tsx @@ -31,6 +31,7 @@ export interface ContainerProps { bottom?: string; zIndex?: number; Tag?: ContainerTag; + cursor?: string; } export const Container: React.StatelessComponent = props => { diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index f5e054793..32c56ef14 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -422,7 +422,7 @@ export class Wallet extends React.Component { // refetchTokenStateAsync={async () => this.props.refetchTokenStateAsync(config.token.address)} // /> // ); - return ; + return ; } private _renderAmount( amount: BigNumber, diff --git a/packages/website/ts/containers/inputs/allowance_state_toggle.ts b/packages/website/ts/containers/inputs/allowance_state_toggle.ts index 6e2698b0b..cdda5ecf0 100644 --- a/packages/website/ts/containers/inputs/allowance_state_toggle.ts +++ b/packages/website/ts/containers/inputs/allowance_state_toggle.ts @@ -8,7 +8,10 @@ import { BalanceErrs, Token, TokenState } from 'ts/types'; import { AllowanceStateToggle as AllowanceStateToggleComponent } from 'ts/components/inputs/allowance_state_toggle'; import { Dispatcher } from 'ts/redux/dispatcher'; -interface AllowanceStateToggleProps {} +interface AllowanceStateToggleProps { + token: Token; + tokenState: TokenState; +} interface ConnectedState {} -- cgit