config.js 764 B

1234567891011121314151617181920212223
  1. import React from 'react';
  2. import { configure, setAddon, addDecorator } from '@storybook/react';
  3. import infoAddon from '@storybook/addon-info';
  4. import { ThemeProvider } from 'styled-components';
  5. import constants from 'utils/constants';
  6. import { GlobalStyle, getTheme, loadSvgIcons } from 'styles';
  7. import 'styles/animate.css';
  8. const { DEFAULT_THEME } = constants;
  9. const theme = getTheme(DEFAULT_THEME);
  10. loadSvgIcons();
  11. addDecorator(story => (
  12. <GlobalStyle theme={theme}>
  13. <ThemeProvider theme={theme}>{story()}</ThemeProvider>
  14. </GlobalStyle>
  15. ));
  16. setAddon(infoAddon);
  17. const loadStories = dir => {
  18. const req = require.context('../src/components', true, /\.story\.jsx$/);
  19. req.keys().forEach(filename => req(filename));
  20. };
  21. configure(loadStories, module);