1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 19:10:22 +01:00

deprecating NetworkDisplay in favour of PickerNetwork (#20619)

This commit is contained in:
Dhruv 2023-08-29 04:36:56 +05:30 committed by GitHub
parent a455b6ddc1
commit b6ad074b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 8 deletions

View File

@ -22,6 +22,15 @@ import { Icon, IconName, IconSize } from '../../component-library';
import { getProviderConfig } from '../../../ducks/metamask/metamask';
import { getNetworkLabelKey } from '../../../helpers/utils/i18n-helper';
/**
* @deprecated The `<NetworkDisplay />` component has been deprecated in favor of the new `<PickerNetwork>` component from the component-library.
* Please update your code to use the new `<PickerNetwork>` component instead, which can be found at ui/components/component-library/picker-network/picker-network.tsx.
* You can find documentation for the new `PickerNetwork` component in the MetaMask Storybook:
* {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-pickernetwork--docs}
* If you would like to help with the replacement of the old `NetworkDisplay` component, please submit a pull request against this GitHub issue:
* {@link https://github.com/MetaMask/metamask-extension/issues/20485}
*/
export default function NetworkDisplay({
indicatorSize,
disabled,

View File

@ -4,8 +4,9 @@ import {
BUILT_IN_NETWORKS,
NETWORK_TYPES,
} from '../../../../shared/constants/network';
import { Size } from '../../../helpers/constants/design-system';
import { Severity, Size } from '../../../helpers/constants/design-system';
import { BannerAlert } from '../../component-library/banner-alert';
import NetworkDisplay from '.';
export default {
@ -38,13 +39,26 @@ export default {
};
export const DefaultStory = (args) => (
<NetworkDisplay
{...args}
targetNetwork={{
type: args.targetNetwork,
nickname: args.targetNetwork,
}}
/>
<>
<BannerAlert
severity={Severity.Warning}
title="Deprecated"
description="The <NetworkDisplay> component has been deprecated in favor of the new <PickerNetwork> component from the component-library.
Please update your code to use the new <PickerNetwork> component instead, which can be found at ui/components/component-library/picker-network/picker-network.tsx."
actionButtonLabel="See details"
actionButtonProps={{
href: 'https://github.com/MetaMask/metamask-extension/issues/20485',
}}
marginBottom={4}
/>
<NetworkDisplay
{...args}
targetNetwork={{
type: args.targetNetwork,
nickname: args.targetNetwork,
}}
/>
</>
);
DefaultStory.storyName = 'Default';