mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fixed Add Recipient Stories and migrated to use control args. (#13633)
This commit is contained in:
parent
93af95f968
commit
e082334da8
@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { text } from '@storybook/addon-knobs';
|
|
||||||
|
|
||||||
import configureStore from '../../../../store/store';
|
import configureStore from '../../../../store/store';
|
||||||
|
|
||||||
@ -9,31 +8,71 @@ import AddRecipient from './add-recipient.component';
|
|||||||
|
|
||||||
const store = configureStore(testData);
|
const store = configureStore(testData);
|
||||||
|
|
||||||
|
const { metamask } = store.getState();
|
||||||
|
const { addressBook } = metamask;
|
||||||
|
const recipient = metamask.accountArray[0];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Pages/Send/SendContent/AddRecipient',
|
title: 'Pages/Send/SendContent/AddRecipient',
|
||||||
id: __filename,
|
id: __filename,
|
||||||
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
|
||||||
|
argTypes: {
|
||||||
|
recipient: { type: 'text', defaultValue: recipient },
|
||||||
|
contacts: { type: 'object', defaultValue: [addressBook] },
|
||||||
|
nonContacts: { type: 'object', defaultValue: [addressBook] },
|
||||||
|
ownedAccounts: { type: 'object', defaultValue: [addressBook] },
|
||||||
|
addressBook: { type: 'object', defaultValue: [addressBook] },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DefaultStory = () => {
|
export const DefaultStory = (args) => {
|
||||||
const { metamask } = store.getState();
|
|
||||||
const { addressBook, recipient } = metamask;
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: 300 }}>
|
<div style={{ width: 300 }}>
|
||||||
<AddRecipient
|
<AddRecipient
|
||||||
contacts={[addressBook]}
|
{...args}
|
||||||
recipient={recipient}
|
|
||||||
updateRecipient={() => undefined}
|
updateRecipient={() => undefined}
|
||||||
nonContacts={[addressBook]}
|
|
||||||
ownedAccounts={[addressBook]}
|
|
||||||
addressBook={[addressBook]}
|
|
||||||
updateGas={() => undefined}
|
updateGas={() => undefined}
|
||||||
// ToError and ToWarning wording must match on translation
|
|
||||||
ensError={text('To Error', 'loading')}
|
|
||||||
ensWarning={text('To Warning', 'loading')}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultStory.storyName = 'Default';
|
DefaultStory.storyName = 'Default';
|
||||||
|
|
||||||
|
export const ErrorStory = (args) => {
|
||||||
|
return (
|
||||||
|
<div style={{ width: 300 }}>
|
||||||
|
<AddRecipient
|
||||||
|
{...args}
|
||||||
|
updateRecipient={() => undefined}
|
||||||
|
updateGas={() => undefined}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
ErrorStory.argTypes = {
|
||||||
|
// ensError must be the key for a translation
|
||||||
|
ensError: { type: 'text', defaultValue: 'loading' },
|
||||||
|
};
|
||||||
|
|
||||||
|
ErrorStory.storyName = 'Error';
|
||||||
|
|
||||||
|
export const WarningStory = (args) => {
|
||||||
|
return (
|
||||||
|
<div style={{ width: 300 }}>
|
||||||
|
<AddRecipient
|
||||||
|
{...args}
|
||||||
|
updateRecipient={() => undefined}
|
||||||
|
updateGas={() => undefined}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
WarningStory.argTypes = {
|
||||||
|
// ensWarning must be the key for a translation
|
||||||
|
ensWarning: { type: 'text', defaultValue: 'loading' },
|
||||||
|
};
|
||||||
|
|
||||||
|
WarningStory.storyName = 'Warning';
|
||||||
|
Loading…
Reference in New Issue
Block a user