1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

AvatarIcon prod updates and some deprecated fixes (#20557)

* AvatarIcon prod updates and some deprecated fixes

* fix flex display

* fix iconsize on props

* fix IconSize import

* IconSize

---------

Co-authored-by: George Marshall <george.marshall@consensys.net>
This commit is contained in:
Garrett Bear 2023-09-01 07:26:29 -07:00 committed by GitHub
parent acf386c609
commit 92f04eb6e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 48 additions and 51 deletions

View File

@ -13,6 +13,7 @@ import {
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
import { import {
AvatarIcon, AvatarIcon,
AvatarIconSize,
Icon, Icon,
IconName, IconName,
IconSize, IconSize,
@ -77,7 +78,7 @@ const PermissionCell = ({
{typeof permissionIcon === 'string' ? ( {typeof permissionIcon === 'string' ? (
<AvatarIcon <AvatarIcon
iconName={permissionIcon} iconName={permissionIcon}
size={IconSize.Md} size={AvatarIconSize.Md}
iconProps={{ iconProps={{
size: IconSize.Sm, size: IconSize.Sm,
}} }}

View File

@ -16,7 +16,7 @@ import {
import { import {
AvatarIcon, AvatarIcon,
IconSize, AvatarIconSize,
Text, Text,
Box, Box,
BannerAlert, BannerAlert,
@ -35,10 +35,7 @@ const InstallError = ({ title, error, description, iconName }) => {
{iconName && ( {iconName && (
<AvatarIcon <AvatarIcon
iconName={iconName} iconName={iconName}
size={IconSize.Xl} size={AvatarIconSize.Xl}
iconProps={{
size: IconSize.Xl,
}}
color={IconColor.errorDefault} color={IconColor.errorDefault}
backgroundColor={BackgroundColor.errorMuted} backgroundColor={BackgroundColor.errorMuted}
marginBottom={4} marginBottom={4}

View File

@ -50,7 +50,6 @@ const SnapAvatar = ({
borderColor={BackgroundColor.backgroundDefault} borderColor={BackgroundColor.backgroundDefault}
borderWidth={borderWidth} borderWidth={borderWidth}
iconProps={{ iconProps={{
size: badgeSize,
color: IconColor.infoInverse, color: IconColor.infoInverse,
}} }}
/> />

View File

@ -10,12 +10,13 @@ import {
IconColor, IconColor,
TextVariant, TextVariant,
TextColor, TextColor,
Display,
} from '../../../../helpers/constants/design-system'; } from '../../../../helpers/constants/design-system';
import Box from '../../../ui/box';
import { import {
AvatarIcon, AvatarIcon,
AvatarIconSize,
Box,
IconName, IconName,
IconSize,
Text, Text,
} from '../../../component-library'; } from '../../../component-library';
import { import {
@ -42,19 +43,19 @@ export const SnapDelineator = ({
> >
<Box <Box
className="snap-delineator__header" className="snap-delineator__header"
display={Display.Flex}
alignItems={AlignItems.center} alignItems={AlignItems.center}
padding={1} padding={1}
> >
<AvatarIcon <AvatarIcon
iconName={IconName.Snaps} iconName={IconName.Snaps}
size={IconSize.Sm} size={AvatarIconSize.Sm}
backgroundColor={ backgroundColor={
isError ? IconColor.errorDefault : IconColor.infoDefault isError ? IconColor.errorDefault : IconColor.infoDefault
} }
borderColor={BackgroundColor.backgroundDefault} borderColor={BackgroundColor.backgroundDefault}
borderWidth={2} borderWidth={2}
iconProps={{ iconProps={{
size: IconSize.Sm,
color: IconColor.infoInverse, color: IconColor.infoInverse,
}} }}
/> />

View File

@ -10,14 +10,18 @@ import {
IconColor, IconColor,
TextVariant, TextVariant,
TextAlign, TextAlign,
Size,
JustifyContent, JustifyContent,
FontWeight, FontWeight,
} from '../../../../helpers/constants/design-system'; } from '../../../../helpers/constants/design-system';
import Popover from '../../../ui/popover'; import Popover from '../../../ui/popover';
import Button from '../../../ui/button'; import Button from '../../../ui/button';
import { AvatarIcon, IconName, Text } from '../../../component-library'; import {
import Box from '../../../ui/box/box'; AvatarIcon,
AvatarIconSize,
Box,
IconName,
Text,
} from '../../../component-library';
/** /**
* a very simple reducer using produce from Immer to keep checkboxes state manipulation * a very simple reducer using produce from Immer to keep checkboxes state manipulation
@ -87,7 +91,7 @@ export default function SnapInstallWarning({
iconName={IconName.Danger} iconName={IconName.Danger}
backgroundColor={BackgroundColor.warningMuted} backgroundColor={BackgroundColor.warningMuted}
color={IconColor.warningDefault} color={IconColor.warningDefault}
size={Size.XL} size={AvatarIconSize.Xl}
/> />
</Box> </Box>
<Text <Text

View File

@ -1,24 +1,24 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useI18nContext } from '../../../../hooks/useI18nContext'; import { useI18nContext } from '../../../../hooks/useI18nContext';
import Box from '../../../ui/box/box';
import Popover from '../../../ui/popover'; import Popover from '../../../ui/popover';
import { import {
AvatarIcon, AvatarIcon,
AvatarIconSize,
Box,
Button, Button,
BUTTON_SIZES, BUTTON_SIZES,
BUTTON_VARIANT, BUTTON_VARIANT,
ButtonLink, ButtonLink,
ButtonLinkSize, ButtonLinkSize,
IconName, IconName,
IconSize,
Text, Text,
} from '../../../component-library'; } from '../../../component-library';
import { import {
AlignItems, AlignItems,
BackgroundColor, BackgroundColor,
BLOCK_SIZES, BlockSize,
DISPLAY, Display,
FontWeight, FontWeight,
IconColor, IconColor,
JustifyContent, JustifyContent,
@ -43,7 +43,7 @@ export default function SnapPrivacyWarning({ onAccepted, onCanceled }) {
<Box <Box
marginTop={4} marginTop={4}
className="snap-privacy-warning__header__info-icon" className="snap-privacy-warning__header__info-icon"
display={DISPLAY.FLEX} display={Display.Flex}
justifyContent={JustifyContent.center} justifyContent={JustifyContent.center}
alignItems={AlignItems.center} alignItems={AlignItems.center}
> >
@ -51,14 +51,14 @@ export default function SnapPrivacyWarning({ onAccepted, onCanceled }) {
iconName={IconName.Info} iconName={IconName.Info}
color={IconColor.infoDefault} color={IconColor.infoDefault}
backgroundColor={BackgroundColor.primaryMuted} backgroundColor={BackgroundColor.primaryMuted}
size={IconSize.Md} size={AvatarIconSize.Md}
/> />
</Box> </Box>
<Box <Box
className="snap-privacy-warning__header__title" className="snap-privacy-warning__header__title"
marginTop={4} marginTop={4}
marginBottom={4} marginBottom={4}
display={DISPLAY.FLEX} display={Display.Flex}
justifyContent={JustifyContent.center} justifyContent={JustifyContent.center}
alignItems={AlignItems.center} alignItems={AlignItems.center}
> >
@ -119,12 +119,12 @@ export default function SnapPrivacyWarning({ onAccepted, onCanceled }) {
<Box <Box
className="snap-privacy-warning__footer" className="snap-privacy-warning__footer"
marginTop={6} marginTop={6}
display={DISPLAY.FLEX} display={Display.Flex}
> >
<Button <Button
variant={BUTTON_VARIANT.SECONDARY} variant={BUTTON_VARIANT.SECONDARY}
size={BUTTON_SIZES.LG} size={BUTTON_SIZES.LG}
width={BLOCK_SIZES.FULL} width={BlockSize.Full}
className="snap-privacy-warning__cancel-button" className="snap-privacy-warning__cancel-button"
onClick={onCanceled} onClick={onCanceled}
marginRight={2} marginRight={2}
@ -134,7 +134,7 @@ export default function SnapPrivacyWarning({ onAccepted, onCanceled }) {
<Button <Button
variant={BUTTON_VARIANT.PRIMARY} variant={BUTTON_VARIANT.PRIMARY}
size={BUTTON_SIZES.LG} size={BUTTON_SIZES.LG}
width={BLOCK_SIZES.FULL} width={BlockSize.Full}
className="snap-privacy-warning__ok-button" className="snap-privacy-warning__ok-button"
onClick={onAccepted} onClick={onAccepted}
marginLeft={2} marginLeft={2}

View File

@ -7,11 +7,10 @@ import {
TransactionStatus, TransactionStatus,
} from '../../../../shared/constants/transaction'; } from '../../../../shared/constants/transaction';
import { captureSingleException } from '../../../store/actions'; import { captureSingleException } from '../../../store/actions';
import { AvatarIcon, IconName } from '../../component-library'; import { AvatarIcon, AvatarIconSize, IconName } from '../../component-library';
import { import {
BackgroundColor, BackgroundColor,
IconColor, IconColor,
Size,
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
const ICON_MAP = { const ICON_MAP = {
@ -62,7 +61,7 @@ export default function TransactionIcon({ status, category }) {
return ( return (
<AvatarIcon <AvatarIcon
backgroundColor={BackgroundColor.backgroundAlternative} backgroundColor={BackgroundColor.backgroundAlternative}
size={Size.MD} size={AvatarIconSize.Md}
/> />
); );
} }
@ -71,7 +70,7 @@ export default function TransactionIcon({ status, category }) {
<AvatarIcon <AvatarIcon
backgroundColor={backgroundColor} backgroundColor={backgroundColor}
iconName={Icon} iconName={Icon}
size={Size.MD} size={AvatarIconSize.Md}
color={color} color={color}
/> />
); );

View File

@ -16,6 +16,7 @@ import {
import Tooltip from '../../components/ui/tooltip'; import Tooltip from '../../components/ui/tooltip';
import { import {
AvatarIcon, AvatarIcon,
AvatarIconSize,
///: BEGIN:ONLY_INCLUDE_IN(snaps) ///: BEGIN:ONLY_INCLUDE_IN(snaps)
Icon, Icon,
Text, Text,
@ -44,7 +45,7 @@ function getLeftIcon(iconName) {
return ( return (
<AvatarIcon <AvatarIcon
iconName={iconName} iconName={iconName}
size={IconSize.Sm} size={AvatarIconSize.Sm}
iconProps={{ iconProps={{
size: IconSize.Xs, size: IconSize.Xs,
}} }}

View File

@ -6,22 +6,20 @@ import { useI18nContext } from '../../../../hooks/useI18nContext';
import Box from '../../../../components/ui/box/box'; import Box from '../../../../components/ui/box/box';
import { import {
AlignItems, AlignItems,
BLOCK_SIZES, BlockSize,
BorderStyle, BorderStyle,
FLEX_DIRECTION, FlexDirection,
FONT_WEIGHT, FontWeight,
JustifyContent, JustifyContent,
TextVariant, TextVariant,
BackgroundColor, BackgroundColor,
IconColor, IconColor,
TextAlign, TextAlign,
FontWeight,
} from '../../../../helpers/constants/design-system'; } from '../../../../helpers/constants/design-system';
import { import {
AvatarIcon, AvatarIcon,
AvatarIconSize,
IconName, IconName,
IconSize,
ValidTag,
Text, Text,
} from '../../../../components/component-library'; } from '../../../../components/component-library';
import PulseLoader from '../../../../components/ui/pulse-loader/pulse-loader'; import PulseLoader from '../../../../components/ui/pulse-loader/pulse-loader';
@ -64,25 +62,22 @@ export default function SnapResult({
return ( return (
<Box <Box
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
alignItems={AlignItems.center} alignItems={AlignItems.center}
justifyContent={JustifyContent.center} justifyContent={JustifyContent.center}
height={BLOCK_SIZES.FULL} height={BlockSize.Full}
paddingTop={2} paddingTop={2}
paddingBottom={2} paddingBottom={2}
> >
<AvatarIcon <AvatarIcon
className="snap-result__header__icon" className="snap-result__header__icon"
iconName={IconName.Confirmation} iconName={IconName.Confirmation}
size={IconSize.Xl} size={AvatarIconSize.Xl}
iconProps={{
size: IconSize.Xl,
}}
color={IconColor.successDefault} color={IconColor.successDefault}
backgroundColor={BackgroundColor.successMuted} backgroundColor={BackgroundColor.successMuted}
/> />
<Text <Text
fontWeight={FONT_WEIGHT.BOLD} fontWeight={FontWeight.Bold}
variant={TextVariant.headingLg} variant={TextVariant.headingLg}
paddingBottom={2} paddingBottom={2}
marginTop={4} marginTop={4}
@ -91,7 +86,7 @@ export default function SnapResult({
</Text> </Text>
<Text textAlign={TextAlign.Center}> <Text textAlign={TextAlign.Center}>
{t('snapResultSuccessDescription', [ {t('snapResultSuccessDescription', [
<Text as={ValidTag.Span} key="1" fontWeight={FontWeight.Medium}> <Text as="span" key="1" fontWeight={FontWeight.Medium}>
{snapNameToRender} {snapNameToRender}
</Text>, </Text>,
])} ])}
@ -108,7 +103,7 @@ export default function SnapResult({
case 'wallet_installSnap': case 'wallet_installSnap':
failedScreenTitle = t('snapInstallationErrorTitle'); failedScreenTitle = t('snapInstallationErrorTitle');
failedScreenDescription = t('snapInstallationErrorDescription', [ failedScreenDescription = t('snapInstallationErrorDescription', [
<Text as={ValidTag.Span} key="1" fontWeight={FontWeight.Medium}> <Text as="span" key="1" fontWeight={FontWeight.Medium}>
{snapNameToRender} {snapNameToRender}
</Text>, </Text>,
]); ]);
@ -116,7 +111,7 @@ export default function SnapResult({
case 'wallet_updateSnap': case 'wallet_updateSnap':
failedScreenTitle = t('snapUpdateErrorTitle'); failedScreenTitle = t('snapUpdateErrorTitle');
failedScreenDescription = t('snapUpdateErrorDescription', [ failedScreenDescription = t('snapUpdateErrorDescription', [
<Text as={ValidTag.Span} key="1" fontWeight={FontWeight.Medium}> <Text as="span" key="1" fontWeight={FontWeight.Medium}>
{snapNameToRender} {snapNameToRender}
</Text>, </Text>,
]); ]);
@ -139,9 +134,9 @@ export default function SnapResult({
<Box <Box
className="page-container snap-result" className="page-container snap-result"
justifyContent={JustifyContent.spaceBetween} justifyContent={JustifyContent.spaceBetween}
height={BLOCK_SIZES.FULL} height={BlockSize.Full}
borderStyle={BorderStyle.none} borderStyle={BorderStyle.none}
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
> >
<SnapAuthorshipHeader snapId={targetSubjectMetadata.origin} /> <SnapAuthorshipHeader snapId={targetSubjectMetadata.origin} />
<Box <Box
@ -149,7 +144,7 @@ export default function SnapResult({
paddingLeft={4} paddingLeft={4}
paddingRight={4} paddingRight={4}
alignItems={AlignItems.center} alignItems={AlignItems.center}
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
style={{ style={{
overflowY: 'auto', overflowY: 'auto',
}} }}
@ -157,7 +152,7 @@ export default function SnapResult({
{isLoading && ( {isLoading && (
<Box <Box
className="snap-result__content__loader-container" className="snap-result__content__loader-container"
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
alignItems={AlignItems.center} alignItems={AlignItems.center}
justifyContent={JustifyContent.center} justifyContent={JustifyContent.center}
> >
@ -172,7 +167,7 @@ export default function SnapResult({
<Box <Box
className="snap-result__footer" className="snap-result__footer"
alignItems={AlignItems.center} alignItems={AlignItems.center}
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
style={{ style={{
boxShadow: 'var(--shadow-size-lg) var(--color-shadow-default)', boxShadow: 'var(--shadow-size-lg) var(--color-shadow-default)',
}} }}