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,30 +99,25 @@ export default function SecureYourWallet() {
stage={threeStepStages.RECOVERY_PHRASE_VIDEO} stage={threeStepStages.RECOVERY_PHRASE_VIDEO}
marginBottom={4} marginBottom={4}
/> />
<Box
justifyContent={JustifyContent.center}
textAlign={TextAlign.Center}
marginBottom={4}
>
<Text <Text
variant={TextVariant.headingLg} variant={TextVariant.headingLg}
as="h2" as="h2"
fontWeight={FontWeight.Bold} marginBottom={4}
textAlign={TextAlign.Center}
> >
{t('seedPhraseIntroTitle')} {t('seedPhraseIntroTitle')}
</Text> </Text>
</Box>
<Box justifyContent={JustifyContent.center} marginBottom={6}>
<Text <Text
variant={TextVariant.headingSm} variant={TextVariant.bodyLgMedium}
as="h4" marginBottom={6}
className="secure-your-wallet__details" className="secure-your-wallet__details"
> >
{t('seedPhraseIntroTitleCopy')} {t('seedPhraseIntroTitleCopy')}
</Text> </Text>
</Box> <Box
<Box> as="video"
<video borderRadius={BorderRadius.LG}
marginBottom={8}
className="secure-your-wallet__video" className="secure-your-wallet__video"
onPlay={() => { onPlay={() => {
trackEvent({ trackEvent({
@ -132,80 +143,63 @@ export default function SecureYourWallet() {
/> />
); );
})} })}
</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
as="p"
variant={TextVariant.headingSm}
fontWeight={FontWeight.Bold}
boxProps={{ display: DISPLAY.BLOCK }}
>
{t('seedPhraseIntroSidebarTitleOne')} {t('seedPhraseIntroSidebarTitleOne')}
</Text> </Text>
<Text as="p" variant={TextVariant.headingSm}> <Text marginBottom={4}>{t('seedPhraseIntroSidebarCopyOne')}</Text>
{t('seedPhraseIntroSidebarCopyOne')} <Text as="h3" variant={TextVariant.headingSm}>
</Text>
</Box>
<Box marginBottom={4}>
<Text
as="p"
variant={TextVariant.headingSm}
fontWeight={FontWeight.Bold}
boxProps={{ display: DISPLAY.BLOCK }}
>
{t('seedPhraseIntroSidebarTitleTwo')} {t('seedPhraseIntroSidebarTitleTwo')}
</Text> </Text>
<ul className="secure-your-wallet__list"> <Box as="ul" className="secure-your-wallet__list" marginBottom={4}>
<li>{t('seedPhraseIntroSidebarBulletOne')}</li> <Text as="li">{t('seedPhraseIntroSidebarBulletOne')}</Text>
<li>{t('seedPhraseIntroSidebarBulletThree')}</li> <Text as="li">{t('seedPhraseIntroSidebarBulletThree')}</Text>
<li>{t('seedPhraseIntroSidebarBulletFour')}</li> <Text as="li">{t('seedPhraseIntroSidebarBulletFour')}</Text>
</ul>
</Box> </Box>
<Box marginBottom={6}> <Text as="h3" variant={TextVariant.headingSm}>
<Text
as="p"
variant={TextVariant.headingSm}
fontWeight={FontWeight.Bold}
boxProps={{ display: DISPLAY.BLOCK }}
>
{t('seedPhraseIntroSidebarTitleThree')} {t('seedPhraseIntroSidebarTitleThree')}
</Text> </Text>
<Text as="p" variant={TextVariant.headingSm}> <Text as="p" marginBottom={4}>
{t('seedPhraseIntroSidebarCopyTwo')} {t('seedPhraseIntroSidebarCopyTwo')}
</Text> </Text>
</Box> <Text
<Box className="secure-your-wallet__highlighted" marginBottom={2}> as="h3"
<Text as="p" variant={TextVariant.headingSm}> variant={TextVariant.headingSm}
backgroundColor={BackgroundColor.primaryMuted}
padding={4}
borderRadius={BorderRadius.LG}
>
{t('seedPhraseIntroSidebarCopyThree')} {t('seedPhraseIntroSidebarCopyThree')}
</Text> </Text>
</Box> </Box>
</Box> </Box>
</div>
); );
} }