-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1da9e86
commit 816f7e4
Showing
7 changed files
with
71 additions
and
69 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from "react" | ||
import { HStack, Text, Flex } from "@chakra-ui/react" | ||
import { Currency } from "../../types" | ||
import { formatTokenAmount } from "../../utils" | ||
import { USD } from "../../constants" | ||
|
||
type TokenBalanceProps = { | ||
currency: Currency | ||
tokenBalance: string | number | ||
usdBalance?: string | ||
desiredDecimals?: number | ||
alignItems?: "end" | "start" | ||
} | ||
|
||
export function TokenBalance({ | ||
currency, | ||
tokenBalance, | ||
usdBalance, | ||
desiredDecimals = 2, | ||
alignItems = "end", | ||
}: TokenBalanceProps) { | ||
return ( | ||
<Flex direction="column" alignItems={alignItems}> | ||
<HStack> | ||
<Text> | ||
{formatTokenAmount(tokenBalance, currency.decimals, desiredDecimals)} | ||
</Text> | ||
<Text>{currency.symbol}</Text> | ||
</HStack> | ||
{usdBalance && ( | ||
<HStack color="gray.500"> | ||
<Text>{usdBalance}</Text> | ||
<Text>{USD.symbol}</Text> | ||
</HStack> | ||
)} | ||
</Flex> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters