From e2a2efa6f0476575efcfa76e7d772268545d521d Mon Sep 17 00:00:00 2001 From: dcodes05 Date: Mon, 4 Sep 2023 20:17:33 +0200 Subject: [PATCH] style: minor changes around input, output, top nav and apy cards Conflicts: libs/shared/components/tsconfig.lib.json --- .../oeth/src/components/Swap/GasPopover.tsx | 8 +++++--- libs/defi/oeth/src/components/Swap/Swap.tsx | 6 ++++++ .../oeth/src/components/Swap/SwapRoute.tsx | 1 + libs/defi/oeth/src/components/shared/APY.tsx | 10 +++++----- .../src/Cards/SwapCard/ActionButton.tsx | 2 +- .../components/src/Cards/SwapCard/Input.tsx | 20 +++++++++++-------- .../components/src/Cards/SwapCard/Output.tsx | 20 +++++++++++-------- .../src/Cards/SwapCard/SwapCard.tsx | 4 +++- libs/shared/components/src/top-nav/TopNav.tsx | 8 +++++--- libs/shared/theme/src/theme.tsx | 1 + 10 files changed, 51 insertions(+), 29 deletions(-) diff --git a/libs/defi/oeth/src/components/Swap/GasPopover.tsx b/libs/defi/oeth/src/components/Swap/GasPopover.tsx index e13902488..1037bfe81 100644 --- a/libs/defi/oeth/src/components/Swap/GasPopover.tsx +++ b/libs/defi/oeth/src/components/Swap/GasPopover.tsx @@ -17,13 +17,13 @@ import { } from '@mui/material'; import { useIntl } from 'react-intl'; -import type { Theme } from '@mui/material'; +import type { SxProps } from '@mui/material'; const defaultPriceTolerance = 0.01; const gridStyles = { display: 'grid', - gridTemplateColumns: (theme: Theme) => `1.5fr 1fr`, + gridTemplateColumns: `1.5fr 1fr`, gap: 1, justifyContent: 'space-between', alignItems: 'center', @@ -32,9 +32,10 @@ const gridStyles = { interface Props { gasPrice: number; onPriceToleranceChange: (value: number) => void; + sx?: SxProps; } -export function GasPopover({ gasPrice, onPriceToleranceChange }: Props) { +export function GasPopover({ gasPrice, onPriceToleranceChange, sx }: Props) { const theme = useTheme(); const intl = useIntl(); const [anchorEl, setAnchorEl] = useState(null); @@ -48,6 +49,7 @@ export function GasPopover({ gasPrice, onPriceToleranceChange }: Props) { setAnchorEl(e.currentTarget)} data-testid="gas-popover-button" + sx={{ ...sx }} > diff --git a/libs/defi/oeth/src/components/Swap/Swap.tsx b/libs/defi/oeth/src/components/Swap/Swap.tsx index b6321c4f8..a51e63b9e 100644 --- a/libs/defi/oeth/src/components/Swap/Swap.tsx +++ b/libs/defi/oeth/src/components/Swap/Swap.tsx @@ -12,6 +12,7 @@ import { useIntl } from 'react-intl'; import { GasPopover } from './GasPopover'; import { SwapRoute } from './SwapRoute'; +import type { Theme } from '@mui/material'; import type { Option } from '@origin/shared/components'; export function Swap() { @@ -84,6 +85,11 @@ export function Swap() { null} + // @ts-expect-error type mistmatch + sx={{ + position: 'relative', + right: (theme: Theme) => theme.spacing(-0.75), + }} /> } diff --git a/libs/defi/oeth/src/components/Swap/SwapRoute.tsx b/libs/defi/oeth/src/components/Swap/SwapRoute.tsx index 853e896b7..f799228c7 100644 --- a/libs/defi/oeth/src/components/Swap/SwapRoute.tsx +++ b/libs/defi/oeth/src/components/Swap/SwapRoute.tsx @@ -42,6 +42,7 @@ export function SwapRoute({ isLoading = false, routes }: Props) { border: '1px solid', borderColor: (theme) => theme.palette.background.default, backgroundColor: 'grey.900', + borderRadius: 1, }} title={ isLoading ? ( diff --git a/libs/defi/oeth/src/components/shared/APY.tsx b/libs/defi/oeth/src/components/shared/APY.tsx index 6d820d7f7..87bb7571a 100644 --- a/libs/defi/oeth/src/components/shared/APY.tsx +++ b/libs/defi/oeth/src/components/shared/APY.tsx @@ -58,7 +58,7 @@ export function APY({ value, balance, pendingYield, earnings }: Props) { setAnchorEl(e.currentTarget)} sx={{ backgroundColor: (theme) => @@ -145,7 +145,7 @@ export function APY({ value, balance, pendingYield, earnings }: Props) { /> theme.shadows[24], '&:hover': { diff --git a/libs/shared/components/src/Cards/SwapCard/Input.tsx b/libs/shared/components/src/Cards/SwapCard/Input.tsx index fa76884d1..48d66cceb 100644 --- a/libs/shared/components/src/Cards/SwapCard/Input.tsx +++ b/libs/shared/components/src/Cards/SwapCard/Input.tsx @@ -49,13 +49,11 @@ export function Input({ borderColor: 'divider', borderRadius: 1, borderBottomColor: 'transparent', - borderEndStartRadius: 0, - borderEndEndRadius: 0, - paddingBlock: 2.875, - boxSizing: 'border-box', + boxShadow: 'none', + paddingBlock: 2.5, + paddingBlockEnd: 2.625, '&:hover, &:focus-within': { borderColor: 'transparent', - borderRadius: 1, }, '&:hover': { background: (theme) => @@ -94,7 +92,7 @@ export function Input({ boxSizing: 'border-box', '& .MuiInputBase-input': { padding: 0, - lineHeight: '1.5rem', + lineHeight: '1.875rem', boxSizing: 'border-box', fontStyle: 'normal', fontFamily: 'Sailec, Inter, Helvetica, Arial, sans-serif', @@ -118,11 +116,12 @@ export function Input({ name={baseTokenName} icon={baseTokenIcon} {...(isSwapped ? { additionalNode: exchangeTokenNode } : {})} + sx={!baseTokenBalance ? { transform: 'translateY(50%)' } : {}} /> - + {baseTokenValue !== undefined ? ( isLoading ? ( @@ -130,7 +129,11 @@ export function Input({ {intl.formatNumber(baseTokenValue, currencyFormat)} @@ -144,6 +147,7 @@ export function Input({ fontWeight: 400, fontStyle: 'normal', visibility: baseTokenBalance === undefined ? 'hidden' : 'visible', + lineHeight: '1.5rem', }} > {intl.formatMessage( diff --git a/libs/shared/components/src/Cards/SwapCard/Output.tsx b/libs/shared/components/src/Cards/SwapCard/Output.tsx index 4ea929158..cca386040 100644 --- a/libs/shared/components/src/Cards/SwapCard/Output.tsx +++ b/libs/shared/components/src/Cards/SwapCard/Output.tsx @@ -34,14 +34,15 @@ export function Output({ sx={{ border: '1px solid', borderColor: 'divider', - borderTop: 0, + borderTopColor: 'transparent', borderRadius: 1, borderStartStartRadius: 0, borderStartEndRadius: 0, backgroundColor: (theme) => alpha(theme.palette.grey[400], 0.2), ...cardStyles, - paddingBlock: 3.0625, - boxSizing: 'border-box', + paddingBlock: 2.5, + paddingBlockEnd: 2.625, + boxShadow: 'none', }} > @@ -56,7 +57,7 @@ export function Output({ fontFamily: 'Sailec, Inter, Helvetica, Arial, sans-serif', flex: 1, alignSelf: 'end', - lineHeight: '1.5rem', + lineHeight: '1.875rem', color: (theme) => exchangeTokenQuantity === 0 ? theme.palette.text.secondary @@ -71,16 +72,19 @@ export function Output({ name={exchangeTokenName} icon={exchangeTokenIcon} {...(!isSwapped ? { additionalNode: exchangeTokenNode } : {})} - sx={{ justifySelf: 'end' }} + sx={{ + justifySelf: 'end', + ...(!exchangeTokenBalance ? { transform: 'translateY(50%)' } : {}), + }} /> - + {exchangeTokenValue !== undefined ? ( isLoading ? ( ) : ( - + {intl.formatNumber(exchangeTokenValue, currencyFormat)} ) @@ -95,7 +99,7 @@ export function Output({ }} variant="body1" color="grey.200" - lineHeight="1.3129rem" + lineHeight="1.5rem" > {intl.formatMessage( { defaultMessage: 'Balance: {number}' }, diff --git a/libs/shared/components/src/Cards/SwapCard/SwapCard.tsx b/libs/shared/components/src/Cards/SwapCard/SwapCard.tsx index 13e3ff0c9..51b564e3d 100644 --- a/libs/shared/components/src/Cards/SwapCard/SwapCard.tsx +++ b/libs/shared/components/src/Cards/SwapCard/SwapCard.tsx @@ -62,8 +62,10 @@ export function SwapCard({ theme.palette.background.paper, position: 'relative', width: 'calc(100% + 1.5rem)', bottom: '-3.75rem', diff --git a/libs/shared/theme/src/theme.tsx b/libs/shared/theme/src/theme.tsx index bee6c36e3..716432800 100644 --- a/libs/shared/theme/src/theme.tsx +++ b/libs/shared/theme/src/theme.tsx @@ -65,6 +65,7 @@ export const theme = extendTheme({ fontSize: '0.75rem', fontWeight: 400, lineHeight: '1.25rem', + fontStyle: 'normal', }, }, shape: {