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',
|
2023-01-20 20:27:46 +01:00
|
|
|
|
2021-09-20 21:05:58 +02:00
|
|
|
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',
|
|
|
|
},
|
2022-11-21 16:19:11 +01:00
|
|
|
domainResolution: {
|
2022-03-08 22:50:35 +01:00
|
|
|
control: 'text',
|
|
|
|
},
|
2022-11-21 16:19:11 +01:00
|
|
|
domainError: {
|
2022-03-08 22:50:35 +01:00
|
|
|
control: 'text',
|
|
|
|
},
|
2022-11-21 16:19:11 +01:00
|
|
|
domainWarning: {
|
2022-03-08 22:50:35 +01:00
|
|
|
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>
|
|
|
|
);
|
|
|
|
};
|
2022-12-15 23:46:30 +01:00
|
|
|
ErrorStory.storyName = 'Error';
|
|
|
|
ErrorStory.args = {
|
2022-11-21 16:19:11 +01:00
|
|
|
// domainError must be the key for a translation
|
2022-12-15 23:46:30 +01:00
|
|
|
domainError: 'loading',
|
2022-02-17 17:14:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const WarningStory = (args) => {
|
|
|
|
return (
|
|
|
|
<div style={{ width: 300 }}>
|
|
|
|
<AddRecipient
|
|
|
|
{...args}
|
|
|
|
updateRecipient={() => undefined}
|
|
|
|
updateGas={() => undefined}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2022-12-15 23:46:30 +01:00
|
|
|
WarningStory.storyName = 'Warning';
|
|
|
|
WarningStory.args = {
|
2022-11-21 16:19:11 +01:00
|
|
|
// domainWarning must be the key for a translation
|
2022-12-15 23:46:30 +01:00
|
|
|
domainWarning: 'loading',
|
2022-02-17 17:14:10 +01:00
|
|
|
};
|