mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 21:57:06 +01:00
e37e570b2e
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
import { useSelector } from 'react-redux';
|
|
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
|
|
import { getSelectedIdentity } from '../../../selectors';
|
|
import { AddressCopyButton } from '../../multichain';
|
|
import Box from '../../ui/box/box';
|
|
|
|
const WalletOverview = ({
|
|
balance,
|
|
buttons,
|
|
className,
|
|
showAddress = false,
|
|
}) => {
|
|
const selectedIdentity = useSelector(getSelectedIdentity);
|
|
const checksummedAddress = toChecksumHexAddress(selectedIdentity?.address);
|
|
return (
|
|
<div className={classnames('wallet-overview', className)}>
|
|
<div className="wallet-overview__balance">
|
|
{showAddress ? (
|
|
<Box marginTop={2}>
|
|
<AddressCopyButton address={checksummedAddress} shorten />
|
|
</Box>
|
|
) : null}
|
|
{balance}
|
|
</div>
|
|
<div className="wallet-overview__buttons">{buttons}</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
WalletOverview.propTypes = {
|
|
balance: PropTypes.element.isRequired,
|
|
buttons: PropTypes.element.isRequired,
|
|
className: PropTypes.string,
|
|
showAddress: PropTypes.bool,
|
|
};
|
|
|
|
export default WalletOverview;
|