-
Notifications
You must be signed in to change notification settings - Fork 16
/
config.js
35 lines (30 loc) · 1022 Bytes
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { configure, addDecorator, addParameters, setAddon } from '@storybook/polymer';
import { withActions } from '@storybook/addon-actions';
import { withKnobs } from '@storybook/addon-knobs';
import { analyse } from './analysis';
import theme from './theme';
import './nuxeo-demo-theme';
addDecorator(withKnobs);
setAddon({
addElement(tag, fn) {
const analysis = analyse(tag);
const { events, notes } = analysis;
const storyFn = () => fn(analysis);
this.add(`<${tag}>`, () => withActions(...events)(storyFn), { notes });
},
});
addParameters({
backgrounds: [
{ name: 'Default', value: '#f5f5f5' },
{ name: 'Dark', value: '#060826' },
{ name: 'Kawai', value: '#f8d3e0' },
{ name: 'Light', value: '#f7f7f7' },
],
options: { theme },
});
// automatically import all files ending in *.stories.js
const req = require.context('../src/elements', true, /.stories.js$/);
function loadStories() {
req.keys().forEach((filename) => req(filename));
}
configure(loadStories, module);