From 1a06e6b305a96076afc86c8b5073a907d5670bfe Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 27 Jul 2018 11:48:04 -0700 Subject: Add loading state for initial load and other PR feedback --- .../ts/components/inputs/allowance_state_toggle.tsx | 21 ++++++++++++--------- .../ts/components/ui/allowance_state_view.tsx | 3 ++- 2 files changed, 14 insertions(+), 10 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 a8f8f554f..5de041f6d 100644 --- a/packages/website/ts/components/inputs/allowance_state_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_state_toggle.tsx @@ -1,3 +1,4 @@ +import { colors } from '@0xproject/react-shared'; import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import * as React from 'react'; @@ -28,6 +29,7 @@ export interface AllowanceStateToggleProps { export interface AllowanceStateToggleState { allowanceState: AllowanceState; prevTokenState: TokenState; + loadingMessage?: string; } const DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1); @@ -89,23 +91,23 @@ export class AllowanceStateToggle extends React.Component - {isLockingToken ? 'Locking' : 'Unlocking'} {symbol} + + {this.state.loadingMessage || 'Loading...'} ); case AllowanceState.Locked: return ( - + Click to enable {symbol} for trading ); case AllowanceState.Unlocked: return ( - + {symbol} is available for trading ); @@ -121,14 +123,15 @@ export class AllowanceStateToggle extends React.Component ( +const renderCheck = (color: string = colors.lightGreen) => (