Skip to content

Commit

Permalink
Part of #17670: Replace Typography with Text component in: callout.js (
Browse files Browse the repository at this point in the history
…#18912)

* Part of #17670: Replace Typography with Text component in: callout.js

* Update ui/components/ui/callout/callout.js

Co-authored-by: Danica Shen <[email protected]>

* Update callout.js

* Updating snapshot and deprecating component

* Updating snapshot and deprecating component

---------

Co-authored-by: Danica Shen <[email protected]>
Co-authored-by: George Marshall <[email protected]>
Co-authored-by: Garrett Bear <[email protected]>
  • Loading branch information
4 people authored Jun 27, 2023
1 parent deabc3e commit ec4c405
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
20 changes: 14 additions & 6 deletions ui/components/ui/callout/callout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import InfoIconInverted from '../icon/info-icon-inverted.component';
import { SEVERITIES, Color } from '../../../helpers/constants/design-system';
import { Severity, TextColor } from '../../../helpers/constants/design-system';
import { MILLISECOND } from '../../../../shared/constants/time';
import Typography from '../typography';
import { ButtonIcon, IconName, IconSize } from '../../component-library';
import { ButtonIcon, IconName, IconSize, Text } from '../../component-library';

/**
* @deprecated `<Callout />` has been deprecated in favor of the `<BannerAlert />`
* component in ./ui/components/component-library/banner-alert/banner-alert.js.
* See storybook documentation for BannerAlert here:
* {@see {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-banneralert--default-story#banneralert}}
*
* Help to replace `Callout` with `BannerAlert` by submitting a PR
*/

export default function Callout({
severity,
Expand Down Expand Up @@ -38,9 +46,9 @@ export default function Callout({
return (
<div className={calloutClassName}>
<InfoIconInverted severity={severity} />
<Typography color={Color.textDefault} className="callout__content">
<Text color={TextColor.textDefault} className="callout__content">
{children}
</Typography>
</Text>
{dismiss && (
<ButtonIcon
iconName={IconName.Close}
Expand All @@ -61,7 +69,7 @@ export default function Callout({
}

Callout.propTypes = {
severity: PropTypes.oneOf(Object.values(SEVERITIES)).isRequired,
severity: PropTypes.oneOf(Object.values(Severity)).isRequired,
children: PropTypes.node.isRequired,
dismiss: PropTypes.func,
isFirst: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ exports[`add-ethereum-chain confirmation should match snapshot 2`] = `
/>
</svg>
<p
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography callout__content typography--p typography--weight-normal typography--style-normal typography--color-text-default"
class="box mm-text callout__content mm-text--body-md box--flex-direction-row box--color-text-default"
>
<span>
This custom network is not recognized
Expand Down Expand Up @@ -438,7 +438,7 @@ exports[`add-ethereum-chain confirmation should match snapshot 2`] = `
/>
</svg>
<p
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography callout__content typography--p typography--weight-normal typography--style-normal typography--color-text-default"
class="box mm-text callout__content mm-text--body-md box--flex-direction-row box--color-text-default"
>
<span>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ exports[`switch-ethereum-chain confirmation should show alert if there are pendi
/>
</svg>
<p
class="box box--margin-top-1 box--margin-bottom-1 box--flex-direction-row typography callout__content typography--p typography--weight-normal typography--style-normal typography--color-text-default"
class="box mm-text callout__content mm-text--body-md box--flex-direction-row box--color-text-default"
>
<span>
Switching networks will cancel all pending confirmations
Expand Down

0 comments on commit ec4c405

Please sign in to comment.