-
$123.45
diff --git a/ui/components/ui/currency-display/currency-display.component.js b/ui/components/ui/currency-display/currency-display.component.js
index 73f32a2eb7fa..26a80b45dd67 100644
--- a/ui/components/ui/currency-display/currency-display.component.js
+++ b/ui/components/ui/currency-display/currency-display.component.js
@@ -3,6 +3,13 @@ import PropTypes from 'prop-types';
import classnames from 'classnames';
import { useCurrencyDisplay } from '../../../hooks/useCurrencyDisplay';
import { EtherDenomination } from '../../../../shared/constants/common';
+import { Text, Box } from '../../component-library';
+import {
+ AlignItems,
+ Display,
+ FlexWrap,
+ TextVariant,
+} from '../../../helpers/constants/design-system';
export default function CurrencyDisplay({
value,
@@ -18,6 +25,10 @@ export default function CurrencyDisplay({
denomination,
currency,
suffix,
+ prefixComponentWrapperProps = {},
+ textProps = {},
+ suffixProps = {},
+ ...props
}) {
const [title, parts] = useCurrencyDisplay(value, {
displayValue,
@@ -28,26 +39,50 @@ export default function CurrencyDisplay({
currency,
suffix,
});
+
return (
-
-
- {prefixComponent}
-
-
+ {prefixComponent ? (
+
+ {prefixComponent}
+
+ ) : null}
+
{parts.prefix}
{parts.value}
-
- {parts.suffix && (
-
+
+ {parts.suffix ? (
+
{parts.suffix}
-
- )}
-
+
+ ) : null}
+
);
}
@@ -68,4 +103,7 @@ CurrencyDisplay.propTypes = {
style: PropTypes.object,
suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
value: PropTypes.string,
+ prefixComponentWrapperProps: PropTypes.object,
+ textProps: PropTypes.object,
+ suffixProps: PropTypes.object,
};
diff --git a/ui/components/ui/currency-display/currency-display.stories.js b/ui/components/ui/currency-display/currency-display.stories.js
new file mode 100644
index 000000000000..4e23fca27a6a
--- /dev/null
+++ b/ui/components/ui/currency-display/currency-display.stories.js
@@ -0,0 +1,77 @@
+import React from 'react';
+import { decimalToHex } from '../../../../shared/modules/conversion.utils';
+import { EtherDenomination } from '../../../../shared/constants/common';
+import CurrencyDisplay from '.';
+
+export default {
+ title: 'Components/UI/CurrencyDisplay',
+ argTypes: {
+ className: {
+ control: 'text',
+ },
+ currency: {
+ control: 'text',
+ },
+ 'data-testid': {
+ control: 'text',
+ },
+ denomination: {
+ control: 'select',
+ options: [EtherDenomination.ETH, EtherDenomination.GWEI],
+ },
+ displayValue: {
+ control: 'text',
+ },
+ hideLabel: {
+ control: 'boolean',
+ },
+ hideTitle: {
+ control: 'boolean',
+ },
+ numberOfDecimals: {
+ control: 'number',
+ },
+ prefix: {
+ control: 'text',
+ },
+ prefixComponent: {
+ control: 'text',
+ },
+ style: {
+ control: 'object',
+ },
+ suffix: {
+ control: 'text',
+ },
+ value: {
+ control: 'text',
+ },
+ prefixComponentWrapperProps: {
+ control: 'object',
+ },
+ textProps: {
+ control: 'object',
+ },
+ suffixProps: {
+ control: 'object',
+ },
+ boxProps: {
+ control: 'object',
+ },
+ },
+ args: {
+ denomination: EtherDenomination.ETH,
+ value: decimalToHex('123.45'),
+ numberOfDecimals: '2',
+ currency: 'USD',
+ prefix: '$',
+ },
+};
+
+export const DefaultStory = (args) => ;
+DefaultStory.storyName = 'Default';
+
+export const DisplayValueStory = (args) => (
+
+);
+DefaultStory.storyName = 'Display Value';
diff --git a/ui/components/ui/currency-display/index.scss b/ui/components/ui/currency-display/index.scss
deleted file mode 100644
index 933554b0dd41..000000000000
--- a/ui/components/ui/currency-display/index.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-.currency-display-component {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
-
- &__text {
- /*rtl:ignore*/
- direction: ltr;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- &__prefix {
- padding-right: 4px;
- }
-
- &__suffix {
- padding-left: 4px;
- }
-}
diff --git a/ui/components/ui/ui-components.scss b/ui/components/ui/ui-components.scss
index 7ac0d578b272..aef0ae38ce3c 100644
--- a/ui/components/ui/ui-components.scss
+++ b/ui/components/ui/ui-components.scss
@@ -12,7 +12,6 @@
@import 'chip/chip';
@import 'color-indicator/color-indicator';
@import 'confusable/index';
-@import 'currency-display/index';
@import 'definition-list/definition-list';
@import 'dialog/dialog';
@import 'dropdown/dropdown';
diff --git a/ui/pages/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap b/ui/pages/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap
index 7a2fde6ebc7f..188a23144bd7 100644
--- a/ui/pages/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap
+++ b/ui/pages/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap
@@ -287,19 +287,20 @@ exports[`ConfirmSendEther should render correct information for for confirm send
class="box mm-text mm-text--heading-md mm-text--font-weight-normal mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
-
-
+
0
@@ -448,14 +449,11 @@ exports[`ConfirmSendEther should render correct information for for confirm send
class="gas-details-item__currency-container"
>
-
0.00021
@@ -469,19 +467,16 @@ exports[`ConfirmSendEther should render correct information for for confirm send
class="gas-details-item__currency-container"
>
-
0.00021
ETH
@@ -517,19 +512,16 @@ exports[`ConfirmSendEther should render correct information for for confirm send
class="gas-details-item__currency-container"
>
-
0.00021
ETH
@@ -560,14 +552,11 @@ exports[`ConfirmSendEther should render correct information for for confirm send
class="confirm-page-container-content__total-value"
>
-
0.00021
@@ -581,19 +570,16 @@ exports[`ConfirmSendEther should render correct information for for confirm send
class="confirm-page-container-content__total-value"
>
-
0.00021
ETH
@@ -621,19 +607,16 @@ exports[`ConfirmSendEther should render correct information for for confirm send
-
0.00021
ETH
diff --git a/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap b/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap
index a4f40b4c1d57..8231684b0929 100644
--- a/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap
+++ b/ui/pages/confirm-transaction-base/__snapshots__/confirm-transaction-base.test.js.snap
@@ -257,19 +257,20 @@ exports[`Confirm Transaction Base should match snapshot 1`] = `
class="box mm-text mm-text--heading-md mm-text--font-weight-normal mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
-
-
+
0.0001
@@ -378,14 +379,11 @@ exports[`Confirm Transaction Base should match snapshot 1`] = `
>
-
0.000021
@@ -406,14 +404,11 @@ exports[`Confirm Transaction Base should match snapshot 1`] = `
-
0.000021
@@ -443,14 +438,11 @@ exports[`Confirm Transaction Base should match snapshot 1`] = `
class="confirm-page-container-content__total-value"
>
-
0.000121
@@ -478,14 +470,11 @@ exports[`Confirm Transaction Base should match snapshot 1`] = `
-
0.000121
diff --git a/ui/pages/send/send-content/__snapshots__/send-content.component.test.js.snap b/ui/pages/send/send-content/__snapshots__/send-content.component.test.js.snap
index dbfb1ee1e24e..f90d6521e8b7 100644
--- a/ui/pages/send/send-content/__snapshots__/send-content.component.test.js.snap
+++ b/ui/pages/send/send-content/__snapshots__/send-content.component.test.js.snap
@@ -51,19 +51,16 @@ exports[`SendContent Component render should match snapshot 1`] = `
Balance:
-
0
ETH
@@ -241,19 +238,16 @@ exports[`SendContent Component render should match snapshot 1`] = `
class="gas-details-item__currency-container"
>
-
0.0000315
ETH
@@ -289,19 +283,16 @@ exports[`SendContent Component render should match snapshot 1`] = `
class="gas-details-item__currency-container"
>
-
0.0000315
ETH