From 9122f4f14f516300051a057b3a1ae3fba830eb93 Mon Sep 17 00:00:00 2001 From: toniocodo Date: Sat, 30 Sep 2023 21:48:59 +0200 Subject: [PATCH] fix: swap card styles, topnav padding block --- apps/oeth/src/App.tsx | 6 +- apps/oeth/src/components/Topnav.tsx | 312 +++++++++--------- libs/oeth/swap/src/components/BestRoutes.tsx | 2 +- .../swap/src/components/SwapRouteCard.tsx | 204 ++++++------ 4 files changed, 260 insertions(+), 264 deletions(-) diff --git a/apps/oeth/src/App.tsx b/apps/oeth/src/App.tsx index e6f6fbea7..04f67ea27 100644 --- a/apps/oeth/src/App.tsx +++ b/apps/oeth/src/App.tsx @@ -11,12 +11,8 @@ export const App = () => { ({ - xs: '112px', - md: `${theme.mixins.toolbar.height}px`, - }), }} maxWidth="sm" > diff --git a/apps/oeth/src/components/Topnav.tsx b/apps/oeth/src/components/Topnav.tsx index 035e03fae..703d55a8f 100644 --- a/apps/oeth/src/components/Topnav.tsx +++ b/apps/oeth/src/components/Topnav.tsx @@ -31,177 +31,187 @@ export function Topnav(props: BoxProps) { useState(null); return ( - ({ - position: 'fixed', - top: 0, - left: 0, - width: 1, - zIndex: theme.zIndex.appBar, - backgroundColor: alpha(theme.palette.background.default, 0.6), - backdropFilter: 'blur(15px)', - height: { - xs: '112px', - md: `${theme.mixins.toolbar.height}px`, - }, - display: 'grid', - borderBottom: { - xs: 'none', - md: `1px solid ${theme.palette.background.paper}`, - }, - columnGap: { xs: 1, md: 10 }, - rowGap: { xs: 0, md: 10 }, - alignItems: 'center', - px: { - xs: 1.5, - md: 3, - }, - pt: { - xs: 1.5, - md: 0, - }, - gridTemplateColumns: { - xs: '1fr 1fr', - md: 'auto 1fr auto', - }, - })} - > + <> ({ + xs: '112px', + md: `${theme.mixins.toolbar.height}px`, + }), + }} + /> + ({ - '& img': { - maxHeight: { - xs: '1rem', - md: '1.5rem', - }, - maxWidth: { - xs: theme.typography.pxToRem(100), - sm: theme.typography.pxToRem(120), - md: theme.typography.pxToRem(180), - }, + position: 'fixed', + top: 0, + left: 0, + width: 1, + zIndex: theme.zIndex.appBar, + backgroundColor: alpha(theme.palette.background.default, 0.6), + backdropFilter: 'blur(15px)', + height: { + xs: '112px', + md: `${theme.mixins.toolbar.height}px`, }, - })} - > - Origin logo - - { - navigate(value); - }} - sx={{ - order: { - xs: 2, - md: 0, + display: 'grid', + borderBottom: { + xs: 'none', + md: `1px solid ${theme.palette.background.paper}`, }, - gridColumn: { - xs: 'span 2', - md: 'span 1', + columnGap: { xs: 1, md: 10 }, + rowGap: { xs: 0, md: 10 }, + alignItems: 'center', + px: { + xs: 1.5, + md: 3, }, - marginBlockStart: { - xs: 2, + pt: { + xs: 1.5, md: 0, }, - '& .MuiTabs-flexContainer': { - justifyContent: { - xs: 'center', - md: 'flex-start', - }, + gridTemplateColumns: { + xs: '1fr 1fr', + md: 'auto 1fr auto', }, - }} - > - {routes[0].children.map((route) => ( - - ))} - - - ({ + '& img': { + maxHeight: { + xs: '1rem', + md: '1.5rem', + }, + maxWidth: { + xs: theme.typography.pxToRem(100), + sm: theme.typography.pxToRem(120), + md: theme.typography.pxToRem(180), + }, + }, + })} + > + Origin logo + + { + navigate(value); + }} sx={{ - borderRadius: 25, - paddingX: { - md: 3, + order: { xs: 2, + md: 0, }, - paddingY: { - md: 1, - xs: 0.75, + gridColumn: { + xs: 'span 2', + md: 'span 1', }, - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - fontWeight: 500, - minHeight: { xs: 36, md: 44 }, - background: `linear-gradient(0deg, ${alpha( - theme.palette.common.white, - 0.05, - )} 0%, ${alpha(theme.palette.common.white, 0.05)} 100%), ${ - theme.palette.background.paper - };`, - '&:hover': { - background: (theme) => theme.palette.background.paper, + marginBlockStart: { + xs: 2, + md: 0, + }, + '& .MuiTabs-flexContainer': { + justifyContent: { + xs: 'center', + md: 'flex-start', + }, }, }} > - {isMd - ? intl.formatMessage({ defaultMessage: 'IPFS' }) - : intl.formatMessage({ defaultMessage: 'View on IPFS' })} - - { - if (isConnected) { - setAccountModalAnchor(e.currentTarget); - } + {routes[0].children.map((route) => ( + + ))} + + + theme.palette.background.paper, + }, + }} + > + {isMd + ? intl.formatMessage({ defaultMessage: 'IPFS' }) + : intl.formatMessage({ defaultMessage: 'View on IPFS' })} + + { + if (isConnected) { + setAccountModalAnchor(e.currentTarget); + } + }} + sx={{ + borderRadius: 25, + paddingX: { + md: 3, + xs: 2, + }, + paddingY: { + md: 1, + xs: 0.75, + }, + minWidth: 36, + maxWidth: { xs: isConnected ? 36 : 160, sm: 160, lg: 220 }, + fontWeight: 500, + minHeight: { xs: 36, md: 44 }, + }} + /> + + + theme.palette.background.paper, + position: 'relative', + width: 'calc(100% + 1.5rem)', + bottom: '-3rem', + left: '-0.75rem', }} /> - - theme.palette.background.paper, - position: 'relative', - width: 'calc(100% + 1.5rem)', - bottom: '-3rem', - left: '-0.75rem', - }} - /> - + ); } diff --git a/libs/oeth/swap/src/components/BestRoutes.tsx b/libs/oeth/swap/src/components/BestRoutes.tsx index 9ca8a76d3..8de1bc56e 100644 --- a/libs/oeth/swap/src/components/BestRoutes.tsx +++ b/libs/oeth/swap/src/components/BestRoutes.tsx @@ -17,7 +17,7 @@ export function BestRoutes(props: Grid2Props) { return ( {swapRoutes.slice(0, 2).map((route, index) => ( - + `1px solid ${theme.palette.grey[800]}`, - borderRadius: 1, + border: `1px solid transparent`, + position: 'relative', height: 1, ...(isSelected ? { @@ -100,110 +91,109 @@ export function SwapRouteCard({ ...rest?.sx, }} role="button" - onClick={() => onSelect(route)} + onClick={() => { + onSelect(route); + }} > - - + {isBest && ( + theme.shape.borderRadius, + background: (theme) => theme.palette.background.gradient1, + fontSize: 12, + top: 0, + right: 0, + px: 1, + pt: 0.25, + }} + > + {intl.formatMessage({ defaultMessage: 'Best' })} + + )} + + + + {isLoading ? ( + + ) : ( + + )} + + + {isLoading ? ( - + ) : ( - + formatAmount(route.estimatedAmount, route.tokenOut.decimals) )} - - - + + + + + {isLoading ? ( + + ) : ( + `(${intl.formatNumber(convertedAmount, currencyFormat)})` + )} + + + + + + {isLoading ? ( + + ) : ( + intl.formatMessage(routeActionLabel[route.action]) + )} + + + + + {intl.formatMessage({ defaultMessage: 'Rate:' })} + + {isLoading ? ( - + ) : ( - formatAmount(route.estimatedAmount, route.tokenOut.decimals) + `1:${intl.formatNumber(route.rate, quantityFormat)}` )} - - - - {isLoading ? ( + + + + {intl.formatMessage({ defaultMessage: 'Gas:' })} + + + {isGasLoading ? ( ) : ( - `(${intl.formatNumber(convertedAmount, currencyFormat)})` + `~${intl.formatNumber(gasPrice, currencyFormat)}` )} - - - {isBest && ( - theme.shape.borderRadius, - background: (theme) => theme.palette.background.gradient1, - fontSize: 12, - top: (theme) => theme.spacing(-3), - right: (theme) => theme.spacing(-1.25), - px: 1, - pt: 0.25, - }} - > - {intl.formatMessage({ defaultMessage: 'Best' })} - - )} - - } - > - - - {isLoading ? ( - - ) : ( - intl.formatMessage(routeActionLabel[route.action]) - )} - - - - - {intl.formatMessage({ defaultMessage: 'Rate:' })} - - - {isLoading ? ( - - ) : ( - `1:${intl.formatNumber(route.rate, quantityFormat)}` - )} - - - - - {intl.formatMessage({ defaultMessage: 'Gas:' })} - - - {isGasLoading ? ( - - ) : ( - `~${intl.formatNumber(gasPrice, currencyFormat)}` - )} - + +