|
1 | 1 | import React from 'react'
|
2 | 2 | import { storiesOf } from '@storybook/react'
|
3 | 3 | import { Example } from '@auth0/cosmos/_helpers/story-helpers'
|
4 |
| -import { Avatar, Table, EmptyState } from '@auth0/cosmos' |
| 4 | +import { Avatar, AvatarBlock, Table, EmptyState, Button } from '@auth0/cosmos' |
5 | 5 |
|
6 | 6 | const items = [
|
7 | 7 | {
|
@@ -181,7 +181,7 @@ storiesOf('Table').add('with no items', () => (
|
181 | 181 | action={{
|
182 | 182 | icon: 'plus',
|
183 | 183 | label: 'Create one manually',
|
184 |
| - handler: function () { |
| 184 | + handler: function() { |
185 | 185 | /*...*/
|
186 | 186 | }
|
187 | 187 | }}
|
@@ -264,3 +264,50 @@ storiesOf('Table').add('loading state without data', () => (
|
264 | 264 | </Table>
|
265 | 265 | </Example>
|
266 | 266 | ))
|
| 267 | + |
| 268 | +storiesOf('Table').add('with buttons', () => ( |
| 269 | + <Example title="with buttons"> |
| 270 | + <Table |
| 271 | + items={[ |
| 272 | + { |
| 273 | + name: 'Harry Kane', |
| 274 | + goals: 6, |
| 275 | + assists: 0, |
| 276 | + country: '🇬🇧', |
| 277 | + image: 'https://twitter-avatar.now.sh/HKane' |
| 278 | + }, |
| 279 | + { |
| 280 | + name: 'Romelu Lukaku', |
| 281 | + goals: 4, |
| 282 | + assists: 1, |
| 283 | + country: '🇧🇪', |
| 284 | + image: 'https://twitter-avatar.now.sh/Romelu_lukaku9' |
| 285 | + }, |
| 286 | + { |
| 287 | + name: 'Antoine Griezmann', |
| 288 | + goals: 4, |
| 289 | + assists: 2, |
| 290 | + country: '🇫🇷', |
| 291 | + image: 'https://twitter-avatar.now.sh/AntoGriezmann' |
| 292 | + }, |
| 293 | + { |
| 294 | + name: 'Ivan Perišić', |
| 295 | + goals: 3, |
| 296 | + assists: 1, |
| 297 | + country: '🇭🇷', |
| 298 | + image: 'https://twitter-avatar.now.sh/ivanperisic44' |
| 299 | + } |
| 300 | + ]} |
| 301 | + onRowClick={(evt, item) => alert(`${item.name} was clicked!`)} |
| 302 | + > |
| 303 | + <Table.Column field="name" title="Name" width="30%"> |
| 304 | + {item => <AvatarBlock type="user" image={item.image} title={item.name} size="compact" />} |
| 305 | + </Table.Column> |
| 306 | + <Table.Column field="country" title="Country" /> |
| 307 | + <Table.Column field="goals" title="Goals" /> |
| 308 | + <Table.Column field="assists" title="Assists" width="5%"> |
| 309 | + {item => <Button appearance="default" icon="emails" href="https://auth0.com" />} |
| 310 | + </Table.Column> |
| 311 | + </Table> |
| 312 | + </Example> |
| 313 | +)) |
0 commit comments