-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
40 changed files
with
121 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ReactElement, Suspense, useEffect, useState } from 'react'; | ||
|
||
type CurrencyIconProps = { | ||
currency: string; | ||
isVirtual: boolean; | ||
}; | ||
|
||
const CurrencyIcon = ({ currency, isVirtual }: CurrencyIconProps) => { | ||
const [currencyIconComponent, setCurrencyIconComponent] = useState<ReactElement | null>(null); | ||
|
||
useEffect(() => { | ||
const currencyName = currency.charAt(0).toUpperCase() + currency.slice(1).toLowerCase(); | ||
const currencyIconName = isVirtual ? 'CurrencyDemoIcon' : `Currency${currencyName}Icon`; | ||
const getIconComponent = async () => { | ||
const module = await import('@deriv/quill-icons'); | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const IconComponent = (module as any)[currencyIconName]; | ||
|
||
setCurrencyIconComponent(<IconComponent iconSize='sm' />); | ||
}; | ||
|
||
getIconComponent(); | ||
}, []); | ||
|
||
return <Suspense fallback={<div />}>{currencyIconComponent}</Suspense>; | ||
}; | ||
|
||
export default CurrencyIcon; |
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 @@ | ||
export { default as CurrencyIcon } from './CurrencyIcon'; |
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
Oops, something went wrong.