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

Fix #18916 - UX: Multichain: Network picker design updates (#18962)

* Remove border radius from network menu list

* Provide background color for test network avatars

* Make button size large

* Update ui/components/multichain/network-list-item/network-list-item.js

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>

* Fix lint

---------

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
This commit is contained in:
David Walsh 2023-05-08 09:50:04 -05:00 committed by GitHub
parent 4ad281c806
commit 90630edef7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import {
JustifyContent,
TextColor,
BLOCK_SIZES,
BackgroundColor,
} from '../../../helpers/constants/design-system';
import {
AvatarNetwork,
@ -20,9 +21,27 @@ import {
} from '../../component-library';
import { useI18nContext } from '../../../hooks/useI18nContext';
import Tooltip from '../../ui/tooltip/tooltip';
import {
GOERLI_DISPLAY_NAME,
LINEA_TESTNET_DISPLAY_NAME,
SEPOLIA_DISPLAY_NAME,
} from '../../../../shared/constants/network';
const MAXIMUM_CHARACTERS_WITHOUT_TOOLTIP = 17;
function getAvatarNetworkColor(name) {
switch (name) {
case GOERLI_DISPLAY_NAME:
return BackgroundColor.goerli;
case LINEA_TESTNET_DISPLAY_NAME:
return BackgroundColor.lineaTestnet;
case SEPOLIA_DISPLAY_NAME:
return BackgroundColor.sepolia;
default:
return undefined;
}
}
export const NetworkListItem = ({
name,
iconSrc,
@ -60,7 +79,11 @@ export const NetworkListItem = ({
backgroundColor={Color.primaryDefault}
/>
)}
<AvatarNetwork name={name} src={iconSrc} />
<AvatarNetwork
backgroundColor={getAvatarNetworkColor(name)}
name={name}
src={iconSrc}
/>
<Box className="multichain-network-list-item__network-name">
<ButtonLink
onClick={(e) => {

View File

@ -1,4 +1,9 @@
.multichain-network-list-menu {
max-height: 200px;
overflow: auto;
/* Overrides the popover's default behavior */
&-content-wrapper {
border-radius: 0;
}
}

View File

@ -26,7 +26,11 @@ import {
DISPLAY,
JustifyContent,
} from '../../../helpers/constants/design-system';
import { Button, BUTTON_VARIANT, Text } from '../../component-library';
import {
BUTTON_SECONDARY_SIZES,
ButtonSecondary,
Text,
} from '../../component-library';
import { ADD_POPULAR_CUSTOM_NETWORK } from '../../../helpers/constants/routes';
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
@ -64,7 +68,12 @@ export const NetworkListMenu = ({ onClose }) => {
}, [showTestNetworks, showTestNetworksRef]);
return (
<Popover onClose={onClose} centerTitle title={t('networkMenuHeading')}>
<Popover
contentClassName="multichain-network-list-menu-content-wrapper"
onClose={onClose}
centerTitle
title={t('networkMenuHeading')}
>
<>
<Box className="multichain-network-list-menu" ref={networkListRef}>
{networks.map((network) => {
@ -158,8 +167,8 @@ export const NetworkListMenu = ({ onClose }) => {
/>
</Box>
<Box padding={4}>
<Button
variant={BUTTON_VARIANT.SECONDARY}
<ButtonSecondary
size={BUTTON_SECONDARY_SIZES.LG}
block
onClick={() => {
isFullScreen
@ -175,7 +184,7 @@ export const NetworkListMenu = ({ onClose }) => {
}}
>
{t('addNetwork')}
</Button>
</ButtonSecondary>
</Box>
</>
</Popover>