Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: PortfolioView™: Design Review Cleanup: Networks, sort, & Menu #28663

Merged
merged 7 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icons:

SCR-20241122-nduw

{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 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCR-20241122-nedi

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
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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCR-20241122-nehv

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this with CSS because the CurrencyDisplay component doesn't use DS, and I desperately want to avoid changing that as it's used everywhere.

}
}
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
Loading