|
|
@ -2,13 +2,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
import React, { useEffect, useState } from 'react'; |
|
|
|
import React, { useEffect, useState } from 'react'; |
|
|
|
import { Provider } from 'react-redux'; |
|
|
|
import { Provider } from 'react-redux'; |
|
|
|
import { boolean } from '@storybook/addon-knobs'; |
|
|
|
|
|
|
|
import testData from '../../../../../.storybook/test-data'; |
|
|
|
import testData from '../../../../../.storybook/test-data'; |
|
|
|
|
|
|
|
import { GAS_INPUT_MODES } from '../../../../ducks/send'; |
|
|
|
|
|
|
|
import { updateMetamaskState } from '../../../../store/actions'; |
|
|
|
import configureStore from '../../../../store/store'; |
|
|
|
import configureStore from '../../../../store/store'; |
|
|
|
import { calcGasTotal } from '../../send.utils'; |
|
|
|
import { calcGasTotal } from '../../send.utils'; |
|
|
|
import { updateMetamaskState } from '../../../../store/actions'; |
|
|
|
import README from './README.mdx'; |
|
|
|
import { GAS_INPUT_MODES } from '../../../../ducks/send'; |
|
|
|
|
|
|
|
import SendGasRow from './send-gas-row.component'; |
|
|
|
import SendGasRow from './send-gas-row.component'; |
|
|
|
|
|
|
|
|
|
|
|
const store = configureStore(testData); |
|
|
|
const store = configureStore(testData); |
|
|
@ -17,16 +16,26 @@ export default { |
|
|
|
title: 'Pages/Send/SendContent/SendGasRow', |
|
|
|
title: 'Pages/Send/SendContent/SendGasRow', |
|
|
|
id: __filename, |
|
|
|
id: __filename, |
|
|
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>], |
|
|
|
decorators: [(story) => <Provider store={store}>{story()}</Provider>], |
|
|
|
|
|
|
|
parameters: { |
|
|
|
|
|
|
|
docs: { |
|
|
|
|
|
|
|
page: README, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
argTypes: { |
|
|
|
|
|
|
|
insufficientBalance: { |
|
|
|
|
|
|
|
name: 'Is Insufficient Balance', |
|
|
|
|
|
|
|
control: { type: 'boolean' }, |
|
|
|
|
|
|
|
defaultValue: false, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const DefaultStory = () => { |
|
|
|
export const DefaultStory = (args) => { |
|
|
|
const state = store.getState(); |
|
|
|
const state = store.getState(); |
|
|
|
const { metamask } = state; |
|
|
|
const { metamask } = state; |
|
|
|
const { send } = metamask; |
|
|
|
const { send } = metamask; |
|
|
|
const [sendState, setSendState] = useState(send); |
|
|
|
const [sendState, setSendState] = useState(send); |
|
|
|
|
|
|
|
|
|
|
|
const insufficientBalance = boolean('Is Insufficient Balance', false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
const newState = Object.assign(metamask, { |
|
|
|
const newState = Object.assign(metamask, { |
|
|
|
send: sendState, |
|
|
|
send: sendState, |
|
|
@ -65,7 +74,7 @@ export const DefaultStory = () => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div style={{ width: 500 }}> |
|
|
|
<div style={{ width: 500 }}> |
|
|
|
<SendGasRow |
|
|
|
<SendGasRow |
|
|
|
insufficientBalance={insufficientBalance} |
|
|
|
{...args} |
|
|
|
updateGasPrice={updateGasPrice} |
|
|
|
updateGasPrice={updateGasPrice} |
|
|
|
updateGasLimit={updateGasLimit} |
|
|
|
updateGasLimit={updateGasLimit} |
|
|
|
gasPrice={send.gasPrice} |
|
|
|
gasPrice={send.gasPrice} |
|
|
@ -76,4 +85,4 @@ export const DefaultStory = () => { |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default'; |
|
|
|
DefaultStory.storyName = 'SendGasRow'; |
|
|
|