aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-12-14 09:46:48 +0800
committerFabio Berger <me@fabioberger.com>2017-12-14 09:46:48 +0800
commitceae51fe322ebf444d0c8b61fdb7a86ab11c8071 (patch)
treedacb8e6489b102e9a71c315c27a00e9422fc1ad6
parentb054080fa1da88460f52021278fb33b8d88371a3 (diff)
downloaddexon-sol-tools-ceae51fe322ebf444d0c8b61fdb7a86ab11c8071.tar.gz
dexon-sol-tools-ceae51fe322ebf444d0c8b61fdb7a86ab11c8071.tar.zst
dexon-sol-tools-ceae51fe322ebf444d0c8b61fdb7a86ab11c8071.zip
Make label optional and make sure the input field still renders properly without it
-rw-r--r--packages/website/ts/components/inputs/token_amount_input.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx
index f39341a4f..1ae9bc85e 100644
--- a/packages/website/ts/components/inputs/token_amount_input.tsx
+++ b/packages/website/ts/components/inputs/token_amount_input.tsx
@@ -8,9 +8,9 @@ import {BalanceBoundedInput} from 'ts/components/inputs/balance_bounded_input';
import {InputErrMsg, Token, TokenState, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types';
interface TokenAmountInputProps {
- label: string;
token: Token;
tokenState: TokenState;
+ label?: string;
amount?: BigNumber;
shouldShowIncompleteErrs: boolean;
shouldCheckBalance: boolean;
@@ -26,8 +26,9 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok
const amount = this.props.amount ?
ZeroEx.toUnitAmount(this.props.amount, this.props.token.decimals) :
undefined;
+ const hasLabel = !_.isUndefined(this.props.label);
return (
- <div className="flex overflow-hidden" style={{height: 84}}>
+ <div className="flex overflow-hidden" style={{height: hasLabel ? 84 : 62}}>
<BalanceBoundedInput
label={this.props.label}
amount={amount}
@@ -38,7 +39,7 @@ export class TokenAmountInput extends React.Component<TokenAmountInputProps, Tok
shouldShowIncompleteErrs={this.props.shouldShowIncompleteErrs}
onVisitBalancesPageClick={this.props.onVisitBalancesPageClick}
/>
- <div style={{paddingTop: 39}}>
+ <div style={{paddingTop: hasLabel ? 39 : 14}}>
{this.props.token.symbol}
</div>
</div>