From c54212916b204d2566583aaf4d73cb18da06bec7 Mon Sep 17 00:00:00 2001 From: Jase Balderrama <4392888+jase-b@users.noreply.github.com> Date: Mon, 28 Aug 2023 12:12:28 -0700 Subject: [PATCH] 20488: Declare as deprecated (#20579) * Add @deprecated JSDoc to * Add deprecated banner to stories * Fix linting error Co-authored-by: George Marshall * Import 'Severity' via existing import statement * Add propTypes for wrapper --------- Co-authored-by: George Marshall --- ui/components/ui/chip/chip.js | 9 +++ ui/components/ui/chip/chip.stories.js | 96 ++++++++++++++++++--------- 2 files changed, 73 insertions(+), 32 deletions(-) diff --git a/ui/components/ui/chip/chip.js b/ui/components/ui/chip/chip.js index 3fbfaf5dd..cdd961dbb 100644 --- a/ui/components/ui/chip/chip.js +++ b/ui/components/ui/chip/chip.js @@ -11,6 +11,15 @@ import { TypographyVariant, } from '../../../helpers/constants/design-system'; +/** + * @deprecated The `` component has been deprecated in favor of the new `` component from the component-library. + * Please update your code to use the new `` component instead, which can be found at ui/components/component-library/tag/tag.tsx. + * You can find documentation for the new `Tag` component in the MetaMask Storybook: + * {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-tag--docs} + * If you would like to help with the replacement of the old `Chip` component, please submit a pull request against this GitHub issue: + * {@link https://github.com/MetaMask/metamask-extension/issues/20487} + */ + export default function Chip({ dataTestId, className, diff --git a/ui/components/ui/chip/chip.stories.js b/ui/components/ui/chip/chip.stories.js index 29d1d6b9d..e77b34e1a 100644 --- a/ui/components/ui/chip/chip.stories.js +++ b/ui/components/ui/chip/chip.stories.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import PropTypes from 'prop-types'; import { TypographyVariant, @@ -7,8 +8,10 @@ import { BorderColor, BackgroundColor, TextColor, + Severity, } from '../../../helpers/constants/design-system'; +import { BannerAlert } from '../../component-library'; import ApproveIcon from '../icon/approve-icon.component'; import InfoIcon from '../icon/info-icon.component'; import Identicon from '../identicon/identicon.component'; @@ -90,7 +93,27 @@ export default { }, }; -export const DefaultStory = (args) => ; +const Deprecated = ({ children }) => ( + <> + + {children} + +); + +Deprecated.propTypes = { + children: PropTypes.node, +}; + +export const DefaultStory = (args) => ( + + + +); DefaultStory.storyName = 'Default'; @@ -105,47 +128,56 @@ DefaultStory.args = { }; export const WithLeftIcon = () => ( - } - /> + + } + /> + ); export const WithRightIcon = () => ( - - } - /> + + + } + /> + ); export const WithBothIcons = () => ( - } - leftIcon={ - - } - /> + + } + leftIcon={ + + } + /> + ); + export const WithInput = (args) => { const [inputValue, setInputValue] = useState('Chip with input'); return ( - + + + ); };