From 3b26a656f725b2100f346e4f7eeff33b741562f6 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 29 May 2018 22:29:31 -0700 Subject: Add StandardIconRow --- packages/website/ts/components/wallet/wallet.tsx | 75 +++++++++++++----------- 1 file changed, 41 insertions(+), 34 deletions(-) (limited to 'packages/website/ts/components') diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 626d77ffe..219854f4a 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -92,9 +92,6 @@ const styles: Styles = { zIndex: zIndex.aboveOverlay, position: 'relative', }, - headerItemInnerDiv: { - paddingLeft: 65, - }, footerItemInnerDiv: { paddingLeft: 24, borderTopColor: colors.walletBorder, @@ -108,6 +105,7 @@ const styles: Styles = { }, tokenItem: { backgroundColor: colors.walletDefaultItemBackground, + minHeight: 85, }, amountLabel: { fontWeight: 'bold', @@ -132,7 +130,7 @@ const styles: Styles = { }; const ETHER_ICON_PATH = '/images/ether.png'; -const ICON_DIMENSION = 24; +const ICON_DIMENSION = 28; const TOKEN_AMOUNT_DISPLAY_PRECISION = 3; const BODY_ITEM_KEY = 'BODY'; const HEADER_ITEM_KEY = 'HEADER'; @@ -211,12 +209,9 @@ export class Wallet extends React.Component { const userAddress = this.props.userAddress; const primaryText = 'wallet'; return ( - } - style={styles.paddedItem} - innerDivStyle={styles.headerItemInnerDiv} + } + main={primaryText.toUpperCase()} /> ); } @@ -235,11 +230,10 @@ export class Wallet extends React.Component { const primaryText = utils.getAddressBeginAndEnd(userAddress); return ( - } - style={{ ...styles.paddedItem, ...styles.borderedItem }} - innerDivStyle={styles.headerItemInnerDiv} + } + main={primaryText} + style={styles.borderedItem} /> ); @@ -340,12 +334,6 @@ export class Wallet extends React.Component { const accessoryItemConfig = { wrappedEtherDirection: Side.Deposit, }; - const isInWrappedEtherState = - !_.isUndefined(this.state.wrappedEtherDirection) && - this.state.wrappedEtherDirection === accessoryItemConfig.wrappedEtherDirection; - const style = isInWrappedEtherState - ? { ...walletItemStyles.focusedItem, ...styles.paddedItem } - : { ...styles.tokenItem, ...styles.borderedItem, ...styles.paddedItem }; const key = ETHER_ITEM_KEY; return this._renderBalanceRow(key, icon, primaryText, secondaryText, accessoryItemConfig, 'eth-row'); } @@ -398,21 +386,22 @@ export class Wallet extends React.Component { const shouldShowWrapEtherItem = !_.isUndefined(this.state.wrappedEtherDirection) && this.state.wrappedEtherDirection === accessoryItemConfig.wrappedEtherDirection; - const style = shouldShowWrapEtherItem - ? { ...walletItemStyles.focusedItem, ...styles.paddedItem } - : { ...styles.tokenItem, ...styles.borderedItem, ...styles.paddedItem }; + const additionalStyle = shouldShowWrapEtherItem ? walletItemStyles.focusedItem : styles.borderedItem; + const style = { ...styles.tokenItem, ...additionalStyle }; const etherToken = this._getEthToken(); return (
-
-
{icon}
-
- {primaryText} - {secondaryText} -
-
-
{this._renderAccessoryItems(accessoryItemConfig)}
-
+ + {primaryText} + {secondaryText} +
+ } + accessory={this._renderAccessoryItems(accessoryItemConfig)} + style={style} + /> {shouldShowWrapEtherItem && ( { private _getEthToken(): Token { return utils.getEthToken(this.props.tokenByAddress); } -} // tslint:disable:max-file-line-count +} + +interface StandardIconRowProps { + icon: React.ReactNode; + main: React.ReactNode; + accessory?: React.ReactNode; + style?: React.CSSProperties; +} +const StandardIconRow = (props: StandardIconRowProps) => { + return ( +
+
{props.icon}
+
{props.main}
+
+
{props.accessory}
+
+ ); +}; +// tslint:disable:max-file-line-count -- cgit v1.2.3