@lifi/widget
Version:
LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.
17 lines • 1.31 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Box, Tooltip, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { formatTokenAmount } from '../utils/format.js';
export const FeeBreakdownTooltip = ({ gasCosts, feeCosts, gasless, children, }) => {
const { t } = useTranslation();
return (_jsx(Tooltip, { title: _jsxs(Box, { children: [gasless ? _jsx(Box, { children: t('tooltip.gasless') }) : null, gasCosts?.length && !gasless ? (_jsxs(Box, { children: [t('main.fees.network'), getFeeBreakdownTypography(gasCosts, t)] })) : null, feeCosts?.length && !gasless ? (_jsxs(Box, { sx: {
mt: 0.5,
}, children: [t('main.fees.provider'), getFeeBreakdownTypography(feeCosts, t)] })) : null] }), sx: { cursor: 'help' }, children: children }));
};
const getFeeBreakdownTypography = (fees, t) => fees.map((fee, index) => (_jsxs(Typography, { color: "inherit", sx: {
fontSize: 12,
fontWeight: '500',
}, children: [t('format.currency', { value: fee.amountUSD }), " (", t('format.tokenAmount', {
value: formatTokenAmount(fee.amount, fee.token.decimals),
}), ' ', fee.token.symbol, ")"] }, `${fee.token.address}${index}`)));
//# sourceMappingURL=FeeBreakdownTooltip.js.map