mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Configure storybook
This commit is contained in:
3
.storybook/addons.js
Normal file
3
.storybook/addons.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import '@storybook/addon-actions/register';
|
||||
import '@storybook/addon-links/register';
|
||||
import '@storybook/addon-viewport/register';
|
13
.storybook/config.tsx
Normal file
13
.storybook/config.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { configure, addDecorator } from '@storybook/react';
|
||||
|
||||
import storyDecorator from './storyDecorator';
|
||||
|
||||
const req = require.context('../packages/app', true, /\.story\.[tj]sx?$/);
|
||||
|
||||
function loadStories() {
|
||||
req.keys().forEach(filename => req(filename));
|
||||
}
|
||||
|
||||
addDecorator(storyDecorator);
|
||||
|
||||
configure(loadStories, module);
|
12
.storybook/storyDecorator.js
Normal file
12
.storybook/storyDecorator.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import { ContextProvider } from 'app/shell';
|
||||
import { browserHistory } from 'app/services/history';
|
||||
import storeFactory from 'app/storeFactory';
|
||||
|
||||
const store = storeFactory();
|
||||
|
||||
export default story => (
|
||||
<ContextProvider store={store} history={browserHistory}>
|
||||
{story()}
|
||||
</ContextProvider>
|
||||
);
|
14
.storybook/webpack.config.js
Normal file
14
.storybook/webpack.config.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const rootConfig = require('../webpack.config');
|
||||
|
||||
module.exports = async ({ config }) => ({
|
||||
...config,
|
||||
resolve: rootConfig.resolve,
|
||||
module: {
|
||||
...config.module,
|
||||
// our rules should satisfy all storybook needs,
|
||||
// so replace all storybook defaults with our rules
|
||||
rules: rootConfig.module.rules,
|
||||
},
|
||||
|
||||
resolveLoader: rootConfig.resolveLoader,
|
||||
});
|
Reference in New Issue
Block a user