Skip to content

Commit

Permalink
Add storybook, remove CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed May 26, 2023
1 parent 1d3d464 commit 767d879
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ exports[`Account Menu Render Content should not render keyring label if keyring
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand All @@ -126,7 +126,7 @@ exports[`Account Menu Render Content should not render keyring label if keyring
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down Expand Up @@ -210,7 +210,7 @@ exports[`Account Menu Render Content should not render keyring label if keyring
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand All @@ -235,7 +235,7 @@ exports[`Account Menu Render Content should not render keyring label if keyring
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ exports[`ConfirmGasDisplay should match snapshot 1`] = `
title="0"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand All @@ -84,7 +84,7 @@ exports[`ConfirmGasDisplay should match snapshot 1`] = `
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down Expand Up @@ -129,7 +129,7 @@ exports[`ConfirmGasDisplay should match snapshot 1`] = `
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports[`ConfirmLegacyGasDisplay should match snapshot 1`] = `
title="0.000021"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.000021
</span>
Expand All @@ -65,7 +65,7 @@ exports[`ConfirmLegacyGasDisplay should match snapshot 1`] = `
title="0.000021 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.000021
</span>
Expand Down Expand Up @@ -95,7 +95,7 @@ exports[`ConfirmLegacyGasDisplay should match snapshot 1`] = `
title="0.000021 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.000021
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`Confirm Detail Row Component should match snapshot 1`] = `
/>
</div>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand All @@ -42,7 +42,7 @@ exports[`Confirm Detail Row Component should match snapshot 1`] = `
/>
</div>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports[`CurrencyInput Component rendering should render properly with a fiat va
title="0.00432788 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00432788
</span>
Expand Down Expand Up @@ -129,7 +129,7 @@ exports[`CurrencyInput Component rendering should render properly with an ETH va
title="$231.06 USD"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
$231.06
</span>
Expand Down Expand Up @@ -183,7 +183,7 @@ exports[`CurrencyInput Component rendering should render properly without a suff
title="$0.00 USD"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
$0.00
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`CancelTransactionGasFee Component should render 1`] = `
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand All @@ -25,7 +25,7 @@ exports[`CancelTransactionGasFee Component should render 1`] = `
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ exports[`Multi layer fee message when balance and token price checker is enabled
title="$0.56"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
$0.56
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`UserPreferencedCurrencyDisplay Component rendering should match snapsho
title="0 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
title="0.006 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.006
</span>
Expand Down Expand Up @@ -111,7 +111,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
title="0.006 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.006
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`CurrencyDisplay Component should match default snapshot 1`] = `
title="null"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
/>
</div>
</div>
Expand All @@ -20,7 +20,7 @@ exports[`CurrencyDisplay Component should render text with a className 1`] = `
title="$123.45"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
$123.45
</span>
Expand All @@ -35,7 +35,7 @@ exports[`CurrencyDisplay Component should render text with a prefix 1`] = `
title="-$123.45"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
-
$123.45
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default function CurrencyDisplay({
<Text
as="span"
className="currency-display-component__text"
ellipsis
{...textProps}
>
{parts.prefix}
Expand Down
60 changes: 60 additions & 0 deletions ui/components/ui/currency-display/currency-display.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react';
import { decimalToHex } from '../../../../shared/modules/conversion.utils';
import CurrencyDisplay from '.';

export default {
title: 'Components/UI/CurrencyDisplay',

argTypes: {
value: {
control: {
type: 'text',
},
},
displayValue: {
control: {
type: 'text',
},
},
currency: {
control: {
type: 'text',
},
},
prefix: {
control: {
type: 'text',
},
},
suffix: {
control: {
type: 'text',
},
},
numberOfDecimals: {
control: {
type: 'text',
},
},
denomination: {
control: {
type: 'text',
},
},
},
args: {
denomination: 'ETH',
value: decimalToHex('123.45'),
numberOfDecimals: '2',
currency: 'USD',
prefix: '$',
},
};

export const DefaultStory = (args) => <CurrencyDisplay {...args} />;
DefaultStory.storyName = 'Default';

export const DisplayValueStory = (args) => (
<CurrencyDisplay {...args} displayValue="44.43" />
);
DefaultStory.storyName = 'Display Value';
9 changes: 0 additions & 9 deletions ui/components/ui/currency-display/index.scss

This file was deleted.

1 change: 0 additions & 1 deletion ui/components/ui/ui-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
/>
</div>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0
</span>
Expand Down Expand Up @@ -449,7 +449,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
title="0.00021"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00021
</span>
Expand All @@ -467,7 +467,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
title="0.00021 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00021
</span>
Expand Down Expand Up @@ -512,7 +512,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
title="0.00021 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00021
</span>
Expand Down Expand Up @@ -552,7 +552,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
title="0.00021"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00021
</span>
Expand All @@ -570,7 +570,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
title="0.00021 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00021
</span>
Expand Down Expand Up @@ -607,7 +607,7 @@ exports[`ConfirmSendEther should render correct information for for confirm send
title="0.00021 ETH"
>
<span
class="box mm-text currency-display-component__text mm-text--body-md box--flex-direction-row box--color-text-default"
class="box mm-text currency-display-component__text mm-text--body-md mm-text--ellipsis box--flex-direction-row box--color-text-default"
>
0.00021
</span>
Expand Down
Loading

0 comments on commit 767d879

Please sign in to comment.