2021-09-29 20:43:18 +02:00
|
|
|
import React, { useEffect } from 'react';
|
|
|
|
import { combineReducers, createStore } from 'redux';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
|
|
|
|
import {
|
|
|
|
updateSendStage,
|
|
|
|
updateSendAsset,
|
|
|
|
} from '../../../../.storybook/actions/sb-send-action';
|
|
|
|
|
|
|
|
import sendSBReducer from '../../../../.storybook/reducers/sb-send-reducer';
|
|
|
|
import historySBReducer from '../../../../.storybook/reducers/sb-history-reducer';
|
|
|
|
import SendHeader from './send-header.component';
|
|
|
|
|
|
|
|
export default {
|
2021-12-01 20:27:57 +01:00
|
|
|
title: 'Pages/Send/SendHeader',
|
2021-09-29 20:43:18 +02:00
|
|
|
id: __filename,
|
2022-01-17 19:58:12 +01:00
|
|
|
argTypes: {
|
|
|
|
asset: {
|
|
|
|
control: {
|
|
|
|
type: 'select',
|
|
|
|
},
|
|
|
|
options: ['NATIVE', 'TOKEN'],
|
|
|
|
},
|
|
|
|
stage: {
|
|
|
|
control: {
|
|
|
|
type: 'select',
|
|
|
|
},
|
|
|
|
options: ['ADD_RECIPIENT', 'DRAFT', 'EDIT', 'INACTIVE'],
|
|
|
|
},
|
|
|
|
},
|
2021-09-29 20:43:18 +02:00
|
|
|
};
|
|
|
|
|
2022-01-17 19:58:12 +01:00
|
|
|
const store = createStore(
|
|
|
|
combineReducers({ send: sendSBReducer, history: historySBReducer }),
|
|
|
|
);
|
|
|
|
const state = store.getState();
|
|
|
|
const { send } = state;
|
2021-09-29 20:43:18 +02:00
|
|
|
|
2022-01-17 19:58:12 +01:00
|
|
|
export const DefaultStory = (args) => {
|
2021-09-29 20:43:18 +02:00
|
|
|
useEffect(() => {
|
2022-01-17 19:58:12 +01:00
|
|
|
store.dispatch(updateSendAsset(args.asset));
|
|
|
|
}, [args.asset]);
|
2021-09-29 20:43:18 +02:00
|
|
|
|
|
|
|
useEffect(() => {
|
2022-01-17 19:58:12 +01:00
|
|
|
store.dispatch(updateSendStage(args.stage));
|
|
|
|
}, [args.stage]);
|
2021-09-29 20:43:18 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Provider store={store}>
|
|
|
|
<div style={{ width: 600 }}>
|
2022-01-17 19:58:12 +01:00
|
|
|
<SendHeader {...args} />
|
2021-09-29 20:43:18 +02:00
|
|
|
</div>
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
};
|
2021-12-01 20:27:57 +01:00
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default';
|
2022-01-17 19:58:12 +01:00
|
|
|
DefaultStory.args = {
|
|
|
|
asset: 'NATIVE' || send.asset,
|
|
|
|
stage: 'ADD_RECIPIENT' || send.stage,
|
|
|
|
};
|