2019-02-06 17:03:42 +01:00
|
|
|
import { configure, addDecorator } from '@storybook/react';
|
|
|
|
|
import { withKnobs } from '@storybook/addon-knobs';
|
|
|
|
|
import { withTheme } from '../src/utils/storybook/withTheme';
|
2019-03-27 11:50:36 +01:00
|
|
|
import { withPaddedStory } from '../src/utils/storybook/withPaddedStory';
|
2019-04-24 10:14:18 +02:00
|
|
|
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';
|
2019-03-21 16:06:55 +01:00
|
|
|
// @ts-ignore
|
|
|
|
|
import lightTheme from '../../../public/sass/grafana.light.scss';
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import darkTheme from '../../../public/sass/grafana.dark.scss';
|
2019-01-09 09:40:57 +01:00
|
|
|
|
2019-03-21 16:06:55 +01:00
|
|
|
const handleThemeChange = (theme: string) => {
|
|
|
|
|
if (theme !== 'light') {
|
|
|
|
|
lightTheme.unuse();
|
|
|
|
|
darkTheme.use();
|
|
|
|
|
} else {
|
|
|
|
|
darkTheme.unuse();
|
|
|
|
|
lightTheme.use();
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-01-09 09:40:57 +01:00
|
|
|
// automatically import all files ending in *.stories.tsx
|
2019-01-16 10:27:09 +01:00
|
|
|
const req = require.context('../src/components', true, /.story.tsx$/);
|
2019-01-09 09:40:57 +01:00
|
|
|
|
2019-02-06 17:03:42 +01:00
|
|
|
addDecorator(withKnobs);
|
2019-03-27 11:50:36 +01:00
|
|
|
addDecorator(withPaddedStory);
|
2019-03-21 16:06:55 +01:00
|
|
|
addDecorator(withTheme(handleThemeChange));
|
2019-02-06 17:03:42 +01:00
|
|
|
|
2019-01-09 09:40:57 +01:00
|
|
|
function loadStories() {
|
|
|
|
|
req.keys().forEach(req);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
configure(loadStories, module);
|