|
1 | | -/* eslint-disable import/no-extraneous-dependencies */ |
2 | | -/* eslint-disable react/jsx-filename-extension */ |
3 | | - |
4 | | -import React from 'react'; |
5 | | -import { storiesOf, action, addDecorator } from '@storybook/react'; |
6 | | -import { setOptions } from '@storybook/addon-options'; |
7 | | -import { muiTheme } from 'storybook-addon-material-ui'; |
8 | | -import { WithNotes } from '@storybook/addon-notes'; |
9 | | -import { withKnobs, text, boolean, number } from '@storybook/addon-knobs'; |
10 | | - |
11 | | -import App from '../App'; |
12 | | -import Header from '../Header'; |
13 | | -import Intro from '../Intro'; |
14 | | -import Button from '../button'; |
15 | | -import '../App.css'; |
16 | | - |
17 | | -const reqThemes = require.context('../.themes/', true, /.json/); |
18 | | -const themesList = []; |
19 | | -reqThemes.keys().forEach((filename) => { |
20 | | - themesList.push(reqThemes(filename)); |
21 | | -}); |
22 | | - |
23 | | -/** note: decorators |
24 | | - * You can add decorator globally: |
25 | | - * addDecorator(muiTheme(greyTheme)); |
26 | | - * You can pass a single object or an array of themes |
27 | | - */ |
28 | | - |
29 | | - |
30 | | -storiesOf('No decorator', module) |
31 | | - .add('Example1', () => ( |
32 | | - <div className="example-component"> |
33 | | - <Button title="no decor 1" /> |
34 | | - </div> |
35 | | - )) |
36 | | - .add('Example2', () => ( |
37 | | - <div className="example-component"> |
38 | | - <Button title="no decor 2" /> |
39 | | - </div> |
40 | | - )) |
41 | | - .querry() |
42 | | - |
43 | | - |
44 | | -storiesOf('Podda App1', module) |
45 | | - .add('Example1', () => ( |
46 | | - <div className="example-component"> |
47 | | - <Button title="Example 1" /> |
48 | | - </div> |
49 | | - )) |
50 | | - .add('Example2', () => ( |
51 | | - <div className="example-component"> |
52 | | - <Button title="Example 2" /> |
53 | | - </div> |
54 | | - )); |
55 | | - |
56 | | -storiesOf('Podda App2', module) |
57 | | - .add('Example3', () => ( |
58 | | - <div className="example-component"> |
59 | | - <Button title="Example 3" /> |
60 | | - </div> |
61 | | - )) |
62 | | - |
63 | | - .add('Example4', () => ( |
64 | | - <div className="example-component"> |
65 | | - <Button title="Example 4" /> |
66 | | - </div> |
67 | | - )); |
68 | | - |
69 | | -storiesOf('Knobs1', module) |
70 | | - .addDecorator(withKnobs) |
71 | | - .add('Knob1', () => ( |
72 | | - <div> |
73 | | - <p>{text('Title1', 'Knob1.Title')}!!!</p> |
74 | | - <p>{text('Subtitle1', 'Knob1.SubTitle')}</p> |
75 | | - </div> |
76 | | - )) |
77 | | - .add('Knob2', () => ( |
78 | | - <div> |
79 | | - <p>{text('Title2', 'Knob2.Title')}</p> |
80 | | - <p>{text('Subtitle2', 'Knob2.SubTitle')}</p> |
81 | | - </div> |
82 | | - )); |
83 | | - |
84 | | - |
85 | | -storiesOf('Knobs2', module) |
86 | | - .addDecorator(withKnobs) |
87 | | - .add('Knob3', () => ( |
88 | | - <div> |
89 | | - <p>{text('Title3', 'Knob1.Title')}</p> |
90 | | - <p>{text('Subtitle3', 'Knob1.SubTitle')}</p> |
91 | | - </div> |
92 | | - )) |
93 | | - .add('Knob4', () => ( |
94 | | - <div> |
95 | | - <p>{text('Title4', 'Knob2.Title')}</p> |
96 | | - <p>{text('Subtitle4', 'Knob2.SubTitle')}</p> |
97 | | - </div> |
98 | | - )); |
99 | | - |
100 | | - |
101 | | - |
102 | | -function withNote(note, child) { |
103 | | - return ( |
104 | | - <WithNotes notes={note}>{child || null}</WithNotes> |
105 | | - ); |
106 | | -} |
| 1 | +/* eslint-disable import/no-extraneous-dependencies */ |
| 2 | +/* eslint-disable react/jsx-filename-extension */ |
| 3 | + |
| 4 | +import React from 'react'; |
| 5 | +import { storiesOf, action, addDecorator } from '@storybook/react'; |
| 6 | +import { setOptions } from '@storybook/addon-options'; |
| 7 | +import { muiTheme } from 'storybook-addon-material-ui'; |
| 8 | +import { WithNotes } from '@storybook/addon-notes'; |
| 9 | +import { withKnobs, text, boolean, number } from '@storybook/addon-knobs'; |
| 10 | + |
| 11 | +import App from '../App'; |
| 12 | +import Header from '../Header'; |
| 13 | +import Intro from '../Intro'; |
| 14 | +import Button from '../button'; |
| 15 | +import '../App.css'; |
| 16 | + |
| 17 | +const reqThemes = require.context('../.themes/', true, /.json/); |
| 18 | +const themesList = []; |
| 19 | +reqThemes.keys().forEach((filename) => { |
| 20 | + themesList.push(reqThemes(filename)); |
| 21 | +}); |
| 22 | + |
| 23 | +/** note: decorators |
| 24 | + * You can add decorator globally: |
| 25 | + * addDecorator(muiTheme(greyTheme)); |
| 26 | + * You can pass a single object or an array of themes |
| 27 | + */ |
| 28 | + |
| 29 | + |
| 30 | +storiesOf('No decorator', module) |
| 31 | + .add('Example1', () => ( |
| 32 | + <div className="example-component"> |
| 33 | + <Button title="no decor 1" /> |
| 34 | + </div> |
| 35 | + )) |
| 36 | + .add('Example2', () => ( |
| 37 | + <div className="example-component"> |
| 38 | + <Button title="no decor 2" /> |
| 39 | + </div> |
| 40 | + )) |
| 41 | + .querry() |
| 42 | + |
| 43 | + |
| 44 | +storiesOf('Podda App1', module) |
| 45 | + .add('Example1', () => ( |
| 46 | + <div className="example-component"> |
| 47 | + <Button title="Example 1" /> |
| 48 | + </div> |
| 49 | + )) |
| 50 | + .add('Example2', () => ( |
| 51 | + <div className="example-component"> |
| 52 | + <Button title="Example 2" /> |
| 53 | + </div> |
| 54 | + )); |
| 55 | + |
| 56 | +storiesOf('Podda App2', module) |
| 57 | + .add('Example3', () => ( |
| 58 | + <div className="example-component"> |
| 59 | + <Button title="Example 3" /> |
| 60 | + </div> |
| 61 | + )) |
| 62 | + |
| 63 | + .add('Example4', () => ( |
| 64 | + <div className="example-component"> |
| 65 | + <Button title="Example 4" /> |
| 66 | + </div> |
| 67 | + )); |
| 68 | + |
| 69 | +storiesOf('Knobs1', module) |
| 70 | + .addDecorator(withKnobs) |
| 71 | + .add('Knob1', () => ( |
| 72 | + <div> |
| 73 | + <p>{text('Title1', 'Knob1.Title')}!!!</p> |
| 74 | + <p>{text('Subtitle1', 'Knob1.SubTitle')}</p> |
| 75 | + </div> |
| 76 | + )) |
| 77 | + .add('Knob2', () => ( |
| 78 | + <div> |
| 79 | + <p>{text('Title2', 'Knob2.Title')}</p> |
| 80 | + <p>{text('Subtitle2', 'Knob2.SubTitle')}</p> |
| 81 | + </div> |
| 82 | + )); |
| 83 | + |
| 84 | + |
| 85 | +storiesOf('Knobs2', module) |
| 86 | + .addDecorator(withKnobs) |
| 87 | + .add('Knob3', () => ( |
| 88 | + <div> |
| 89 | + <p>{text('Title3', 'Knob1.Title')}</p> |
| 90 | + <p>{text('Subtitle3', 'Knob1.SubTitle')}</p> |
| 91 | + </div> |
| 92 | + )) |
| 93 | + .add('Knob4', () => ( |
| 94 | + <div> |
| 95 | + <p>{text('Title4', 'Knob2.Title')}</p> |
| 96 | + <p>{text('Subtitle4', 'Knob2.SubTitle')}</p> |
| 97 | + </div> |
| 98 | + )); |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +function withNote(note, child) { |
| 103 | + return ( |
| 104 | + <WithNotes notes={note}>{child || null}</WithNotes> |
| 105 | + ); |
| 106 | +} |
0 commit comments