From 869216f51d369f6237d5db7ea4a4a615d2a27b0f Mon Sep 17 00:00:00 2001 From: hbulgarini Date: Wed, 15 Sep 2021 17:03:58 -0300 Subject: [PATCH 1/2] Setting margin left on balance and adding tooltip --- src/components/SenderDropdownItem.tsx | 53 +++++++++++++++++---------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/src/components/SenderDropdownItem.tsx b/src/components/SenderDropdownItem.tsx index daa74fbf..cd64b7a9 100644 --- a/src/components/SenderDropdownItem.tsx +++ b/src/components/SenderDropdownItem.tsx @@ -16,7 +16,7 @@ import React, { useState } from 'react'; import cx from 'classnames'; -import { Box, makeStyles, Typography } from '@material-ui/core'; +import { Box, makeStyles, Typography, Tooltip } from '@material-ui/core'; import shorterItem from '../util/shortenItem'; import AccountIdenticon from './AccountIdenticon'; import { useGUIContext } from '../contexts/GUIContextProvider'; @@ -31,8 +31,10 @@ interface Props { const useStyles = makeStyles((theme) => ({ topBalance: { - minWidth: theme.spacing(14) + minWidth: theme.spacing(14), + marginLeft: theme.spacing(5) }, + bottomBalance: { border: `1px solid ${theme.palette.divider}`, borderRadius: theme.spacing(0.5), @@ -63,7 +65,8 @@ const useStyles = makeStyles((theme) => ({ }, address: { marginLeft: theme.spacing(0.5) - } + }, + addressContainer: { maxWidth: theme.spacing(30) } })); const SenderDropdownItem = ({ name, address, balance, companionBalance, showCompanion }: Props) => { @@ -80,31 +83,41 @@ const SenderDropdownItem = ({ name, address, balance, companionBalance, showComp setHoover(false); }} > - - - - {name} [{shorterItem(address)}] - + + + +
+ + {name} [{shorterItem(address)}] + +
- - - {balance} - - - {showCompanion && isBridged && ( - + - {companionBalance} + {balance} - )} + {showCompanion && isBridged && ( + + + {companionBalance} + + + )} + -
+
); }; From 02bc652c004e814391804a14f002296a7ff34377 Mon Sep 17 00:00:00 2001 From: hbulgarini Date: Fri, 17 Sep 2021 10:41:53 -0300 Subject: [PATCH 2/2] Setting width and adding tooltip --- src/components/SenderAccountsListByChain.tsx | 1 + src/components/SenderDropdownItem.tsx | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/components/SenderAccountsListByChain.tsx b/src/components/SenderAccountsListByChain.tsx index d0ef6660..7dceb61a 100644 --- a/src/components/SenderAccountsListByChain.tsx +++ b/src/components/SenderAccountsListByChain.tsx @@ -67,6 +67,7 @@ export default function SenderAccountsListByChain({ chain, showCompanion, showEm address={option.account.address} balance={option.account.balance.formattedBalance} companionBalance={option.companionAccount.balance.formattedBalance} + companionAddress={option.companionAccount.address} showCompanion={showCompanion} /> ); diff --git a/src/components/SenderDropdownItem.tsx b/src/components/SenderDropdownItem.tsx index cd64b7a9..89cb77fa 100644 --- a/src/components/SenderDropdownItem.tsx +++ b/src/components/SenderDropdownItem.tsx @@ -27,6 +27,7 @@ interface Props { companionBalance: string; address: string; showCompanion: boolean; + companionAddress: string; } const useStyles = makeStyles((theme) => ({ @@ -66,13 +67,26 @@ const useStyles = makeStyles((theme) => ({ address: { marginLeft: theme.spacing(0.5) }, - addressContainer: { maxWidth: theme.spacing(30) } + addressContainer: { + maxWidth: theme.spacing(30) + }, + tooltip: { + maxWidth: 350 + } })); -const SenderDropdownItem = ({ name, address, balance, companionBalance, showCompanion }: Props) => { +const SenderDropdownItem = ({ name, address, balance, companionBalance, showCompanion, companionAddress }: Props) => { const classes = useStyles(); const [hoover, setHoover] = useState(false); const { isBridged } = useGUIContext(); + + const companionTitle = ` Companion: ${companionAddress}`; + let title = `Native: ${address}`; + + if (isBridged) { + title = title.concat(companionTitle); + } + return (
- +