Skip to content

Commit

Permalink
chore: PortfolioView™: Design Review Cleanup: Networks, sort, & Menu (#…
Browse files Browse the repository at this point in the history
…28663)

## **Description**

Improves various design review aspects pointed out by @amandaye0h 

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28663?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
darkwing authored Nov 22, 2024
1 parent 6eb7ccf commit 23ec947
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
Box,
ButtonBase,
ButtonBaseSize,
Icon,
IconName,
IconSize,
Popover,
PopoverPosition,
} from '../../../../component-library';
Expand Down Expand Up @@ -198,7 +200,8 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
className="asset-list-control-bar__button"
onClick={toggleTokenSortPopover}
size={ButtonBaseSize.Sm}
endIconName={IconName.SwapVertical}
startIconName={IconName.Filter}
startIconProps={{ marginInlineEnd: 0 }}
backgroundColor={
isTokenSortPopoverOpen
? BackgroundColor.backgroundPressed
Expand All @@ -221,13 +224,13 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
isOpen={isNetworkFilterPopoverOpen}
position={PopoverPosition.BottomStart}
referenceElement={popoverRef.current}
matchWidth={!isFullScreen}
matchWidth={false}
style={{
zIndex: 10,
display: 'flex',
flexDirection: 'column',
padding: 0,
minWidth: isFullScreen ? '325px' : '',
minWidth: isFullScreen ? '250px' : '',
}}
>
<NetworkFilter handleClose={closePopover} />
Expand All @@ -237,13 +240,13 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
isOpen={isTokenSortPopoverOpen}
position={PopoverPosition.BottomEnd}
referenceElement={popoverRef.current}
matchWidth={!isFullScreen}
matchWidth={false}
style={{
zIndex: 10,
display: 'flex',
flexDirection: 'column',
padding: 0,
minWidth: isFullScreen ? '325px' : '',
minWidth: isFullScreen ? '250px' : '',
}}
>
<SortControl handleClose={closePopover} />
Expand All @@ -254,19 +257,25 @@ const AssetListControlBar = ({ showTokensLinks }: AssetListControlBarProps) => {
isOpen={isImportTokensPopoverOpen}
position={PopoverPosition.BottomEnd}
referenceElement={popoverRef.current}
matchWidth={!isFullScreen}
matchWidth={false}
style={{
zIndex: 10,
display: 'flex',
flexDirection: 'column',
padding: 0,
minWidth: isFullScreen ? '325px' : '',
minWidth: isFullScreen ? '158px' : '',
}}
>
<SelectableListItem onClick={handleImport} testId="importTokens">
<Icon name={IconName.Add} size={IconSize.Sm} marginInlineEnd={2} />
{t('importTokensCamelCase')}
</SelectableListItem>
<SelectableListItem onClick={handleRefresh} testId="refreshList">
<Icon
name={IconName.Refresh}
size={IconSize.Sm}
marginInlineEnd={2}
/>
{t('refreshList')}
</SelectableListItem>
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@
min-width: auto;
border-radius: 8px;
padding: 0 8px !important;
gap: 5px;
text-transform: lowercase;

span::first-letter {
text-transform: uppercase;
}
gap: 4px;
}

&__buttons {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const AssetListControlBar = ({
disabled={!shouldShowTokensLinks}
size={ButtonBaseSize.Sm}
startIconName={IconName.MoreVertical}
startIconProps={{ marginInlineEnd: 0 }}
backgroundColor={BackgroundColor.backgroundDefault}
color={TextColor.textDefault}
onClick={onClick}
Expand Down
27 changes: 0 additions & 27 deletions ui/components/app/assets/asset-list/network-filter/index.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { SelectableListItem } from '../sort-control/sort-control';
import { Text } from '../../../../component-library/text/text';
import {
AlignItems,
BlockSize,
Display,
JustifyContent,
TextColor,
Expand Down Expand Up @@ -108,6 +109,7 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => {
<Box
display={Display.Flex}
justifyContent={JustifyContent.spaceBetween}
width={BlockSize.Full}
>
<Box>
<Text
Expand All @@ -121,8 +123,6 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => {
color={TextColor.textAlternative}
data-testid="network-filter-all__total"
>
{/* TODO: Should query cross chain account balance */}

<UserPreferencedCurrencyDisplay
value={selectedAccountBalanceForAllNetworks}
type="PRIMARY"
Expand Down Expand Up @@ -170,6 +170,7 @@ const NetworkFilter = ({ handleClose }: SortControlProps) => {
display={Display.Flex}
justifyContent={JustifyContent.spaceBetween}
alignItems={AlignItems.center}
width={BlockSize.Full}
>
<Box>
<Text
Expand Down
7 changes: 6 additions & 1 deletion ui/components/app/assets/asset-list/sort-control/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.selectable-list-item {
cursor: pointer;
padding: 12px 16px;
padding: 16px;

&--selected {
background: var(--color-primary-muted);
Expand All @@ -24,4 +24,9 @@
top: 4px;
left: 4px;
}

.currency-display-component__text,
.currency-display-component__suffix {
color: var(--color-text-alternative);
}
}
16 changes: 13 additions & 3 deletions ui/components/app/assets/asset-list/sort-control/sort-control.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import React, { ReactNode, useContext } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import classnames from 'classnames';
import { Box } from '../../../../component-library';
import { Box, Text } from '../../../../component-library';
import { SortOrder, SortingCallbacksT } from '../../util/sort';
import {
AlignItems,
BackgroundColor,
BlockSize,
BorderRadius,
Display,
TextVariant,
} from '../../../../../helpers/constants/design-system';
import { setTokenSortConfig } from '../../../../../store/actions';
import { MetaMetricsContext } from '../../../../../contexts/metametrics';
Expand Down Expand Up @@ -36,15 +40,21 @@ export const SelectableListItem = ({
}: SelectableListItemProps) => {
return (
<Box className="selectable-list-item-wrapper" data-testid={testId}>
<Box
<Text
data-testid={`${testId}__button`}
className={classnames('selectable-list-item', {
'selectable-list-item--selected': Boolean(isSelected),
})}
onClick={onClick}
variant={TextVariant.bodyMd}
as="button"
width={BlockSize.Full}
backgroundColor={BackgroundColor.backgroundDefault}
display={Display.Flex}
alignItems={AlignItems.center}
>
{children}
</Box>
</Text>
{isSelected && (
<Box
className="selectable-list-item__selected-indicator"
Expand Down

0 comments on commit 23ec947

Please sign in to comment.