|
| 1 | +import type { Meta, StoryFn } from '@storybook/react'; |
| 2 | +import CommentContainer, { CommentContainerProps } from '@dailydotdev/shared/src/components/comments/CommentContainer'; |
| 3 | +import { action } from '@storybook/addon-actions'; |
| 4 | +import { SourceType } from '@dailydotdev/shared/src/graphql/sources'; |
| 5 | +import ExtensionProviders from '../../extension/_providers'; |
| 6 | + |
| 7 | +const meta: Meta<typeof CommentContainer> = { |
| 8 | + title: 'Components/Comments/CommentContainer', |
| 9 | + component: CommentContainer, |
| 10 | + argTypes: { |
| 11 | + className: { control: 'object' }, |
| 12 | + children: { control: 'text' }, |
| 13 | + linkToComment: { control: 'boolean' }, |
| 14 | + showContextHeader: { control: 'boolean' }, |
| 15 | + actions: { control: 'text' }, |
| 16 | + onClick: { action: 'clicked' }, |
| 17 | + }, |
| 18 | +}; |
| 19 | + |
| 20 | +export default meta; |
| 21 | + |
| 22 | +const Template: StoryFn<CommentContainerProps> = (args) => ( |
| 23 | + <ExtensionProviders> |
| 24 | + <CommentContainer {...args} /> |
| 25 | + </ExtensionProviders> |
| 26 | +); |
| 27 | + |
| 28 | +export const Default = Template.bind({}); |
| 29 | +Default.args = { |
| 30 | + post: { |
| 31 | + source: { |
| 32 | + id: 'source-1', |
| 33 | + name: 'Example Source', |
| 34 | + permalink: '/source/example', |
| 35 | + type: SourceType.Squad, |
| 36 | + active: true, |
| 37 | + public: true, |
| 38 | + membersCount: 100, |
| 39 | + description: 'An example squad', |
| 40 | + createdAt: new Date(), |
| 41 | + }, |
| 42 | + title: 'Example Post Title', |
| 43 | + }, |
| 44 | + comment: { |
| 45 | + id: '1', |
| 46 | + author: { |
| 47 | + id: 'author-1', |
| 48 | + username: 'exampleUser', |
| 49 | + name: 'Example User', |
| 50 | + image: '/path/to/image.jpg', |
| 51 | + permalink: '/user/exampleUser', |
| 52 | + isPlus: true, |
| 53 | + companies: [], |
| 54 | + coresRole: 3 |
| 55 | + }, |
| 56 | + award: { |
| 57 | + image: 'https://placehold.it/300x300', |
| 58 | + name: 'award name' |
| 59 | + }, |
| 60 | + contentHtml: '<p>This is an example comment</p>', |
| 61 | + permalink: '/comment/1', |
| 62 | + parent: undefined, |
| 63 | + userState: { awarded: false, vote: 0 }, |
| 64 | + createdAt: new Date().toISOString(), |
| 65 | + numUpvotes: 10, |
| 66 | + numAwards: 2, |
| 67 | + post: { |
| 68 | + title: 'Example Post Title', |
| 69 | + }, |
| 70 | + }, |
| 71 | + commentHash: 'hash-1', |
| 72 | + postAuthorId: 'author-1', |
| 73 | + postScoutId: 'scout-1', |
| 74 | + className: { container: 'example-class' }, |
| 75 | + children: 'This is a child element', |
| 76 | + linkToComment: true, |
| 77 | + showContextHeader: true, |
| 78 | + actions: <button>Action</button>, |
| 79 | + onClick: action('Comment clicked'), |
| 80 | +}; |
0 commit comments