You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.0 KiB
47 lines
1.0 KiB
/* eslint-disable react/prop-types */
|
|
import React, { useEffect } from 'react';
|
|
|
|
import { store, getNewState } from '../../../.storybook/preview';
|
|
import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token';
|
|
import { updateMetamaskState } from '../../store/actions';
|
|
import ConfirmAddToken from '.';
|
|
|
|
export default {
|
|
title: 'Pages/ConfirmImportToken',
|
|
id: __filename,
|
|
|
|
argTypes: {
|
|
pendingTokens: {
|
|
control: 'object',
|
|
table: { category: 'Data' },
|
|
},
|
|
},
|
|
};
|
|
|
|
const PageSet = ({ children, pendingTokens }) => {
|
|
const { metamask: state } = store.getState();
|
|
|
|
useEffect(() => {
|
|
store.dispatch(
|
|
updateMetamaskState(
|
|
getNewState(state, {
|
|
pendingTokens,
|
|
}),
|
|
),
|
|
);
|
|
}, [state, pendingTokens]);
|
|
|
|
return children;
|
|
};
|
|
|
|
export const DefaultStory = ({ pendingTokens }) => {
|
|
return (
|
|
<PageSet pendingTokens={pendingTokens}>
|
|
<ConfirmAddToken />
|
|
</PageSet>
|
|
);
|
|
};
|
|
DefaultStory.args = {
|
|
pendingTokens: { ...tokens },
|
|
};
|
|
DefaultStory.storyName = 'Default';
|
|
|