import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { toChecksumHexAddress } from '@metamask/controller-utils'; import { Box, Button, AvatarAccount, AvatarAccountVariant, Icon, IconName, Text, } from '../../component-library'; import { AlignItems, BackgroundColor, BorderRadius, Display, FlexDirection, FontWeight, IconColor, Size, TextAlign, TextColor, TextVariant, } from '../../../helpers/constants/design-system'; import { getUseBlockie } from '../../../selectors'; import { shortenAddress } from '../../../helpers/utils/util'; export const AccountPicker = ({ address, name, onClick, disabled, showAddress = false, }) => { const useBlockie = useSelector(getUseBlockie); const shortenedAddress = shortenAddress(toChecksumHexAddress(address)); return ( ); }; AccountPicker.propTypes = { /** * Account name */ name: PropTypes.string.isRequired, /** * Account address, used for blockie or jazzicon */ address: PropTypes.string.isRequired, /** * Action to perform when the account picker is clicked */ onClick: PropTypes.func.isRequired, /** * Represents if the AccountPicker should be actionable */ disabled: PropTypes.bool.isRequired, /** * Represents if the account address should display */ showAddress: PropTypes.bool, };