@@ -3,67 +3,61 @@ import Button from './Button';
3import { storiesOf , action } from '@kadira/storybook' ;
3import { storiesOf , action } from '@kadira/storybook' ;
4import backgrounds from 'react-storybook-addon-backgrounds' ;
4import backgrounds from 'react-storybook-addon-backgrounds' ;
5
5
6- storiesOf ( 'Button' )
6+ storiesOf ( 'Button' ) . addWithInfo (
7- . addWithInfo (
7+ 'simple usage' ,
8- 'simple usage' ,
8+ `
9- `
10 This is the basic usage with the button with providing a label to show the text.
9 This is the basic usage with the button with providing a label to show the text.
11 ` ,
10 ` ,
12- ( ) => (
11+ ( ) => (
13- < div >
12+ < div >
14- < Button label = "The Button" onClick = { action ( 'onClick' ) } />
13+ < Button label = "The Button" onClick = { action ( 'onClick' ) } />
15- < br />
14+ < br />
16- < p >
15+ < p >
17- Click the "?" mark at top-right to view the info.
16+ Click the "?" mark at top-right to view the info.
18- </ p >
17+ </ p >
19- </ div >
18+ </ div >
20- ) ,
19+ )
21- ) ;
20+ ) ;
22
21
23- storiesOf ( 'Button' )
22+ storiesOf ( 'Button' ) . addWithInfo (
24- . addWithInfo (
23+ 'simple usage (inline info)' ,
25- 'simple usage (inline info)' ,
24+ `
26- `
27 This is the basic usage with the button with providing a label to show the text.
25 This is the basic usage with the button with providing a label to show the text.
28 ` ,
26 ` ,
29- ( ) => ( < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ) ,
27+ ( ) => < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ,
30- { inline : true } ,
28+ { inline : true }
31- ) ;
29+ ) ;
32
30
33- storiesOf ( 'Button' )
31+ storiesOf ( 'Button' ) . addWithInfo (
34- . addWithInfo (
32+ 'simple usage (disable source)' ,
35- 'simple usage (disable source)' ,
33+ `
36- `
37 This is the basic usage with the button with providing a label to show the text.
34 This is the basic usage with the button with providing a label to show the text.
38 ` ,
35 ` ,
39- ( ) => ( < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ) ,
36+ ( ) => < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ,
40- { source : false , inline : true } ,
37+ { source : false , inline : true }
41- ) ;
38+ ) ;
42
39
43- storiesOf ( 'Button' )
40+ storiesOf ( 'Button' ) . addWithInfo (
44- . addWithInfo (
41+ 'simple usage (no header)' ,
45- 'simple usage (no header)' ,
42+ `
46- `
47 This is the basic usage with the button with providing a label to show the text.
43 This is the basic usage with the button with providing a label to show the text.
48 ` ,
44 ` ,
49- ( ) => ( < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ) ,
45+ ( ) => < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ,
50- { header : false , inline : true } ,
46+ { header : false , inline : true }
51- ) ;
47+ ) ;
52
48
53- storiesOf ( 'Button' )
49+ storiesOf ( 'Button' ) . addWithInfo (
54- . addWithInfo (
50+ 'simple usage (no prop tables)' ,
55- 'simple usage (no prop tables)' ,
51+ `
56- `
57 This is the basic usage with the button with providing a label to show the text.
52 This is the basic usage with the button with providing a label to show the text.
58 ` ,
53 ` ,
59- ( ) => ( < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ) ,
54+ ( ) => < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ,
60- { propTables : false , inline : true } ,
55+ { propTables : false , inline : true }
61- ) ;
56+ ) ;
62
57
63- storiesOf ( 'Button' )
58+ storiesOf ( 'Button' ) . addWithInfo (
64- . addWithInfo (
59+ 'simple usage (custom propTables)' ,
65- 'simple usage (custom propTables)' ,
60+ `
66- `
67 This is the basic usage with the button with providing a label to show the text.
61 This is the basic usage with the button with providing a label to show the text.
68
62
69 Since, the story source code is wrapped inside a div, info addon can't figure out propTypes on it's own.
63 Since, the story source code is wrapped inside a div, info addon can't figure out propTypes on it's own.
@@ -79,81 +73,81 @@ storiesOf('Button')
79 );
73 );
80 ~~~
74 ~~~
81 ` ,
75 ` ,
82- ( ) => (
76+ ( ) => (
83- < div >
77+ < div >
84- < Button label = "The Button" onClick = { action ( 'onClick' ) } />
78+ < Button label = "The Button" onClick = { action ( 'onClick' ) } />
85- < br />
79+ < br />
86- </ div >
80+ </ div >
87- ) ,
81+ ) ,
88- { inline : true , propTables : [ Button ] }
82+ { inline : true , propTables : [ Button ] }
89- ) ;
83+ ) ;
90
84
91- storiesOf ( 'Button' )
85+ storiesOf ( 'Button' ) . addWithInfo (
92- . addWithInfo (
86+ 'simple usage (JSX description)' ,
93- 'simple usage (JSX description)' ,
87+ < div >
94- ( < div >
88+ < h2 > This is a JSX info section</ h2 >
95- < h2 > This is a JSX info section</ h2 >
89+ < p >
96- < p > Lorem ipsum dolor sit amet, consectetur adipiscing elit.
90+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
97- Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
91+ Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
98- Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
92+ Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
99- nulla.</ p >
93+ nulla.
100- < p >
94+ </ p >
101- < a
95+ < p >
102- href = 'https://github.com/storybooks/react-storybook-addon-info' >
96+ < a href = "https://github.com/storybooks/react-storybook-addon-info" >
103- This is a link</ a >
97+ This is a link
104- </ p >
98+ </ a >
105- < p >
99+ </ p >
106- < img src = "http://placehold.it/350x150" />
100+ < p >
107- </ p >
101+ < img src = "http://placehold.it/350x150" />
108- </ div > ) ,
102+ </ p >
109- ( ) => (
103+ </ div > ,
110- < div >
104+ ( ) => (
111- < Button label = "The Button" onClick = { action ( 'onClick' ) } />
105+ < div >
112- < br />
106+ < Button label = "The Button" onClick = { action ( 'onClick' ) } />
113- < p >
107+ < br />
114- Click the "?" mark at top-right to view the info.
108+ < p >
115- </ p >
109+ Click the "?" mark at top-right to view the info.
116- </ div >
110+ </ p >
117- ) ,
111+ </ div >
118- ) ;
112+ )
113+ ) ;
119
114
120- storiesOf ( 'Button' )
115+ storiesOf ( 'Button' ) . addWithInfo (
121- . addWithInfo (
116+ 'simple usage (inline JSX description)' ,
122- 'simple usage (inline JSX description)' ,
117+ < div >
123- ( < div >
118+ < h2 > This is a JSX info section</ h2 >
124- < h2 > This is a JSX info section</ h2 >
119+ < p >
125- < p > Lorem ipsum dolor sit amet, consectetur adipiscing elit.
120+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
126- Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
121+ Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
127- Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
122+ Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
128- nulla.</ p >
123+ nulla.
129- < p >
124+ </ p >
130- < a
125+ < p >
131- href = 'https://github.com/storybooks/react-storybook-addon-info' >
126+ < a href = "https://github.com/storybooks/react-storybook-addon-info" >
132- This is a link</ a >
127+ This is a link
133- </ p >
128+ </ a >
134- < p >
129+ </ p >
135- < img src = "http://placehold.it/350x150" />
130+ < p >
136- </ p >
131+ < img src = "http://placehold.it/350x150" />
137- </ div > ) ,
132+ </ p >
138- ( ) => ( < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ) ,
133+ </ div > ,
139- { inline : true }
134+ ( ) => < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ,
140- ) ;
135+ { inline : true }
136+ ) ;
141
137
142storiesOf ( 'Button' )
138storiesOf ( 'Button' )
143- . addDecorator ( backgrounds ( [
139+ . addDecorator ( backgrounds ( [ { name : 'dark' , value : '#333' , default : true } ] ) )
144- { name : 'dark' , value : '#333' , default : true } ,
145- ] ) )
146 . addWithInfo (
140 . addWithInfo (
147 'with custom styles' ,
141 'with custom styles' ,
148 `
142 `
149 This is an example of how to customize the styles of the info components.
143 This is an example of how to customize the styles of the info components.
150
144
151 For the full styles available, see \`./src/components/Story.js\`
145 For the full styles available, see \`./src/components/Story.js\`
152 ` ,
146 ` ,
153- ( ) => ( < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ) ,
147+ ( ) => < Button label = "The Button" onClick = { action ( 'onClick' ) } /> ,
154 {
148 {
155 inline : true ,
149 inline : true ,
156- styles : ( stylesheet ) => {
150+ styles : stylesheet => {
157 stylesheet . infoPage = {
151 stylesheet . infoPage = {
158 backgroundColor : '#ccc'
152 backgroundColor : '#ccc'
159 } ;
153 } ;
0 commit comments