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

Dark mode: user preferenced currency eth logo (#14210)

This commit is contained in:
George Marshall 2022-03-25 10:35:11 -07:00 committed by GitHub
parent c54f9b3097
commit 53da89cea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 78 additions and 9 deletions

View File

@ -1,3 +0,0 @@
<svg viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
<path d="M19.9 30L7.5 22.7 19.9 40l12.4-17.3zm.2-30L7.7 20.4l12.4 7.3 12.4-7.2z" fill="#38393a"/>
</svg>

Before

Width:  |  Height:  |  Size: 170 B

View File

@ -44,7 +44,7 @@ const ConfirmDetailRow = (props) => {
type={PRIMARY} type={PRIMARY}
value={value} value={value}
showEthLogo showEthLogo
ethLogoHeight="18" ethLogoHeight={18}
style={{ color: primaryValueTextColor }} style={{ color: primaryValueTextColor }}
hideLabel hideLabel
/> />

View File

@ -6,7 +6,7 @@ import { useUserPreferencedCurrency } from '../../../hooks/useUserPreferencedCur
export default function UserPreferencedCurrencyDisplay({ export default function UserPreferencedCurrencyDisplay({
'data-testid': dataTestId, 'data-testid': dataTestId,
ethLogoHeight = 12, ethLogoHeight = 14,
ethNumberOfDecimals, ethNumberOfDecimals,
fiatNumberOfDecimals, fiatNumberOfDecimals,
numberOfDecimals: propsNumberOfDecimals, numberOfDecimals: propsNumberOfDecimals,
@ -23,7 +23,13 @@ export default function UserPreferencedCurrencyDisplay({
return ( return (
currency === ETH && currency === ETH &&
showEthLogo && ( showEthLogo && (
<img src="./images/eth.svg" height={ethLogoHeight} alt="" /> <i
className="fab fa-ethereum"
style={{
color: 'var(--color-icon-default)',
fontSize: ethLogoHeight,
}}
/>
) )
); );
}, [currency, showEthLogo, ethLogoHeight]); }, [currency, showEthLogo, ethLogoHeight]);
@ -49,7 +55,7 @@ UserPreferencedCurrencyDisplay.propTypes = {
hideTitle: PropTypes.bool, hideTitle: PropTypes.bool,
style: PropTypes.object, style: PropTypes.object,
showEthLogo: PropTypes.bool, showEthLogo: PropTypes.bool,
ethLogoHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), ethLogoHeight: PropTypes.number,
type: PropTypes.oneOf([PRIMARY, SECONDARY]), type: PropTypes.oneOf([PRIMARY, SECONDARY]),
ethNumberOfDecimals: PropTypes.oneOfType([ ethNumberOfDecimals: PropTypes.oneOfType([
PropTypes.string, PropTypes.string,

View File

@ -0,0 +1,60 @@
import React from 'react';
import { PRIMARY, SECONDARY, ETH } from '../../../helpers/constants/common';
import UserPreferencedCurrencyDisplay from '.';
export default {
title: 'Components/App/UserPreferencedCurrencyDisplay',
id: __filename,
argTypes: {
className: {
control: 'text',
},
'data-testid': {
control: 'text',
},
prefix: {
control: 'text',
},
value: {
control: 'text',
},
numberOfDecimals: {
control: 'number',
},
hideLabel: {
control: 'boolean',
},
hideTitle: {
control: 'boolean',
},
style: {
control: 'object',
},
showEthLogo: {
control: 'boolean',
},
ethLogoHeight: {
control: 'number',
},
type: {
control: 'select',
options: [PRIMARY, SECONDARY],
},
ethNumberOfDecimals: {
control: 'number',
},
fiatNumberOfDecimals: {
control: 'number',
},
},
args: {
type: ETH,
},
};
export const DefaultStory = (args) => (
<UserPreferencedCurrencyDisplay {...args} />
);
DefaultStory.storyName = 'Default';

View File

@ -35,7 +35,9 @@ export default function CurrencyDisplay({
style={style} style={style}
title={(!hideTitle && title) || null} title={(!hideTitle && title) || null}
> >
<span className="currency-display-component__prefix">
{prefixComponent} {prefixComponent}
</span>
<span className="currency-display-component__text"> <span className="currency-display-component__text">
{parts.prefix} {parts.prefix}
{parts.value} {parts.value}

View File

@ -10,6 +10,10 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
&__prefix {
padding-right: 4px;
}
&__suffix { &__suffix {
padding-left: 4px; padding-left: 4px;
} }

View File

@ -873,7 +873,7 @@ export default class ConfirmTransactionBase extends Component {
value={hexTransactionAmount} value={hexTransactionAmount}
type={PRIMARY} type={PRIMARY}
showEthLogo showEthLogo
ethLogoHeight="28" ethLogoHeight={24}
hideLabel hideLabel
/> />
); );