3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00
grafana/packages/grafana-ui/.storybook/config.ts
Dominik Prokop c9e4fedaa8
Feat: Introduce Button and LinkButton components to @grafana/ui ()
- Bumped Storybook to v5
- Introduced Emotion
- Add additional config for storybook (combinations add-on, default padding in preview pane)
- Added basic react based button components
- Introduced AbstractButton, Button and LinkButton components together with stories
- Exposed button components from @grafana/ui
2019-03-27 11:50:36 +01:00

32 lines
908 B
TypeScript

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';
// @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);