2021-09-20 21:05:58 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
|
|
|
|
import configureStore from '../../../../store/store';
|
|
|
|
|
|
|
|
import testData from '../../../../../.storybook/test-data';
|
|
|
|
import AddRecipient from './add-recipient.component';
|
|
|
|
|
|
|
|
const store = configureStore(testData);
|
|
|
|
|
2022-02-17 17:14:10 +01:00
|
|
|
const { metamask } = store.getState();
|
|
|
|
const { addressBook } = metamask;
|
|
|
|
const recipient = metamask.accountArray[0];
|
|
|
|
|
2021-09-20 21:05:58 +02:00
|
|
|
export default {
|
2021-12-01 20:27:57 +01:00
|
|
|
title: 'Pages/Send/SendContent/AddRecipient',
|
2021-09-20 21:05:58 +02:00
|
|
|
id: __filename,
|
|
|
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>],
|
2022-02-17 17:14:10 +01:00
|
|
|
argTypes: {
|
2022-03-08 22:50:35 +01:00
|
|
|
userInput: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
ownedAccounts: {
|
|
|
|
control: 'array',
|
|
|
|
},
|
|
|
|
addressBook: {
|
|
|
|
control: 'array',
|
|
|
|
},
|
|
|
|
updateRecipient: {
|
|
|
|
action: 'updateRecipient',
|
|
|
|
},
|
|
|
|
ensResolution: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
ensError: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
ensWarning: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
addressBookEntryName: {
|
|
|
|
control: 'text',
|
|
|
|
},
|
|
|
|
contacts: {
|
|
|
|
control: 'array',
|
|
|
|
},
|
|
|
|
nonContacts: {
|
|
|
|
control: 'array',
|
|
|
|
},
|
|
|
|
useMyAccountsForRecipientSearch: {
|
|
|
|
action: 'useMyAccountsForRecipientSearch',
|
|
|
|
},
|
|
|
|
useContactListForRecipientSearch: {
|
|
|
|
action: 'useContactListForRecipientSearch',
|
|
|
|
},
|
|
|
|
isUsingMyAccountsForRecipientSearch: {
|
|
|
|
control: 'bool',
|
|
|
|
},
|
|
|
|
recipient: {
|
|
|
|
control: 'object',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
recipient,
|
|
|
|
contacts: [addressBook],
|
|
|
|
nonContacts: [addressBook],
|
|
|
|
ownedAccounts: [addressBook],
|
|
|
|
addressBook: [addressBook],
|
2022-02-17 17:14:10 +01:00
|
|
|
},
|
2021-09-20 21:05:58 +02:00
|
|
|
};
|
|
|
|
|
2022-02-17 17:14:10 +01:00
|
|
|
export const DefaultStory = (args) => {
|
2021-09-20 21:05:58 +02:00
|
|
|
return (
|
|
|
|
<div style={{ width: 300 }}>
|
|
|
|
<AddRecipient
|
2022-02-17 17:14:10 +01:00
|
|
|
{...args}
|
2021-09-20 21:05:58 +02:00
|
|
|
updateRecipient={() => undefined}
|
|
|
|
updateGas={() => undefined}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2021-12-01 20:27:57 +01:00
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default';
|
2022-02-17 17:14:10 +01:00
|
|
|
|
|
|
|
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';
|