import React, { useContext } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { Icon, IconName, IconSize, } from '../../../components/component-library'; import { IconColor } from '../../../helpers/constants/design-system'; import UrlIcon from '../../../components/ui/url-icon'; import { I18nContext } from '../../../contexts/i18n'; export default function SelectedToken({ onClick, onClose, selectedToken, testId, }) { const t = useContext(I18nContext); const hasIcon = selectedToken?.iconUrl && selectedToken?.symbol; const onKeyUp = (e) => { if (e.key === 'Escape') { onClose(); } else if (e.key === 'Enter') { onClick(e); } }; return (
{hasIcon && ( )}
{selectedToken?.symbol || t('swapSelectAToken')}
); } SelectedToken.propTypes = { onClick: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, selectedToken: PropTypes.object.isRequired, testId: PropTypes.string, };