-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve stories for attachemment table
- Loading branch information
1 parent
80b5246
commit 5e1344c
Showing
1 changed file
with
62 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,80 @@ | ||
import { action } from '@storybook/addon-actions'; | ||
import React from 'react'; | ||
import { | ||
AttachableEntity, | ||
AttachmentAction, | ||
AttachmentOperation, | ||
} from '../src/lib/organisms/attachments/AttachmentTypes'; | ||
import { | ||
AttachmentProvider, | ||
AttachmentTable, | ||
useAttachmentOperations, | ||
} from '../src/lib/organisms/attachments/AttachmentTable'; | ||
|
||
import { Box } from '../src/lib/next'; | ||
import { useTheme } from 'styled-components'; | ||
import { CoreUITheme } from '../src/lib/style/theme'; | ||
|
||
export default { | ||
title: 'Components/AttachmentTable', | ||
component: AttachmentTable, | ||
decorators: [ | ||
(Story) => ( | ||
<AttachmentProvider> | ||
<Story /> | ||
</AttachmentProvider> | ||
), | ||
], | ||
render: ({ args }) => { | ||
}; | ||
|
||
export const Playground = { | ||
render: () => { | ||
const theme = useTheme(); | ||
return ( | ||
<AttachmentTable | ||
entityName={{ plural: 'groups', singular: 'group' }} | ||
filteredEntities={{ | ||
status: 'success', | ||
data: { | ||
number: 1, | ||
entities: [{ name: 'test', id: 'test', type: 'GROUP' }], | ||
}, | ||
}} | ||
initialAttachmentOperations={[]} | ||
onEntitySearchChange={action('onEntitySearchChange')} | ||
searchEntityPlaceholder="Search group by name" | ||
initiallyAttachedEntities={[ | ||
{ name: 'test', id: 'test', type: 'GROUP' }, | ||
]} | ||
initiallyAttachedEntitiesStatus={'success'} | ||
onAttachmentsOperationsChanged={() => { | ||
console.log('changed'); | ||
}} | ||
/> | ||
<Box | ||
style={{ height: '100%', backgroundColor: theme.backgroundLevel4 }} | ||
p={'2rem'} | ||
> | ||
<AttachmentProvider> | ||
<AttachmentTable | ||
entityName={{ plural: 'users', singular: 'user' }} | ||
filteredEntities={{ | ||
status: 'success', | ||
data: { | ||
number: 1, | ||
entities: [{ name: 'User A', id: 'test', type: 'USER' }], | ||
}, | ||
}} | ||
initialAttachmentOperations={[]} | ||
onEntitySearchChange={action('onEntitySearchChange')} | ||
searchEntityPlaceholder="Search user by name" | ||
initiallyAttachedEntities={[ | ||
{ name: 'User A', id: 'test', type: 'USER' }, | ||
]} | ||
initiallyAttachedEntitiesStatus={'success'} | ||
onAttachmentsOperationsChanged={() => { | ||
console.log('changed'); | ||
}} | ||
/> | ||
</AttachmentProvider> | ||
</Box> | ||
); | ||
}, | ||
}; | ||
|
||
export const Playground = { | ||
args: { | ||
label: 'Playground', | ||
export const FailToLoad = { | ||
render: () => { | ||
const theme = useTheme(); | ||
return ( | ||
<Box | ||
style={{ height: '100%', backgroundColor: theme.backgroundLevel4 }} | ||
p={'2rem'} | ||
> | ||
<AttachmentProvider> | ||
<AttachmentTable | ||
entityName={{ plural: 'users', singular: 'user' }} | ||
filteredEntities={{ | ||
status: 'error', | ||
}} | ||
initialAttachmentOperations={[]} | ||
onEntitySearchChange={action('onEntitySearchChange')} | ||
searchEntityPlaceholder="Search user by name" | ||
initiallyAttachedEntities={[]} | ||
initiallyAttachedEntitiesStatus={'error'} | ||
onAttachmentsOperationsChanged={() => { | ||
console.log('changed'); | ||
}} | ||
/> | ||
</AttachmentProvider> | ||
</Box> | ||
); | ||
}, | ||
}; |