bigbuffet-rw/app/soapbox/features/crypto-donate/components/detailed-crypto-address.tsx

48 lines
1.4 KiB
TypeScript
Raw Normal View History

import { QRCodeCanvas as QRCode } from 'qrcode.react';
2022-03-25 14:27:37 -07:00
import React from 'react';
2022-08-25 19:29:46 -07:00
import CopyableInput from 'soapbox/components/copyable-input';
2022-03-25 14:27:37 -07:00
import Icon from 'soapbox/components/icon';
2022-11-15 09:23:36 -08:00
import { getExplorerUrl } from '../utils/block-explorer';
import { getTitle } from '../utils/coin-db';
2022-03-25 14:27:37 -07:00
2022-11-15 09:23:36 -08:00
import CryptoIcon from './crypto-icon';
2022-03-25 14:27:37 -07:00
interface IDetailedCryptoAddress {
address: string,
ticker: string,
note?: string,
}
const DetailedCryptoAddress: React.FC<IDetailedCryptoAddress> = ({ address, ticker, note }): JSX.Element => {
const title = getTitle(ticker);
const explorerUrl = getExplorerUrl(ticker, address);
return (
<div className='crypto-address'>
<div className='crypto-address__head'>
<CryptoIcon
className='crypto-address__icon'
ticker={ticker}
title={title}
/>
<div className='crypto-address__title'>{title || ticker.toUpperCase()}</div>
<div className='crypto-address__actions'>
{explorerUrl && <a href={explorerUrl} target='_blank'>
<Icon src={require('@tabler/icons/external-link.svg')} />
2022-03-25 14:27:37 -07:00
</a>}
</div>
</div>
{note && <div className='crypto-address__note'>{note}</div>}
<div className='crypto-address__qrcode'>
<QRCode value={address} />
</div>
2022-08-25 19:29:46 -07:00
<CopyableInput value={address} />
2022-03-25 14:27:37 -07:00
</div>
);
};
export default DetailedCryptoAddress;