Skip to content
This repository was archived by the owner on May 17, 2023. It is now read-only.

Commit 0015c15

Browse files
authored
add tests for #1164 (#1180)
1 parent 05bf773 commit 0015c15

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

core/components/atoms/button/stories/icon.story.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ storiesOf('Button').add('with icon', () => (
1515
</Button>
1616
<Button appearance="link" icon="copy" />
1717
<Button icon="copy" label="Copy to Clipboard" />
18+
<Button icon="copy" href="https://auth0.com" label="Copy to Clipboard" />
1819
<Button icon="chevron-left">Previous page</Button>
1920
<Button iconAlign="right" icon="chevron-right">
2021
Next page

core/components/molecules/table/table.story.js

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { storiesOf } from '@storybook/react'
33
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'
55

66
const items = [
77
{
@@ -181,7 +181,7 @@ storiesOf('Table').add('with no items', () => (
181181
action={{
182182
icon: 'plus',
183183
label: 'Create one manually',
184-
handler: function () {
184+
handler: function() {
185185
/*...*/
186186
}
187187
}}
@@ -264,3 +264,50 @@ storiesOf('Table').add('loading state without data', () => (
264264
</Table>
265265
</Example>
266266
))
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

Comments
 (0)