You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
4 years ago
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import Identicon from '../../ui/identicon';
|
||
|
import AccountMismatchWarning from '../../ui/account-mismatch-warning/account-mismatch-warning.component';
|
||
4 years ago
|
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
|
||
4 years ago
|
|
||
4 years ago
|
export default function AccountListItem({
|
||
4 years ago
|
account,
|
||
|
className,
|
||
|
displayAddress = false,
|
||
|
handleClick,
|
||
|
icon = null,
|
||
|
}) {
|
||
4 years ago
|
const { name, address, balance } = account || {};
|
||
4 years ago
|
|
||
|
return (
|
||
|
<div
|
||
|
className={`account-list-item ${className}`}
|
||
4 years ago
|
onClick={() => handleClick?.({ name, address, balance })}
|
||
4 years ago
|
>
|
||
|
<div className="account-list-item__top-row">
|
||
|
<Identicon
|
||
|
address={address}
|
||
|
className="account-list-item__identicon"
|
||
|
diameter={18}
|
||
|
/>
|
||
|
|
||
4 years ago
|
<div className="account-list-item__account-name">{name || address}</div>
|
||
4 years ago
|
|
||
4 years ago
|
{icon && <div className="account-list-item__icon">{icon}</div>}
|
||
4 years ago
|
|
||
|
<AccountMismatchWarning address={address} />
|
||
|
</div>
|
||
|
|
||
|
{displayAddress && name && (
|
||
|
<div className="account-list-item__account-address">
|
||
4 years ago
|
{toChecksumHexAddress(address)}
|
||
4 years ago
|
</div>
|
||
|
)}
|
||
|
</div>
|
||
4 years ago
|
);
|
||
4 years ago
|
}
|
||
|
|
||
|
AccountListItem.propTypes = {
|
||
|
account: PropTypes.object,
|
||
|
className: PropTypes.string,
|
||
|
displayAddress: PropTypes.bool,
|
||
|
handleClick: PropTypes.func,
|
||
|
icon: PropTypes.node,
|
||
4 years ago
|
};
|