From 1c613a455669983f871c03b42c29b337a05529cd Mon Sep 17 00:00:00 2001 From: Ayush Date: Thu, 16 Mar 2023 05:30:54 +0530 Subject: [PATCH] Part of #17670: Replace Typography with Text component (#17959) * Updated confirm-page-container-summary.component.js * Updated snap-insight.js * Updated confirmation-warning-modal.js * Updated create-new-vault.js * Fixing import errors, linting errors and adding a story * Updating storybook path * Updating snapshot --------- Co-authored-by: georgewrmarshall --- ...onfirm-page-container-summary.component.js | 13 ++-- .../confirm-page-container-summary.stories.js | 65 +++++++++++++++++++ .../flask/snap-insight.js | 18 ++--- .../confirmation-warning-modal.js | 32 ++++----- .../app/create-new-vault/create-new-vault.js | 4 +- .../confirm-transaction-base.test.js.snap | 2 +- 6 files changed, 101 insertions(+), 33 deletions(-) create mode 100644 ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.stories.js diff --git a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js index d58fe0280..90f3dc162 100644 --- a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js +++ b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js @@ -14,8 +14,8 @@ import { getIpfsGateway } from '../../../../../selectors'; import Identicon from '../../../../ui/identicon'; import InfoTooltip from '../../../../ui/info-tooltip'; import NicknamePopovers from '../../../modals/nickname-popovers'; -import Typography from '../../../../ui/typography'; -import { TypographyVariant } from '../../../../../helpers/constants/design-system'; +import { Text } from '../../../../component-library'; +import { TextVariant } from '../../../../../helpers/constants/design-system'; import { ORIGIN_METAMASK } from '../../../../../../shared/constants/app'; import SiteOrigin from '../../../../ui/site-origin'; import { getAssetImageURL } from '../../../../../helpers/utils/util'; @@ -131,17 +131,18 @@ const ConfirmPageContainerSummary = (props) => {
{renderImage()} {!hideTitle ? ( - {titleComponent || title} - + ) : null}
{hideSubtitle ? null : ( diff --git a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.stories.js b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.stories.js new file mode 100644 index 000000000..a25722088 --- /dev/null +++ b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.stories.js @@ -0,0 +1,65 @@ +import React from 'react'; +import ConfirmPageContainerSummary from '.'; + +export default { + title: + 'Components/App/ConfirmPageContainer/ConfirmPageContainerContent/ConfirmPageContainerSummary', + argTypes: { + action: { + control: 'text', + }, + title: { + control: 'text', + }, + image: { + control: 'text', + }, + titleComponent: { + control: 'text', + }, + subtitleComponent: { + control: 'text', + }, + hideSubtitle: { + control: 'boolean', + }, + className: { + control: 'text', + }, + tokenAddress: { + control: 'text', + }, + toAddress: { + control: 'text', + }, + nonce: { + control: 'text', + }, + origin: { + control: 'text', + }, + hideTitle: { + control: 'boolean', + }, + transactionType: { + control: 'text', + }, + }, + args: { + action: 'action', + title: 'title', + titleComponent: 'titleComponent', + subtitleComponent: 'subtitleComponent', + className: 'className', + tokenAddress: '0x2170ed0880ac9a755fd29b2688956bd959f933f8', + toAddress: '0x2170ed0880ac9a755fd29b2688956bd959f933f8', + nonce: 'nonce', + origin: 'origin', + hideTitle: 'hideTitle', + transactionType: 'transactionType', + }, +}; + +export const DefaultStory = (args) => ; + +DefaultStory.storyName = 'Default'; diff --git a/ui/components/app/confirm-page-container/flask/snap-insight.js b/ui/components/app/confirm-page-container/flask/snap-insight.js index 14bc84c3b..3cfafd94d 100644 --- a/ui/components/app/confirm-page-container/flask/snap-insight.js +++ b/ui/components/app/confirm-page-container/flask/snap-insight.js @@ -2,14 +2,14 @@ import React from 'react'; import PropTypes from 'prop-types'; import Preloader from '../../../ui/icon/preloader/preloader-icon.component'; -import Typography from '../../../ui/typography/typography'; +import { Text } from '../../../component-library'; import { AlignItems, FLEX_DIRECTION, JustifyContent, TEXT_ALIGN, TextColor, - TypographyVariant, + TextVariant, } from '../../../../helpers/constants/design-system'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import { useTransactionInsightSnap } from '../../../../hooks/flask/useTransactionInsightSnap'; @@ -54,12 +54,13 @@ export const SnapInsight = ({ transaction, origin, chainId, selectedSnap }) => { {data && Object.keys(data).length > 0 ? ( ) : ( - {t('snapsNoInsight')} - + )} )} @@ -87,13 +88,14 @@ export const SnapInsight = ({ transaction, origin, chainId, selectedSnap }) => { {loading && ( <> - {t('snapsInsightLoading')} - + )} diff --git a/ui/components/app/confirmation-warning-modal/confirmation-warning-modal.js b/ui/components/app/confirmation-warning-modal/confirmation-warning-modal.js index ebdbd74bc..d17c03b16 100644 --- a/ui/components/app/confirmation-warning-modal/confirmation-warning-modal.js +++ b/ui/components/app/confirmation-warning-modal/confirmation-warning-modal.js @@ -5,17 +5,16 @@ import { useI18nContext } from '../../../hooks/useI18nContext'; import Popover from '../../ui/popover'; import Box from '../../ui/box'; import Button from '../../ui/button'; -import Typography from '../../ui/typography'; import { DISPLAY, FLEX_DIRECTION, FONT_WEIGHT, JustifyContent, - TypographyVariant, + TextVariant, AlignItems, IconColor, } from '../../../helpers/constants/design-system'; -import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library'; +import { Text, Icon, ICON_NAMES, ICON_SIZES } from '../../component-library'; const ConfirmationWarningModal = ({ onSubmit, onCancel }) => { const t = useI18nContext(); @@ -61,39 +60,40 @@ const ConfirmationWarningModal = ({ onSubmit, onCancel }) => { className="confirmation-warning-modal__content__header__warning-icon" size={ICON_SIZES.XL} /> - {t('addEthereumChainWarningModalTitle')} - + - + {t('addEthereumChainWarningModalHeader', [ {t('addEthereumChainWarningModalHeaderPartTwo')} , ])} - - + + {t('addEthereumChainWarningModalListHeader')} - +
  • - + {t('addEthereumChainWarningModalListPointOne')} - +
  • - + {t('addEthereumChainWarningModalListPointTwo')} - +
  • - + {t('addEthereumChainWarningModalListPointThree')} - +
diff --git a/ui/components/app/create-new-vault/create-new-vault.js b/ui/components/app/create-new-vault/create-new-vault.js index b8ad32670..13b28eb0a 100644 --- a/ui/components/app/create-new-vault/create-new-vault.js +++ b/ui/components/app/create-new-vault/create-new-vault.js @@ -4,7 +4,7 @@ import { useI18nContext } from '../../../hooks/useI18nContext'; import TextField from '../../ui/text-field'; import Button from '../../ui/button'; import CheckBox from '../../ui/check-box'; -import Typography from '../../ui/typography'; +import { Text } from '../../component-library'; import SrpInput from '../srp-input'; import { PASSWORD_MIN_LENGTH } from '../../../helpers/constants/common'; @@ -135,7 +135,7 @@ export default function CreateNewVault({ className="create-new-vault__terms-label" htmlFor="create-new-vault__terms-checkbox" > - {termsOfUse} + {termsOfUse} ) : null} diff --git a/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap b/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap index c6dba019d..46a976a57 100644 --- a/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap +++ b/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap @@ -254,7 +254,7 @@ exports[`Confirm Transaction Base should match snapshot 1`] = ` class="confirm-page-container-summary__title" >