1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/pages/confirm-add-token/confirm-add-token.stories.js
Etienne Dusseault 46c4cc1966
Add confirm-add-suggested-token & confirm-add-token components to Storybook (#11175)
* add suggessted token

* lintfix

* lintfix

* silence use effect warning

* download token icons and use paths to avoid web urls

* lintifx

* Add confirm-add-token component to Storyboard (#11195)

* create story for add token

* change code

* add confirm add token story

* lintfix

* Update confirm-add-token.component.js

* Update confirm-add-token.component.js

* different token list for confirm add token

* lintfix

* Update confirm-add-suggested-token.component.js

* remove bnb png

* remove redundant images and fix storybook image path
2021-08-17 00:33:46 -05:00

39 lines
1.2 KiB
JavaScript

/* eslint-disable react/prop-types */
import React, { useEffect } from 'react';
import { createBrowserHistory } from 'history';
import { text } from '@storybook/addon-knobs';
import { store } from '../../../.storybook/preview';
import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token';
import { updateMetamaskState } from '../../store/actions';
import ConfirmAddToken from '.';
export default {
title: 'Confirmation Screens',
};
const history = createBrowserHistory();
const PageSet = ({ children }) => {
const symbol = text('symbol', 'TRDT');
const state = store.getState();
const pendingTokensState = state.metamask.pendingTokens;
// only change the first token in the list
useEffect(() => {
const pendingTokens = { ...pendingTokensState };
pendingTokens['0x33f90dee07c6e8b9682dd20f73e6c358b2ed0f03'].symbol = symbol;
store.dispatch(updateMetamaskState({ pendingTokens }));
}, [symbol, pendingTokensState]);
return children;
};
export const AddToken = () => {
store.dispatch(updateMetamaskState({ pendingTokens: tokens }));
return (
<PageSet>
<ConfirmAddToken history={history} />
</PageSet>
);
};