Skip to content

Commit

Permalink
feat: spacing and positionning on Swap and Redeem
Browse files Browse the repository at this point in the history
  • Loading branch information
toniocodo committed Sep 27, 2023
1 parent a167646 commit 9f490d5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libs/oeth/redeem/src/views/RedeemView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function RedeemViewWrapped() {
isConnected={isConnected}
isAmountDisabled={amountInInputDisabled}
inputProps={{ sx: tokenInputStyles }}
tokenButtonProps={{ sx: { minWidth: 0, maxWidth: 120 } }}
sx={{
paddingBlock: 2.5,
paddingBlockStart: 2.625,
Expand All @@ -124,7 +125,6 @@ function RedeemViewWrapped() {
borderColor: 'divider',
borderRadius: 1,
backgroundColor: 'grey.900',
borderBottomColor: 'transparent',
'&:hover, &:focus-within': {
borderColor: 'transparent',
},
Expand Down
25 changes: 19 additions & 6 deletions libs/oeth/swap/src/components/SwapRouteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export function SwapRouteCard({
src={tokens.mainnet.OETH.icon}
height={16}
width={16}
mr={0.5}
display="flex"
alignItems="center"
justifyContent="center"
/>
)}
</Grid2>
Expand Down Expand Up @@ -150,7 +152,8 @@ export function SwapRouteCard({
fontSize: (theme) => theme.typography.pxToRem(12),
top: (theme) => theme.spacing(-3),
right: (theme) => theme.spacing(-1.25),
paddingInline: 1,
px: 1,
pt: 0.25,
}}
>
{intl.formatMessage({ defaultMessage: 'Best' })}
Expand All @@ -168,23 +171,33 @@ export function SwapRouteCard({
)}
</Typography>
<Stack gap={0.5}>
<Stack direction="row" gap={1} justifyContent="space-between">
<Stack
direction="row"
gap={1}
alignItems="center"
justifyContent="space-between"
>
<Typography variant="body2" color="text.secondary">
{intl.formatMessage({ defaultMessage: 'Rate:' })}
</Typography>
<Typography fontWeight={500}>
<Typography variant="body2" fontWeight={500}>
{isLoading ? (
<Skeleton width={60} />
) : (
`1:${intl.formatNumber(route.rate, quantityFormat)}`
)}
</Typography>
</Stack>
<Stack direction="row" gap={1} justifyContent="space-between">
<Stack
direction="row"
gap={1}
alignItems="center"
justifyContent="space-between"
>
<Typography variant="body2" color="text.secondary">
{intl.formatMessage({ defaultMessage: 'Gas:' })}
</Typography>
<Typography fontWeight={500}>
<Typography variant="body2" fontWeight={500}>
{isGasLoading ? (
<Skeleton width={60} />
) : (
Expand Down
9 changes: 7 additions & 2 deletions libs/shared/components/src/Inputs/TokenInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type TokenInputProps = {
BigintInputProps,
'value' | 'decimals' | 'onChange' | 'isLoading' | 'isError'
>;
tokenButtonProps?: TokenButtonProps;
tokenButtonProps?: Omit<TokenButtonProps, 'token'>;
} & StackProps;

export const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
Expand All @@ -60,6 +60,7 @@ export const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
tokenPriceUsd = 0,
isPriceLoading,
inputProps,
tokenButtonProps,
...rest
},
ref,
Expand Down Expand Up @@ -90,7 +91,11 @@ export const TokenInput = forwardRef<HTMLInputElement, TokenInputProps>(
token={token}
onClick={onTokenClick}
isDisabled={isTokenClickDisabled}
sx={!isConnected ? { transform: 'translateY(50%)' } : {}}
{...tokenButtonProps}
sx={{
...(!isConnected && { transform: 'translateY(50%)' }),
...tokenButtonProps?.sx,
}}
/>
</Box>
<Box
Expand Down

0 comments on commit 9f490d5

Please sign in to comment.