Skip to content

Commit

Permalink
docs(storybook): migrate to CSF format, add addon-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbien committed Apr 11, 2020
1 parent 3b1ca2b commit 92bd22e
Show file tree
Hide file tree
Showing 29 changed files with 3,890 additions and 1,856 deletions.
1 change: 1 addition & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@storybook/addon-storysource/register';
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';
import '@storybook/addon-docs';
23 changes: 2 additions & 21 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { configure, addDecorator } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import { ThemeProvider } from 'styled-components';
import themes from '../src/components/common/themes';
import React from 'react';
Expand All @@ -13,27 +12,9 @@ const demoThemes = [
themes.violetDark
];

addDecorator(
withInfo({
inline: true,
header: false,
source: false,
maxPropsIntoLine: 1,
styles: stylesheet => ({
// Setting the style with a function
...stylesheet,
table: {
background: 'red'
}
})
})
);
addDecorator(GlobalStyle);
addDecorator(story => (
<ThemeProvider theme={themes.default}>{story()}</ThemeProvider>
));
const req = require.context('../src', true, /\.stories\.js$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}
configure(loadStories, module);

configure(require.context('../src/', true, /\.stories\.js$/), module);
4 changes: 4 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
stories: ['../src/**/*.stories.(js|mdx)'],
addons: ['@storybook/addon-docs']
};
Loading

0 comments on commit 92bd22e

Please sign in to comment.