| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import { configure, addDecorator } from '@storybook/react';
- import { withKnobs } from '@storybook/addon-knobs';
- import { withTheme } from '../src/utils/storybook/withTheme';
- import { withPaddedStory } from '../src/utils/storybook/withPaddedStory';
- import 'jquery';
- import '../../../public/vendor/flot/jquery.flot.js';
- import '../../../public/vendor/flot/jquery.flot.selection';
- import '../../../public/vendor/flot/jquery.flot.time';
- import '../../../public/vendor/flot/jquery.flot.stack';
- import '../../../public/vendor/flot/jquery.flot.pie';
- import '../../../public/vendor/flot/jquery.flot.stackpercent';
- import '../../../public/vendor/flot/jquery.flot.fillbelow';
- import '../../../public/vendor/flot/jquery.flot.crosshair';
- import '../../../public/vendor/flot/jquery.flot.dashes';
- import '../../../public/vendor/flot/jquery.flot.gauge';
- // @ts-ignore
- import lightTheme from '../../../public/sass/grafana.light.scss';
- // @ts-ignore
- import darkTheme from '../../../public/sass/grafana.dark.scss';
- const handleThemeChange = (theme: string) => {
- if (theme !== 'light') {
- lightTheme.unuse();
- darkTheme.use();
- } else {
- darkTheme.unuse();
- lightTheme.use();
- }
- };
- // automatically import all files ending in *.stories.tsx
- const req = require.context('../src/components', true, /.story.tsx$/);
- addDecorator(withKnobs);
- addDecorator(withPaddedStory);
- addDecorator(withTheme(handleThemeChange));
- function loadStories() {
- req.keys().forEach(req);
- }
- configure(loadStories, module);
|