react-icons/md#MdSwapHoriz TypeScript Examples
The following examples show how to use
react-icons/md#MdSwapHoriz.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiPoolPortal.tsx From rari-dApp with GNU Affero General Public License v3.0 | 4 votes |
PoolDetailCard = ({ pool }: { pool: Pool }) => {
const { t } = useTranslation();
const { rari, isAuthed } = useRari();
const { poolType, poolName, poolLogo } = usePoolInfo(pool);
const {
isOpen: isDepositModalOpen,
onOpen: openDepositModal,
onClose: closeDepositModal,
} = useDisclosure();
const authedOpenModal = useAuthedCallback(openDepositModal);
const { data: balanceData, isLoading: isPoolBalanceLoading } =
usePoolBalance(pool);
const poolAPY = usePoolAPY(pool);
const noSlippageCurrencies = useNoSlippageCurrencies(pool);
if (isPoolBalanceLoading) {
return (
<Center
height={{
md: isAuthed ? "235px" : "110px",
base: isAuthed ? "330px" : "215px",
}}
>
<Spinner />
</Center>
);
}
const myBalance = balanceData!;
const formattedBalance = formatBalanceBN(rari, myBalance, pool === Pool.ETH);
// const rgtAPR = useRGTAPR();
return (
<>
{isDepositModalOpen ? (
<PoolTypeProvider pool={pool}>
<DepositModal
isOpen={isDepositModalOpen}
onClose={closeDepositModal}
/>
</PoolTypeProvider>
) : null}
<Column
mainAxisAlignment="flex-start"
crossAxisAlignment="center"
expand
p={4}
>
<Box width="50px" height="50px" flexShrink={0}>
<Image src={poolLogo} />
</Box>
<Row mainAxisAlignment="flex-start" crossAxisAlignment="center" mt={2}>
<Heading fontSize="xl" lineHeight="2.5rem" ml="12px">
{poolName}
</Heading>
<SimpleTooltip
label={
"Rebalances " +
(noSlippageCurrencies
? noSlippageCurrencies.join(" + ")
: " ? ") +
" between " +
getSDKPool({ rari, pool: poolType })
// Filter out empty pools
.allocations.POOLS.filter((el) => !!el)
.join(", ")
}
>
<QuestionIcon ml={2} mb="3px" boxSize="12px" />
</SimpleTooltip>
</Row>
<SimpleTooltip label={t("Your balance in this pool")}>
<Text mt={4} mb={5} fontSize="md" textAlign="center">
{isPoolBalanceLoading ? "$?" : formattedBalance}
</Text>
</SimpleTooltip>
<Text fontWeight="bold" textAlign="center">
{poolAPY ?? "?"}% APY
{/* +{" "}
<SimpleTooltip label={t("Extra returns from $RGT")}>
<span>
({rgtAPR ?? "?"}%{" "}
<Image display="inline" src={SmallLogo} boxSize="20px" />)
</span>
</SimpleTooltip> */}
</Text>
<Row
mainAxisAlignment="flex-start"
crossAxisAlignment="center"
width="100%"
mt="auto"
>
<Link
/* @ts-ignore */
as={RouterLink}
width="100%"
className="no-underline"
to={"/pools/" + pool.toString()}
>
<DashboardBox
mt={4}
width="100%"
height="45px"
borderRadius="7px"
fontSize="xl"
fontWeight="bold"
>
<Center expand>{t("Access")}</Center>
</DashboardBox>
</Link>
<DashboardBox
mt={4}
flexShrink={0}
as="button"
onClick={authedOpenModal}
height="45px"
ml={2}
width="45px"
borderRadius="7px"
fontSize="xl"
fontWeight="bold"
>
<Center expand>
<Icon as={MdSwapHoriz} boxSize="30px" />
</Center>
</DashboardBox>
</Row>
</Column>
</>
);
}
Example #2
Source File: TranchesPage.tsx From rari-dApp with GNU Affero General Public License v3.0 | 4 votes |
TrancheColumn = ({
tranchePool,
trancheRating,
}: {
tranchePool: TranchePool;
trancheRating: TrancheRating;
}) => {
const { t } = useTranslation();
const isMobile = useIsSmallScreen();
const { saffronData } = useSaffronData();
const principal = usePrincipal(tranchePool, trancheRating);
const {
isOpen: isDepositModalOpen,
onOpen: openDepositModal,
onClose: closeDepositModal,
} = useDisclosure();
const authedOpenModal = useAuthedCallback(openDepositModal);
return (
<>
<DepositModal
trancheRating={trancheRating}
tranchePool={tranchePool}
isOpen={isDepositModalOpen}
onClose={closeDepositModal}
/>
<Column
mainAxisAlignment="space-between"
crossAxisAlignment="center"
expand
ml={isMobile ? 0 : 4}
mt={isMobile ? 8 : 0}
// TODO: REMOVE STYLE ONCE AA TRANCHE IS ADDED
style={
trancheRating === TrancheRating.AA
? {
opacity: tranchePool !== "USDC" ? "0.3" : "1",
pointerEvents: "none",
}
: {}
}
>
<Column mainAxisAlignment="flex-start" crossAxisAlignment="center">
<Heading size="sm">
{trancheRating} {t("Tranche")}
</Heading>
<SimpleTooltip label={t("Your balance in this tranche")}>
<Text textAlign="center" mt={4}>
{principal ?? "?"} {tranchePool}
</Text>
</SimpleTooltip>
<Text textAlign="center" fontWeight="bold" mt={4}>
{trancheRating === "AA"
? // TODO REMOVE HARDCODED CHECK ABOUT AA TRANCHE ONCE IT'S IMPLEMENTED
"0.45%"
: saffronData
? saffronData.pools[tranchePoolIndex(tranchePool)].tranches?.[
trancheRating
]?.["total-apy"] + "% APY"
: "?% APY"}
</Text>
</Column>
<DashboardBox
onClick={authedOpenModal}
mt={4}
as="button"
height="45px"
width={isMobile ? "100%" : "85%"}
borderRadius="7px"
fontSize="xl"
fontWeight="bold"
>
<Center expand>
<Icon as={MdSwapHoriz} boxSize="30px" />
</Center>
</DashboardBox>
</Column>
</>
);
}