@@ -9,6 +9,7 @@ import CardStatus from '../../components/CardStatus';
9
9
import CardActions from '../../components/CardActions' ;
10
10
import CardActionItem from '../../components/CardActionItem' ;
11
11
import Button from '../../components/Button' ;
12
+ import Link from '../../components/Link' ;
12
13
13
14
const cardProps = {
14
15
onClick : ( ) => { console . log ( 'click' ) ; } , // eslint-disable-line no-console
@@ -27,32 +28,15 @@ const overflowMenuItemProps = {
27
28
className : 'some-class' ,
28
29
} ;
29
30
30
- const appCardLinks = [
31
- 'http://myapp.mybluemix.net' ,
32
- ] ;
33
-
34
- const containerCardInfo = [
35
- 'Route: None' ,
36
- ] ;
37
-
38
- const serviceCardInfo = [
39
- 'Cloudant NoSQL DB' ,
40
- 'Shared' ,
41
- ] ;
42
-
43
- const virtualServerCardLinks = [
44
- 'Private IP: 127.31.0.6' ,
45
- 'Image: Ubuntu 14.04' ,
46
- ] ;
47
-
48
31
class ControlledCard extends Component {
49
32
static propTypes = {
50
33
status : React . PropTypes . number ,
51
- stopApp : React . PropTypes . func ,
34
+ simple : React . PropTypes . bool ,
52
35
}
53
36
54
37
static defaultProps = {
55
38
status : CardStatus . appStatus . RUNNING ,
39
+ simple : false
56
40
}
57
41
58
42
constructor ( props ) {
@@ -97,254 +81,111 @@ class ControlledCard extends Component {
97
81
] ;
98
82
99
83
return (
100
- < Card { ...cardProps } >
84
+ ( this . props . simple ) ? ( < Card { ...cardProps } >
101
85
< CardContent
102
- cardTitle = "App Title 1"
103
- cardLink = { cardLinks }
86
+ cardTitle = "Card Name"
87
+ cardIcon = "app-services"
88
+ cardInfo = { [ 'Secondary Information' ] }
104
89
>
105
90
< OverflowMenu { ...overflowMenuProps } >
106
91
< OverflowMenuItem
107
92
{ ...overflowMenuItemProps }
108
93
itemText = "Stop App"
109
- onClick = { this . stopApp }
110
94
/>
111
95
< OverflowMenuItem
112
96
{ ...overflowMenuItemProps }
113
97
itemText = "Restart App"
114
- onClick = { this . restartApp }
115
98
/>
116
99
< OverflowMenuItem
117
100
{ ...overflowMenuItemProps }
118
101
itemText = "Rename App"
119
- onClick = { this . renameApp }
120
102
/>
121
103
< OverflowMenuItem
122
104
{ ...overflowMenuItemProps }
123
105
itemText = "Delete App"
124
- isDelete
125
- isLastItem
126
- onClick = { this . deleteApp }
106
+ hasDivider
127
107
/>
128
108
</ OverflowMenu >
129
109
</ CardContent >
130
110
< CardFooter >
131
- < CardStatus status = { this . state . status } />
132
- < CardActions >
133
- < CardActionItem iconName = "restart--glyph" onClick = { this . restartApp } description = "Restart App" />
134
- < CardActionItem iconName = "launch--glyph" onClick = { this . goToApp } description = "Go To App" />
135
- < CardActionItem iconName = "favorite" onClick = { this . favoriteApp } description = "Favorite App" />
136
- </ CardActions >
111
+ < Button small kind = "primary" > View credentials</ Button >
112
+ < Link href = "#" className = "bx--card-footer__link" > Link</ Link >
137
113
</ CardFooter >
138
- </ Card >
139
- ) ;
140
- }
141
- }
142
-
143
- storiesOf ( 'Card' , module )
144
- . addWithInfo (
145
- 'card with example functions' ,
146
- `
147
- Cards provide an at-a glance preview of the content they link to and frequently contain
148
- easily-consumable content. The Card component can be divided into seperate parts.
149
- Use the Card Footer component to add a section to the bottom of your Card. The Card Content component
150
- contains the main content of the card (cardIcon, cardTitle, cardLink, cardInfo). Card Status displays the
151
- current status of the application (RUNNING, NOT_RUNNING, STOPPED). Finally, create Card Actions
152
- to add functional buttons with icons. The example below shows a Card component with info and an Overflow Menu in the
153
- Card Content, plus Restart/Go To/Favorite actions in the Card Footer.
154
- ` ,
155
- ( ) => (
156
- < ControlledCard status = { CardStatus . appStatus . RUNNING } />
157
- ) )
158
- . addWithInfo (
159
- 'basic card' ,
160
- `
161
- Cards provide an at-a glance preview of the content they link to and frequently contain
162
- easily-consumable content. The example below shows an empty card. Create Card Content, Card Footer,
163
- Card Status and Card Actions components to add content to your card.
164
- ` ,
165
- ( ) => (
166
- < Card />
167
- ) )
168
- . addWithInfo (
169
- 'app card' ,
170
- `
171
- Cards provide an at-a glance preview of the content they link to and frequently contain
172
- easily-consumable content. The example below shows a Card suited for an application.
173
- ` ,
174
- ( ) => (
175
- < Card { ...cardProps } >
114
+ </ Card > )
115
+ : ( < Card { ...cardProps } >
176
116
< CardContent
177
117
cardTitle = "App Title 1"
178
- cardLink = { appCardLinks }
179
- >
180
- < OverflowMenu { ...overflowMenuProps } >
181
- < OverflowMenuItem
182
- { ...overflowMenuItemProps }
183
- itemText = "Stop App"
184
- />
185
- < OverflowMenuItem
186
- { ...overflowMenuItemProps }
187
- itemText = "Restart App"
188
- />
189
- < OverflowMenuItem
190
- { ...overflowMenuItemProps }
191
- itemText = "Rename App"
192
- />
193
- < OverflowMenuItem
194
- { ...overflowMenuItemProps }
195
- itemText = "Delete App"
196
- isDelete
197
- isLastItem
198
- />
199
- </ OverflowMenu >
200
- </ CardContent >
201
- < CardFooter >
202
- < CardStatus status = { CardStatus . appStatus . RUNNING } />
203
- < CardActions >
204
- < CardActionItem iconName = "restart--glyph" />
205
- < CardActionItem iconName = "launch--glyph" />
206
- < CardActionItem iconName = "favorite" />
207
- </ CardActions >
208
- </ CardFooter >
209
- </ Card >
210
- ) )
211
- . addWithInfo (
212
- 'container card' ,
213
- `
214
- Cards provide an at-a glance preview of the content they link to and frequently contain
215
- easily-consumable content. The example below shows a Card suited for a container.
216
- ` ,
217
- ( ) => (
218
- < Card { ...cardProps } >
219
- < CardContent
220
- cardTitle = "Container Group"
221
- cardInfo = { containerCardInfo }
118
+ cardLink = { cardLinks }
222
119
>
223
120
< OverflowMenu { ...overflowMenuProps } >
224
121
< OverflowMenuItem
225
122
{ ...overflowMenuItemProps }
226
123
itemText = "Stop App"
124
+ onClick = { this . stopApp }
227
125
/>
228
126
< OverflowMenuItem
229
127
{ ...overflowMenuItemProps }
230
128
itemText = "Restart App"
129
+ onClick = { this . restartApp }
231
130
/>
232
131
< OverflowMenuItem
233
132
{ ...overflowMenuItemProps }
234
133
itemText = "Rename App"
134
+ onClick = { this . renameApp }
235
135
/>
236
136
< OverflowMenuItem
237
137
{ ...overflowMenuItemProps }
238
138
itemText = "Delete App"
239
- isDelete
240
- isLastItem
139
+ hasDivider
140
+ onClick = { this . deleteApp }
241
141
/>
242
142
</ OverflowMenu >
243
143
</ CardContent >
244
144
< CardFooter >
245
- < CardStatus status = { CardStatus . appStatus . RUNNING } />
145
+ < CardStatus status = { this . state . status } />
246
146
< CardActions >
247
- < CardActionItem iconName = "restart_icon" />
147
+ < CardActionItem iconName = "restart--glyph" onClick = { this . restartApp } description = "Restart App" />
148
+ < CardActionItem iconName = "launch--glyph" onClick = { this . goToApp } description = "Go To App" />
149
+ < CardActionItem iconName = "favorite" onClick = { this . favoriteApp } description = "Favorite App" />
248
150
</ CardActions >
249
151
</ CardFooter >
250
- </ Card >
251
- ) )
152
+ </ Card > )
153
+ ) ;
154
+ }
155
+ }
156
+
157
+ storiesOf ( 'Card' , module )
252
158
. addWithInfo (
253
- 'service card' ,
159
+ 'card' ,
254
160
`
255
161
Cards provide an at-a glance preview of the content they link to and frequently contain
256
- easily-consumable content. The example below shows a Card suited for a service.
162
+ easily-consumable content. The example below shows an empty card. Create Card Content, Card Footer,
163
+ Card Status and Card Actions components to add content to your card.
257
164
` ,
258
165
( ) => (
259
- < Card { ...cardProps } >
260
- < CardContent
261
- cardTitle = "Service Name 1"
262
- cardInfo = { serviceCardInfo }
263
- >
264
- < OverflowMenu { ...overflowMenuProps } >
265
- < OverflowMenuItem
266
- { ...overflowMenuItemProps }
267
- itemText = "Stop App"
268
- />
269
- < OverflowMenuItem
270
- { ...overflowMenuItemProps }
271
- itemText = "Restart App"
272
- />
273
- < OverflowMenuItem
274
- { ...overflowMenuItemProps }
275
- itemText = "Rename App"
276
- />
277
- < OverflowMenuItem
278
- { ...overflowMenuItemProps }
279
- itemText = "Delete App"
280
- isDelete
281
- isLastItem
282
- />
283
- </ OverflowMenu >
284
- </ CardContent >
285
- < CardFooter >
286
- < Button
287
- className = "bx--card-footer__credentials-button"
288
- > View Credentials
289
- </ Button >
290
- < a href = "#" className = "bx--card-footer__docs-link" > Docs</ a >
291
- </ CardFooter >
292
- </ Card >
166
+ < ControlledCard simple />
293
167
) )
294
168
. addWithInfo (
295
- 'virtual server group ' ,
169
+ 'card with example functions ' ,
296
170
`
297
171
Cards provide an at-a glance preview of the content they link to and frequently contain
298
- easily-consumable content. The example below shows a Card suited for virtual server group.
172
+ easily-consumable content. The Card component can be divided into seperate parts.
173
+ Use the Card Footer component to add a section to the bottom of your Card. The Card Content component
174
+ contains the main content of the card (cardIcon, cardTitle, cardLink, cardInfo). Card Status displays the
175
+ current status of the application (RUNNING, NOT_RUNNING, STOPPED). Finally, create Card Actions
176
+ to add functional buttons with icons. The example below shows a Card component with info and an Overflow Menu in the
177
+ Card Content, plus Restart/Go To/Favorite actions in the Card Footer.
299
178
` ,
300
179
( ) => (
301
- < Card { ...cardProps } >
302
- < CardContent
303
- cardTitle = "Virtual Server Group"
304
- cardLink = { virtualServerCardLinks }
305
- >
306
- < OverflowMenu { ...overflowMenuProps } >
307
- < OverflowMenuItem
308
- { ...overflowMenuItemProps }
309
- itemText = "Stop App"
310
- />
311
- < OverflowMenuItem
312
- { ...overflowMenuItemProps }
313
- itemText = "Restart App"
314
- />
315
- < OverflowMenuItem
316
- { ...overflowMenuItemProps }
317
- itemText = "Rename App"
318
- />
319
- < OverflowMenuItem
320
- { ...overflowMenuItemProps }
321
- itemText = "Delete App"
322
- isDelete
323
- isLastItem
324
- />
325
- </ OverflowMenu >
326
- </ CardContent >
327
- < CardFooter >
328
- < CardStatus status = { CardStatus . appStatus . RUNNING } />
329
- < CardActions >
330
- < CardActionItem iconName = "restart_icon" />
331
- </ CardActions >
332
- </ CardFooter >
333
- </ Card >
180
+ < ControlledCard status = { CardStatus . appStatus . RUNNING } />
334
181
) )
335
182
. addWithInfo (
336
- 'quota card' ,
183
+ 'basic card' ,
337
184
`
338
185
Cards provide an at-a glance preview of the content they link to and frequently contain
339
- easily-consumable content. The example below shows a Card suited for a quota.
186
+ easily-consumable content. The example below shows an empty card. Create Card Content, Card Footer,
187
+ Card Status and Card Actions components to add content to your card.
340
188
` ,
341
189
( ) => (
342
- < Card { ...cardProps } className = "card--quota" >
343
- < CardContent
344
- amount = "2"
345
- desc = "out of 11 containers not running"
346
- buttonText = "Details"
347
- fullSize
348
- />
349
- </ Card >
190
+ < Card />
350
191
) ) ;
0 commit comments