mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Deprecating ErrorMessage in favor of BannerAlert (#20461)
This commit is contained in:
parent
9cfa9ba6b0
commit
dc6069a3ab
@ -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} />
|
|
@ -4,13 +4,14 @@ import { Icon, IconName, IconSize } from '../../component-library';
|
|||||||
import { IconColor } from '../../../helpers/constants/design-system';
|
import { IconColor } from '../../../helpers/constants/design-system';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated - Please use ActionableMessage type danger
|
* @deprecated The `<ErrorMessage />` component has been deprecated in favor of the new `<BannerAlert>` component from the component-library.
|
||||||
* @see ActionableMessage
|
* 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.
|
||||||
* @param {object} props
|
* You can find documentation for the new BannerAlert component in the MetaMask Storybook:
|
||||||
* @param {string} props.errorMessage
|
* {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-banneralert--docs}
|
||||||
* @param {string} props.errorKey
|
* If you would like to help with the replacement of the old ErrorMessage component, please submit a pull request against this GitHub issue:
|
||||||
* @param {object} context
|
* {@link https://github.com/MetaMask/metamask-extension/issues/20394}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const ErrorMessage = (props, context) => {
|
const ErrorMessage = (props, context) => {
|
||||||
const { errorMessage, errorKey } = props;
|
const { errorMessage, errorKey } = props;
|
||||||
const error = errorKey ? context.t(errorKey) : errorMessage;
|
const error = errorKey ? context.t(errorKey) : errorMessage;
|
||||||
|
@ -1,16 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import README from './README.mdx';
|
|
||||||
import ErrorMessage from '.';
|
import ErrorMessage from '.';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Components/UI/ErrorMessage',
|
title: 'Components/UI/ErrorMessage(deprecated)',
|
||||||
|
|
||||||
component: ErrorMessage,
|
component: ErrorMessage,
|
||||||
parameters: {
|
|
||||||
docs: {
|
|
||||||
page: README,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
argTypes: {
|
argTypes: {
|
||||||
errorMessage: { control: 'text' },
|
errorMessage: { control: 'text' },
|
||||||
errorKey: { control: 'text' },
|
errorKey: { control: 'text' },
|
||||||
|
Loading…
Reference in New Issue
Block a user