Skip to content

Commit

Permalink
💄 headers: update align in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
franm91 committed Mar 26, 2024
1 parent b06f989 commit c462a19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 8 additions & 5 deletions components/asset/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Address, formatEther, formatUnits } from 'viem';
import useStETHNativeAPR from 'hooks/useStETHNativeAPR';
import { toPercentage } from 'utils/utils';
import { track } from 'utils/mixpanel';
import { Typography } from '@mui/material';
import { Typography, useMediaQuery, useTheme } from '@mui/material';
import getSymbolDescription from 'utils/getSymbolDescription';
import useContractAddress from 'hooks/useContractAddress';
import { useWeb3 } from 'hooks/useWeb3';
Expand All @@ -42,6 +42,8 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {
} = useWeb3();

const nativeAPR = useStETHNativeAPR();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));

const assetDescription = useCallback(
(s: string) => {
Expand Down Expand Up @@ -103,7 +105,7 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {
formatUnits(floatingDeposits + fixedDeposits - (floatingBorrows + fixedBorrows), decimals),
)}`
: undefined,
sx: { textAlign: 'center' },
...(!isMobile && { sx: { textAlign: 'center' } }),
},
{
label: t('Global Utilization'),
Expand All @@ -128,12 +130,13 @@ const AssetHeaderInfo: FC<Props> = ({ symbol }) => {
return { itemsInfo: items, totalUtilization: totalUti };
}, [
marketAccount,
t,
backupBorrows,
floatingBorrows,
floatingDeposits,
fixedDeposits,
floatingBorrows,
t,
fixedBorrows,
backupBorrows,
isMobile,
symbol,
nativeAPR,
]);
Expand Down
5 changes: 4 additions & 1 deletion components/markets/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import { ItemInfoProps } from 'components/common/ItemInfo';
import formatNumber from 'utils/formatNumber';
import useAccountData from 'hooks/useAccountData';
import { toPercentage } from 'utils/utils';
import { useMediaQuery, useTheme } from '@mui/material';

const MarketsHeader: FC = () => {
const { t } = useTranslation();
const { accountData } = useAccountData();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));

const { totalDeposited, totalBorrowed, totalAvailable } = useMemo<{
totalDeposited?: bigint;
Expand Down Expand Up @@ -75,7 +78,7 @@ const MarketsHeader: FC = () => {
{
label: t('Available for Withdrawal'),
value: totalAvailable ? `$${formatNumber(formatUnits(totalAvailable, 18))}` : undefined,
sx: { textAlign: 'center' },
...(!isMobile && { sx: { textAlign: 'center' } }),
},
{
label: t('Global Utilization'),
Expand Down

0 comments on commit c462a19

Please sign in to comment.