1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

UX: Add portfolio button in overview (#19601)

This commit is contained in:
David Walsh 2023-06-15 08:17:29 -05:00 committed by GitHub
parent 436a3dff4e
commit b6f42bacf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 3 deletions

View File

@ -364,6 +364,39 @@ const EthOverview = ({ className }) => {
/> />
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
} }
{
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
<IconButton
className="eth-overview__button"
data-testid="eth-overview-portfolio"
Icon={
<Icon
name={IconName.Diagram}
color={IconColor.primaryInverse}
/>
}
label={t('portfolio')}
onClick={() => {
const url = getPortfolioUrl(
'',
'ext_portfolio_button',
metaMetricsId,
);
global.platform.openTab({ url });
trackEvent({
category: MetaMetricsEventCategory.Navigation,
event: MetaMetricsEventName.PortfolioLinkClicked,
properties: {
location: 'Home',
text: 'Portfolio',
chain_id: chainId,
token_symbol: 'ETH',
},
});
}}
/>
///: END:ONLY_INCLUDE_IN
}
</> </>
} }
className={className} className={className}

View File

@ -1,9 +1,11 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import classNames from 'classnames'; import classNames from 'classnames';
import { Text } from '../../component-library';
import { TextVariant } from '../../../helpers/constants/design-system';
import Tooltip from '../tooltip/tooltip';
const defaultRender = (inner) => inner; const defaultRender = (inner) => inner;
export default function IconButton({ export default function IconButton({
onClick, onClick,
Icon, Icon,
@ -26,7 +28,13 @@ export default function IconButton({
{renderWrapper( {renderWrapper(
<> <>
<div className="icon-button__circle">{Icon}</div> <div className="icon-button__circle">{Icon}</div>
<span>{label}</span> <Text ellipsis variant={TextVariant.bodySm}>
{label.length > 12 ? (
<Tooltip title={label}>{label}</Tooltip>
) : (
label
)}
</Text>
</>, </>,
)} )}
</button> </button>

View File

@ -4,7 +4,7 @@
align-items: center; align-items: center;
background-color: unset; background-color: unset;
text-align: center; text-align: center;
width: 73px; width: 60px;
@include H7; @include H7;