mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Declared <IconWithFallback/> as deprecated (#20656)
* Add the deprecation JSDoc format below to the deprecated code and added deprecation notice to the icon-with-fallback.stories.js * Declared <IconWithFallback/> as deprecated
This commit is contained in:
parent
982a1b2c51
commit
8b93092e0e
@ -2,6 +2,15 @@ import React, { useState } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated The `<IconWithFallback />` component has been deprecated in favor of the new `<AvatarNetwork />` or `<AvatarFavicon />` component from the component-library.
|
||||||
|
* Please update your code to use the new `<AvatarNetwork />` or `<AvatarFavicon />` component instead, which can be found at ui/components/component-library.
|
||||||
|
* You can find documentation for the new `AvatarNetwork` or `AvatarFavicon` component in the MetaMask Storybook:
|
||||||
|
* {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-avatarnetwork--docs}
|
||||||
|
* {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-avatarfavicon--docs}
|
||||||
|
* If you would like to help with the replacement of the old `IconWithFallback` component, please submit a pull request
|
||||||
|
*/
|
||||||
|
|
||||||
const IconWithFallback = ({
|
const IconWithFallback = ({
|
||||||
name = '',
|
name = '',
|
||||||
icon = null,
|
icon = null,
|
||||||
|
@ -1,8 +1,26 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { BannerAlert } from '../../component-library';
|
||||||
|
import { Severity } from '../../../helpers/constants/design-system';
|
||||||
import README from './README.mdx';
|
import README from './README.mdx';
|
||||||
import IconWithFallback from '.';
|
import IconWithFallback from '.';
|
||||||
|
|
||||||
|
const Deprecated = ({ children }) => (
|
||||||
|
<>
|
||||||
|
<BannerAlert
|
||||||
|
severity={Severity.Warning}
|
||||||
|
title="Deprecated"
|
||||||
|
description="<IconWithFallback/> has been deprecated in favor of <AvatarNetwork/>"
|
||||||
|
marginBottom={4}
|
||||||
|
/>
|
||||||
|
{children}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
Deprecated.propTypes = {
|
||||||
|
children: PropTypes.node,
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Components/UI/IconWithFallback',
|
title: 'Components/UI/IconWithFallback',
|
||||||
|
|
||||||
@ -31,7 +49,11 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultStory = (args) => <IconWithFallback {...args} />;
|
export const DefaultStory = (args) => (
|
||||||
|
<Deprecated>
|
||||||
|
<IconWithFallback {...args} />
|
||||||
|
</Deprecated>
|
||||||
|
);
|
||||||
|
|
||||||
DefaultStory.storyName = 'Default';
|
DefaultStory.storyName = 'Default';
|
||||||
|
|
||||||
@ -41,7 +63,11 @@ DefaultStory.args = {
|
|||||||
size: 24,
|
size: 24,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Fallback = (args) => <IconWithFallback {...args} />;
|
export const Fallback = (args) => (
|
||||||
|
<Deprecated>
|
||||||
|
<IconWithFallback {...args} />
|
||||||
|
</Deprecated>
|
||||||
|
);
|
||||||
|
|
||||||
Fallback.args = {
|
Fallback.args = {
|
||||||
name: 'ast',
|
name: 'ast',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user