1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Replacing deprecated components and fixing prop errors (#19745)

This commit is contained in:
George Marshall 2023-06-26 10:29:02 -07:00 committed by GitHub
parent 1cc78fa0b1
commit f2d039f6cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 126 additions and 148 deletions

View File

@ -215,13 +215,37 @@ export enum BorderStyle {
} }
export enum BorderRadius { export enum BorderRadius {
/**
* 2px
*/
XS = 'xs', XS = 'xs',
/**
* 4px
*/
SM = 'sm', SM = 'sm',
/**
* 6px
*/
MD = 'md', MD = 'md',
/**
* 8px
*/
LG = 'lg', LG = 'lg',
/**
* 12px
*/
XL = 'xl', XL = 'xl',
/**
* 0
*/
none = 'none', none = 'none',
/**
* 9999px
*/
pill = 'pill', pill = 'pill',
/**
* 50%
*/
full = 'full', full = 'full',
} }

View File

@ -1,50 +1,10 @@
.secure-your-wallet { .secure-your-wallet {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
&__video { &__video {
max-width: 100%; max-width: 100%;
border-radius: 8px;
}
&__actions {
flex-direction: column;
justify-content: space-between;
width: 100%;
@include screen-sm-min {
flex-direction: row;
}
button {
margin-bottom: 16px;
@include screen-sm-min {
+ button {
margin-left: 16px;
}
}
}
} }
&__list { &__list {
list-style: disc inside; list-style: disc inside;
li {
@include H4;
}
}
&__highlighted {
background-color: var(--color-primary-muted);
padding: 12px;
border-radius: 10px;
@include screen-sm-min {
margin-inline-end: 43px;
}
} }
} }

View File

@ -1,14 +1,17 @@
import React, { useState, useContext } from 'react'; import React, { useState, useContext } from 'react';
import { useHistory, useLocation } from 'react-router-dom'; import { useHistory, useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import Box from '../../../components/ui/box';
import Button from '../../../components/ui/button';
import { import {
TextAlign, TextAlign,
TextVariant, TextVariant,
JustifyContent, JustifyContent,
FontWeight, BackgroundColor,
DISPLAY, BorderRadius,
AlignItems,
FlexDirection,
Display,
BlockSize,
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
import { import {
ThreeStepProgressBar, ThreeStepProgressBar,
@ -22,7 +25,13 @@ import {
MetaMetricsEventCategory, MetaMetricsEventCategory,
MetaMetricsEventName, MetaMetricsEventName,
} from '../../../../shared/constants/metametrics'; } from '../../../../shared/constants/metametrics';
import { Text } from '../../../components/component-library'; import {
Text,
Box,
Button,
BUTTON_VARIANT,
BUTTON_SIZES,
} from '../../../components/component-library';
import SkipSRPBackup from './skip-srp-backup-popover'; import SkipSRPBackup from './skip-srp-backup-popover';
export default function SecureYourWallet() { export default function SecureYourWallet() {
@ -75,7 +84,14 @@ export default function SecureYourWallet() {
const defaultLang = subtitles[currentLocale] ? currentLocale : 'en'; const defaultLang = subtitles[currentLocale] ? currentLocale : 'en';
return ( return (
<div className="secure-your-wallet" data-testid="secure-your-wallet"> <Box
display={Display.Flex}
justifyContent={JustifyContent.center}
alignItems={AlignItems.center}
flexDirection={FlexDirection.Column}
className="secure-your-wallet"
data-testid="secure-your-wallet"
>
{showSkipSRPBackupPopover && ( {showSkipSRPBackupPopover && (
<SkipSRPBackup handleClose={() => setShowSkipSRPBackupPopover(false)} /> <SkipSRPBackup handleClose={() => setShowSkipSRPBackupPopover(false)} />
)} )}
@ -83,129 +99,107 @@ export default function SecureYourWallet() {
stage={threeStepStages.RECOVERY_PHRASE_VIDEO} stage={threeStepStages.RECOVERY_PHRASE_VIDEO}
marginBottom={4} marginBottom={4}
/> />
<Box <Text
justifyContent={JustifyContent.center} variant={TextVariant.headingLg}
textAlign={TextAlign.Center} as="h2"
marginBottom={4} marginBottom={4}
textAlign={TextAlign.Center}
> >
<Text {t('seedPhraseIntroTitle')}
variant={TextVariant.headingLg} </Text>
as="h2" <Text
fontWeight={FontWeight.Bold} variant={TextVariant.bodyLgMedium}
> marginBottom={6}
{t('seedPhraseIntroTitle')} className="secure-your-wallet__details"
</Text> >
</Box> {t('seedPhraseIntroTitleCopy')}
<Box justifyContent={JustifyContent.center} marginBottom={6}> </Text>
<Text <Box
variant={TextVariant.headingSm} as="video"
as="h4" borderRadius={BorderRadius.LG}
className="secure-your-wallet__details" marginBottom={8}
> className="secure-your-wallet__video"
{t('seedPhraseIntroTitleCopy')} onPlay={() => {
</Text> trackEvent({
</Box> category: MetaMetricsEventCategory.Onboarding,
<Box> event: MetaMetricsEventName.OnboardingWalletVideoPlay,
<video });
className="secure-your-wallet__video" }}
onPlay={() => { controls
trackEvent({ >
category: MetaMetricsEventCategory.Onboarding, <source
event: MetaMetricsEventName.OnboardingWalletVideoPlay, type="video/webm"
}); src="./images/videos/recovery-onboarding/video.webm"
}} />
controls {Object.keys(subtitles).map((key) => {
> return (
<source <track
type="video/webm" default={Boolean(key === defaultLang)}
src="./images/videos/recovery-onboarding/video.webm" srcLang={key}
/> label={subtitles[key]}
{Object.keys(subtitles).map((key) => { key={`${key}-subtitles`}
return ( kind="subtitles"
<track src={`./images/videos/recovery-onboarding/subtitles/${key}.vtt`}
default={Boolean(key === defaultLang)} />
srcLang={key} );
label={subtitles[key]} })}
key={`${key}-subtitles`}
kind="subtitles"
src={`./images/videos/recovery-onboarding/subtitles/${key}.vtt`}
/>
);
})}
</video>
</Box> </Box>
<Box <Box
margin={8}
justifyContent={JustifyContent.spaceBetween}
className="secure-your-wallet__actions" className="secure-your-wallet__actions"
marginBottom={8}
width={BlockSize.Full}
display={Display.Flex}
flexDirection={[FlexDirection.Column, FlexDirection.Row]}
justifyContent={JustifyContent.spaceBetween}
gap={4}
> >
<Button <Button
data-testid="secure-wallet-later" data-testid="secure-wallet-later"
type="secondary" variant={BUTTON_VARIANT.SECONDARY}
rounded size={BUTTON_SIZES.LG}
large block
onClick={handleClickNotRecommended} onClick={handleClickNotRecommended}
> >
{t('seedPhraseIntroNotRecommendedButtonCopy')} {t('seedPhraseIntroNotRecommendedButtonCopy')}
</Button> </Button>
<Button <Button
data-testid="secure-wallet-recommended" data-testid="secure-wallet-recommended"
type="primary" size={BUTTON_SIZES.LG}
rounded block
large
onClick={handleClickRecommended} onClick={handleClickRecommended}
> >
{t('seedPhraseIntroRecommendedButtonCopy')} {t('seedPhraseIntroRecommendedButtonCopy')}
</Button> </Button>
</Box> </Box>
<Box className="secure-your-wallet__desc"> <Box className="secure-your-wallet__desc">
<Box marginBottom={4}> <Text as="h3" variant={TextVariant.headingSm}>
<Text {t('seedPhraseIntroSidebarTitleOne')}
as="p" </Text>
variant={TextVariant.headingSm} <Text marginBottom={4}>{t('seedPhraseIntroSidebarCopyOne')}</Text>
fontWeight={FontWeight.Bold} <Text as="h3" variant={TextVariant.headingSm}>
boxProps={{ display: DISPLAY.BLOCK }} {t('seedPhraseIntroSidebarTitleTwo')}
> </Text>
{t('seedPhraseIntroSidebarTitleOne')} <Box as="ul" className="secure-your-wallet__list" marginBottom={4}>
</Text> <Text as="li">{t('seedPhraseIntroSidebarBulletOne')}</Text>
<Text as="p" variant={TextVariant.headingSm}> <Text as="li">{t('seedPhraseIntroSidebarBulletThree')}</Text>
{t('seedPhraseIntroSidebarCopyOne')} <Text as="li">{t('seedPhraseIntroSidebarBulletFour')}</Text>
</Text>
</Box>
<Box marginBottom={4}>
<Text
as="p"
variant={TextVariant.headingSm}
fontWeight={FontWeight.Bold}
boxProps={{ display: DISPLAY.BLOCK }}
>
{t('seedPhraseIntroSidebarTitleTwo')}
</Text>
<ul className="secure-your-wallet__list">
<li>{t('seedPhraseIntroSidebarBulletOne')}</li>
<li>{t('seedPhraseIntroSidebarBulletThree')}</li>
<li>{t('seedPhraseIntroSidebarBulletFour')}</li>
</ul>
</Box>
<Box marginBottom={6}>
<Text
as="p"
variant={TextVariant.headingSm}
fontWeight={FontWeight.Bold}
boxProps={{ display: DISPLAY.BLOCK }}
>
{t('seedPhraseIntroSidebarTitleThree')}
</Text>
<Text as="p" variant={TextVariant.headingSm}>
{t('seedPhraseIntroSidebarCopyTwo')}
</Text>
</Box>
<Box className="secure-your-wallet__highlighted" marginBottom={2}>
<Text as="p" variant={TextVariant.headingSm}>
{t('seedPhraseIntroSidebarCopyThree')}
</Text>
</Box> </Box>
<Text as="h3" variant={TextVariant.headingSm}>
{t('seedPhraseIntroSidebarTitleThree')}
</Text>
<Text as="p" marginBottom={4}>
{t('seedPhraseIntroSidebarCopyTwo')}
</Text>
<Text
as="h3"
variant={TextVariant.headingSm}
backgroundColor={BackgroundColor.primaryMuted}
padding={4}
borderRadius={BorderRadius.LG}
>
{t('seedPhraseIntroSidebarCopyThree')}
</Text>
</Box> </Box>
</div> </Box>
); );
} }