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

Part of #18714: Replacing deprecated constants with enums (#19516)

* replacing deprecated constants with enums

* Removing redundant properties
This commit is contained in:
Dhruv 2023-06-21 03:44:45 +05:30 committed by GitHub
parent 84135f5d4c
commit ab0374d48a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 39 deletions

View File

@ -6,8 +6,8 @@ import { EditGasModes } from '../../../../../shared/constants/gas';
import Box from '../../../ui/box'; import Box from '../../../ui/box';
import CheckBox from '../../../ui/check-box'; import CheckBox from '../../../ui/check-box';
import { import {
DISPLAY, Display,
FLEX_DIRECTION, FlexDirection,
TextColor, TextColor,
TextVariant, TextVariant,
} from '../../../../helpers/constants/design-system'; } from '../../../../helpers/constants/design-system';
@ -72,8 +72,8 @@ const AdvancedGasFeeDefaults = () => {
return ( return (
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
flexDirection={FLEX_DIRECTION.ROW} flexDirection={FlexDirection.Row}
marginTop={4} marginTop={4}
marginLeft={2} marginLeft={2}
marginRight={2} marginRight={2}
@ -90,7 +90,6 @@ const AdvancedGasFeeDefaults = () => {
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
color={TextColor.textAlternative} color={TextColor.textAlternative}
margin={0}
> >
{isDefaultSettingsSelected {isDefaultSettingsSelected
? t('advancedGasFeeDefaultOptOut') ? t('advancedGasFeeDefaultOptOut')

View File

@ -12,7 +12,7 @@ import Popover from '../../../ui/popover';
import { import {
FontWeight, FontWeight,
TextVariant, TextVariant,
DISPLAY, Display,
Size, Size,
BorderStyle, BorderStyle,
BorderColor, BorderColor,
@ -65,17 +65,16 @@ export default function ContractDetailsModal({
fontWeight={FontWeight.Bold} fontWeight={FontWeight.Bold}
variant={TextVariant.bodyMd} variant={TextVariant.bodyMd}
as="h5" as="h5"
display={DISPLAY.FLEX} display={Display.Flex}
boxProps={{ marginTop: 0, marginBottom: 0 }}
> >
{t('contractTitle')} {t('contractTitle')}
</Text> </Text>
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
display={DISPLAY.FLEX} display={Display.Flex}
color={TextColor.textAlternative} color={TextColor.textAlternative}
boxProps={{ marginTop: 2, marginBottom: 0 }} marginTop={2}
> >
{t('contractDescription')} {t('contractDescription')}
</Text> </Text>
@ -84,14 +83,14 @@ export default function ContractDetailsModal({
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
display={DISPLAY.FLEX} display={Display.Flex}
marginTop={4} marginTop={4}
marginBottom={2} marginBottom={2}
> >
{nft ? t('contractNFT') : t('contractToken')} {nft ? t('contractNFT') : t('contractToken')}
</Text> </Text>
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
borderRadius={Size.SM} borderRadius={Size.SM}
borderStyle={BorderStyle.solid} borderStyle={BorderStyle.solid}
borderColor={BorderColor.borderDefault} borderColor={BorderColor.borderDefault}
@ -124,9 +123,8 @@ export default function ContractDetailsModal({
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
display={DISPLAY.FLEX} display={Display.Flex}
color={TextColor.textAlternative} color={TextColor.textAlternative}
marginTop={0}
marginBottom={4} marginBottom={4}
> >
{ellipsify(tokenAddress)} {ellipsify(tokenAddress)}
@ -148,7 +146,7 @@ export default function ContractDetailsModal({
} }
> >
<ButtonIcon <ButtonIcon
display={DISPLAY.FLEX} display={Display.Flex}
iconName={ iconName={
copiedTokenAddress ? IconName.CopySuccess : IconName.Copy copiedTokenAddress ? IconName.CopySuccess : IconName.Copy
} }
@ -163,7 +161,7 @@ export default function ContractDetailsModal({
</Tooltip> </Tooltip>
<Tooltip position="top" title={t('openInBlockExplorer')}> <Tooltip position="top" title={t('openInBlockExplorer')}>
<ButtonIcon <ButtonIcon
display={DISPLAY.FLEX} display={Display.Flex}
iconName={IconName.Export} iconName={IconName.Export}
color={Color.iconMuted} color={Color.iconMuted}
onClick={() => { onClick={() => {
@ -189,7 +187,7 @@ export default function ContractDetailsModal({
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
display={DISPLAY.FLEX} display={Display.Flex}
marginTop={4} marginTop={4}
marginBottom={2} marginBottom={2}
> >
@ -200,7 +198,7 @@ export default function ContractDetailsModal({
t('contractRequestingSpendingCap')} t('contractRequestingSpendingCap')}
</Text> </Text>
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
borderRadius={Size.SM} borderRadius={Size.SM}
borderStyle={BorderStyle.solid} borderStyle={BorderStyle.solid}
borderColor={BorderColor.borderDefault} borderColor={BorderColor.borderDefault}
@ -224,9 +222,8 @@ export default function ContractDetailsModal({
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
display={DISPLAY.FLEX} display={Display.Flex}
color={TextColor.textAlternative} color={TextColor.textAlternative}
marginTop={0}
marginBottom={4} marginBottom={4}
> >
{ellipsify(toAddress)} {ellipsify(toAddress)}
@ -246,7 +243,7 @@ export default function ContractDetailsModal({
} }
> >
<ButtonIcon <ButtonIcon
display={DISPLAY.FLEX} display={Display.Flex}
iconName={ iconName={
copiedToAddress ? IconName.CopySuccess : IconName.Copy copiedToAddress ? IconName.CopySuccess : IconName.Copy
} }
@ -261,7 +258,7 @@ export default function ContractDetailsModal({
</Tooltip> </Tooltip>
<Tooltip position="top" title={t('openInBlockExplorer')}> <Tooltip position="top" title={t('openInBlockExplorer')}>
<ButtonIcon <ButtonIcon
display={DISPLAY.FLEX} display={Display.Flex}
iconName={IconName.Export} iconName={IconName.Export}
color={Color.iconMuted} color={Color.iconMuted}
onClick={() => { onClick={() => {
@ -284,7 +281,7 @@ export default function ContractDetailsModal({
</Box> </Box>
</Box> </Box>
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
paddingTop={6} paddingTop={6}
paddingRight={4} paddingRight={4}
paddingBottom={6} paddingBottom={6}

View File

@ -3,8 +3,8 @@ import PropTypes from 'prop-types';
import IconWithFallback from '../../ui/icon-with-fallback'; import IconWithFallback from '../../ui/icon-with-fallback';
import Identicon from '../../ui/identicon'; import Identicon from '../../ui/identicon';
import { import {
DISPLAY, Display,
FLEX_DIRECTION, FlexDirection,
TextVariant, TextVariant,
FontWeight, FontWeight,
AlignItems, AlignItems,
@ -33,22 +33,22 @@ export default function NetworkAccountBalanceHeader({
return ( return (
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
flexDirection={FLEX_DIRECTION.ROW} flexDirection={FlexDirection.Row}
padding={4} padding={4}
className="network-account-balance-header" className="network-account-balance-header"
alignItems={AlignItems.center} alignItems={AlignItems.center}
justifyContent={JustifyContent.spaceBetween} justifyContent={JustifyContent.spaceBetween}
> >
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
flexDirection={FLEX_DIRECTION.ROW} flexDirection={FlexDirection.Row}
alignItems={AlignItems.center} alignItems={AlignItems.center}
gap={2} gap={2}
> >
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
flexDirection={FLEX_DIRECTION.ROW} flexDirection={FlexDirection.Row}
alignItems={AlignItems.center} alignItems={AlignItems.center}
> >
<Identicon address={accountAddress} diameter={32} /> <Identicon address={accountAddress} diameter={32} />
@ -60,15 +60,14 @@ export default function NetworkAccountBalanceHeader({
/> />
</Box> </Box>
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
alignItems={AlignItems.flexStart} alignItems={AlignItems.flexStart}
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
> >
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
color={TextColor.textAlternative} color={TextColor.textAlternative}
marginBottom={0}
> >
{networkName} {networkName}
</Text> </Text>
@ -78,22 +77,20 @@ export default function NetworkAccountBalanceHeader({
as="h6" as="h6"
color={TextColor.textDefault} color={TextColor.textDefault}
fontWeight={FontWeight.Bold} fontWeight={FontWeight.Bold}
marginTop={0}
> >
{accountName} {accountName}
</Text> </Text>
</Box> </Box>
</Box> </Box>
<Box <Box
display={DISPLAY.FLEX} display={Display.Flex}
alignItems={AlignItems.flexEnd} alignItems={AlignItems.flexEnd}
flexDirection={FLEX_DIRECTION.COLUMN} flexDirection={FlexDirection.Column}
> >
<Text <Text
variant={TextVariant.bodySm} variant={TextVariant.bodySm}
as="h6" as="h6"
color={TextColor.textAlternative} color={TextColor.textAlternative}
marginBottom={0}
> >
{t('balance')} {t('balance')}
</Text> </Text>
@ -103,7 +100,6 @@ export default function NetworkAccountBalanceHeader({
as="h6" as="h6"
color={TextColor.textDefault} color={TextColor.textDefault}
fontWeight={FontWeight.Bold} fontWeight={FontWeight.Bold}
marginTop={0}
align={TextAlign.End} align={TextAlign.End}
> >
{accountBalance} {tokenName} {accountBalance} {tokenName}