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

Deprecating ErrorMessage in favor of BannerAlert (#20461)

This commit is contained in:
George Marshall 2023-08-18 13:27:10 -07:00 committed by GitHub
parent 9cfa9ba6b0
commit dc6069a3ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 29 deletions

View File

@ -1,15 +0,0 @@
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import ErrorMessage from '.';
# Error Message
This component highlights error messages
<Canvas>
<Story id="components-ui-errormessage--default-story" />
</Canvas>
## Props
<ArgsTable of={ErrorMessage} />

View File

@ -4,13 +4,14 @@ import { Icon, IconName, IconSize } from '../../component-library';
import { IconColor } from '../../../helpers/constants/design-system';
/**
* @deprecated - Please use ActionableMessage type danger
* @see ActionableMessage
* @param {object} props
* @param {string} props.errorMessage
* @param {string} props.errorKey
* @param {object} context
* @deprecated The `<ErrorMessage />` component has been deprecated in favor of the new `<BannerAlert>` component from the component-library.
* Please update your code to use the new `<BannerAlert>` component instead, which can be found at ui/components/component-library/banner-alert/banner-alert.js.
* You can find documentation for the new BannerAlert component in the MetaMask Storybook:
* {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-banneralert--docs}
* If you would like to help with the replacement of the old ErrorMessage component, please submit a pull request against this GitHub issue:
* {@link https://github.com/MetaMask/metamask-extension/issues/20394}
*/
const ErrorMessage = (props, context) => {
const { errorMessage, errorKey } = props;
const error = errorKey ? context.t(errorKey) : errorMessage;

View File

@ -1,16 +1,9 @@
import React from 'react';
import README from './README.mdx';
import ErrorMessage from '.';
export default {
title: 'Components/UI/ErrorMessage',
title: 'Components/UI/ErrorMessage(deprecated)',
component: ErrorMessage,
parameters: {
docs: {
page: README,
},
},
argTypes: {
errorMessage: { control: 'text' },
errorKey: { control: 'text' },