forked from MetaMask/metamask-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Storybook stories for TokenCurrencyDisplay component
- Loading branch information
1 parent
f89985b
commit 821617c
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
ui/components/ui/token-currency-display/token-currency-display.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import TokenCurrencyDisplay from './token-currency-display.component'; | ||
import CurrencyDisplay from '../currency-display'; | ||
import { useTokenDisplayValue } from '../../../hooks/useTokenDisplayValue'; | ||
|
||
const meta: Meta<typeof TokenCurrencyDisplay> = { | ||
title: 'Components/TokenCurrencyDisplay', | ||
component: TokenCurrencyDisplay, | ||
argTypes: { | ||
className: { control: 'text' }, | ||
transactionData: { control: 'text' }, | ||
token: { control: 'object' }, | ||
prefix: { control: 'text' }, | ||
}, | ||
args: { | ||
className: '', | ||
transactionData: '0x123', | ||
token: { symbol: 'ETH' }, | ||
prefix: '', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof TokenCurrencyDisplay>; | ||
|
||
// Default story using provided props | ||
export const DefaultStory: Story = { | ||
render: (args) => <TokenCurrencyDisplay {...args} />, | ||
}; | ||
|
||
DefaultStory.storyName = 'Default'; | ||
|
||
// Story with a custom prefix to test the display of different currency symbols or text before the amount | ||
export const WithPrefix: Story = { | ||
args: { | ||
prefix: 'Ξ', | ||
}, | ||
render: (args) => <TokenCurrencyDisplay {...args} />, | ||
}; | ||
|
||
// Story with a custom class name to test CSS integration | ||
export const CustomClassName: Story = { | ||
args: { | ||
className: 'custom-class', | ||
}, | ||
render: (args) => <TokenCurrencyDisplay {...args} />, | ||
}; | ||
|
||
// Story with different tokens to test if the component correctly handles various token types | ||
export const CustomToken: Story = { | ||
args: { | ||
token: { symbol: 'DAI' }, | ||
}, | ||
render: (args) => <TokenCurrencyDisplay {...args} />, | ||
}; | ||
|
||
// Story with transaction data to test how the component handles and displays transaction-related information | ||
export const WithTransactionData: Story = { | ||
args: { | ||
transactionData: '0x456', | ||
}, | ||
render: (args) => <TokenCurrencyDisplay {...args} />, | ||
}; |