diff --git a/app/soapbox/features/crypto_donate/components/crypto_icon.js b/app/soapbox/features/crypto_donate/components/crypto_icon.js deleted file mode 100644 index 950776913..000000000 --- a/app/soapbox/features/crypto_donate/components/crypto_icon.js +++ /dev/null @@ -1,34 +0,0 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; - -const getIcon = ticker => { - try { - return require(`cryptocurrency-icons/svg/color/${ticker.toLowerCase()}.svg`); - } catch { - return require('cryptocurrency-icons/svg/color/generic.svg'); - } -}; - -export default class CryptoIcon extends React.PureComponent { - - static propTypes = { - ticker: PropTypes.string.isRequired, - title: PropTypes.string, - className: PropTypes.string, - } - - render() { - const { ticker, title, className } = this.props; - - return ( -
- {title -
- ); - } - -} diff --git a/app/soapbox/features/crypto_donate/components/crypto_icon.tsx b/app/soapbox/features/crypto_donate/components/crypto_icon.tsx new file mode 100644 index 000000000..28c0535ab --- /dev/null +++ b/app/soapbox/features/crypto_donate/components/crypto_icon.tsx @@ -0,0 +1,29 @@ +import React from 'react'; + +/** Get crypto icon URL by ticker symbol, or fall back to generic icon */ +const getIcon = (ticker: string): string => { + try { + return require(`cryptocurrency-icons/svg/color/${ticker.toLowerCase()}.svg`); + } catch { + return require('cryptocurrency-icons/svg/color/generic.svg'); + } +}; + +interface ICryptoIcon { + ticker: string, + title?: string, + className?: string, +} + +const CryptoIcon: React.FC = ({ ticker, title, className }): JSX.Element => { + return ( +
+ {title +
+ ); +}; + +export default CryptoIcon;