mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
* 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:
parent
4ad281c806
commit
90630edef7
@ -11,6 +11,7 @@ import {
|
|||||||
JustifyContent,
|
JustifyContent,
|
||||||
TextColor,
|
TextColor,
|
||||||
BLOCK_SIZES,
|
BLOCK_SIZES,
|
||||||
|
BackgroundColor,
|
||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
import {
|
import {
|
||||||
AvatarNetwork,
|
AvatarNetwork,
|
||||||
@ -20,9 +21,27 @@ import {
|
|||||||
} from '../../component-library';
|
} from '../../component-library';
|
||||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||||
import Tooltip from '../../ui/tooltip/tooltip';
|
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;
|
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 = ({
|
export const NetworkListItem = ({
|
||||||
name,
|
name,
|
||||||
iconSrc,
|
iconSrc,
|
||||||
@ -60,7 +79,11 @@ export const NetworkListItem = ({
|
|||||||
backgroundColor={Color.primaryDefault}
|
backgroundColor={Color.primaryDefault}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<AvatarNetwork name={name} src={iconSrc} />
|
<AvatarNetwork
|
||||||
|
backgroundColor={getAvatarNetworkColor(name)}
|
||||||
|
name={name}
|
||||||
|
src={iconSrc}
|
||||||
|
/>
|
||||||
<Box className="multichain-network-list-item__network-name">
|
<Box className="multichain-network-list-item__network-name">
|
||||||
<ButtonLink
|
<ButtonLink
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
.multichain-network-list-menu {
|
.multichain-network-list-menu {
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
|
/* Overrides the popover's default behavior */
|
||||||
|
&-content-wrapper {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,11 @@ import {
|
|||||||
DISPLAY,
|
DISPLAY,
|
||||||
JustifyContent,
|
JustifyContent,
|
||||||
} from '../../../helpers/constants/design-system';
|
} 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 { ADD_POPULAR_CUSTOM_NETWORK } from '../../../helpers/constants/routes';
|
||||||
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
|
||||||
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
|
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
|
||||||
@ -64,7 +68,12 @@ export const NetworkListMenu = ({ onClose }) => {
|
|||||||
}, [showTestNetworks, showTestNetworksRef]);
|
}, [showTestNetworks, showTestNetworksRef]);
|
||||||
|
|
||||||
return (
|
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}>
|
<Box className="multichain-network-list-menu" ref={networkListRef}>
|
||||||
{networks.map((network) => {
|
{networks.map((network) => {
|
||||||
@ -158,8 +167,8 @@ export const NetworkListMenu = ({ onClose }) => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box padding={4}>
|
<Box padding={4}>
|
||||||
<Button
|
<ButtonSecondary
|
||||||
variant={BUTTON_VARIANT.SECONDARY}
|
size={BUTTON_SECONDARY_SIZES.LG}
|
||||||
block
|
block
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
isFullScreen
|
isFullScreen
|
||||||
@ -175,7 +184,7 @@ export const NetworkListMenu = ({ onClose }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('addNetwork')}
|
{t('addNetwork')}
|
||||||
</Button>
|
</ButtonSecondary>
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
Loading…
Reference in New Issue
Block a user