-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a new formatDenomWithBadge that returns a ReactNode (#252)
- Loading branch information
Showing
6 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
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
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,23 @@ | ||
/** | ||
* A collection of functions to format data, returning react nodes. | ||
* This file is intended as a TSX addendum to `./format.ts`. | ||
*/ | ||
import { ReactNode } from 'react'; | ||
import { DenomVerifiedBadge } from '@/components'; | ||
import { formatDenom } from '@/utils/format'; | ||
|
||
/** | ||
* Format a denom to a display name react node with a verified badge. | ||
* @param denom The denom to format. | ||
* @param small Whether to use a smaller badge. | ||
*/ | ||
export function formatDenomWithBadge(denom: string, small?: boolean): ReactNode { | ||
const cleanDenom = formatDenom(denom); | ||
const classes = `${small ? 'w-3' : 'w-5'} inline relative bottom-1 text-primary`; | ||
|
||
return ( | ||
<> | ||
{cleanDenom} <DenomVerifiedBadge base={denom} className={classes} /> | ||
</> | ||
); | ||
} |
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