Asset-icons
Package exports Raw svg files for asset logos, React components and React-native components
Installation
yarn add @exodus/asset-icons
Usage
React-Native(-web)
import assetIcons from '@exodus/asset-icons'
const BitcoinIcon = assetIcons.bitcoin
const MyComponent = () => <BitcoinIcon width="50" height="50" />
Web
- Setup bundler to handle imports from SVG
In this example webpack file-loader is used:
import assetIcons from '@exodus/asset-icons/dist/asset-icons.web'
import transparentAssetIcons from '@exodus/asset-icons/dist/asset-icons-transparent.web'
const BitcoinIcon = assetIcons.bitcoin
const BitcoinIconTransparent = transparentAssetIcons.bitcoin
const MyComponent = () => <img src={BitcoinIcon} width="50" height="50" />
const MyComponent2 = () => <img src={BitcoinIconTransparent} width="50" height="50" />
Raw svg
import bitcoinSvg from '@exodus/asset-icons/dist/svg/bitcoin.svg'
;<img src={bitcoinSvg} />
Contributing
- Install deps
yarn
- Add asset svg logo in
assets/svg
and assets/svg-transparent
folder. name should match asset.name. - import svg. if name starts with number add fix_ to import name and then use string in exporting object
- if needed adjust aliases when same icon used for another asset name
- run
yarn generate
to automatically generate JS file with imports.