diff --git a/packages/shared/src/components/comments/CommentContainer.tsx b/packages/shared/src/components/comments/CommentContainer.tsx index 430c54d4465..6b3630967a4 100644 --- a/packages/shared/src/components/comments/CommentContainer.tsx +++ b/packages/shared/src/components/comments/CommentContainer.tsx @@ -21,8 +21,8 @@ import { VerifiedCompanyUserBadge } from '../VerifiedCompanyUserBadge'; import { Separator } from '../cards/common/common'; import { PlusUserBadge } from '../PlusUserBadge'; import { ProfileImageSize } from '../ProfilePicture'; -import { Image } from '../image/Image'; import { useHasAccessToCores } from '../../hooks/useCoresFeature'; +import { Image } from '../image/Image'; interface ClassName extends CommentClassName { content?: string; @@ -124,7 +124,7 @@ export default function CommentContainer({ {!!comment.author?.isPlus && ( )} -
+
+
+
@@ -149,6 +151,15 @@ export default function CommentContainer({ {comment.author.id === postScoutId && Scout}
+ {hasAccessToCores && !!comment.award && ( +
+ {comment.award.name} +
+ )}
{actions}
- {hasAccessToCores && !!comment.award && ( -
- {comment.award.name} -
- )} ); } diff --git a/packages/storybook/stories/components/comments/CommentContainer.stories.tsx b/packages/storybook/stories/components/comments/CommentContainer.stories.tsx new file mode 100644 index 00000000000..0784559ff99 --- /dev/null +++ b/packages/storybook/stories/components/comments/CommentContainer.stories.tsx @@ -0,0 +1,80 @@ +import type { Meta, StoryFn } from '@storybook/react'; +import CommentContainer, { CommentContainerProps } from '@dailydotdev/shared/src/components/comments/CommentContainer'; +import { action } from '@storybook/addon-actions'; +import { SourceType } from '@dailydotdev/shared/src/graphql/sources'; +import ExtensionProviders from '../../extension/_providers'; + +const meta: Meta = { + title: 'Components/Comments/CommentContainer', + component: CommentContainer, + argTypes: { + className: { control: 'object' }, + children: { control: 'text' }, + linkToComment: { control: 'boolean' }, + showContextHeader: { control: 'boolean' }, + actions: { control: 'text' }, + onClick: { action: 'clicked' }, + }, +}; + +export default meta; + +const Template: StoryFn = (args) => ( + + + +); + +export const Default = Template.bind({}); +Default.args = { + post: { + source: { + id: 'source-1', + name: 'Example Source', + permalink: '/source/example', + type: SourceType.Squad, + active: true, + public: true, + membersCount: 100, + description: 'An example squad', + createdAt: new Date(), + }, + title: 'Example Post Title', + }, + comment: { + id: '1', + author: { + id: 'author-1', + username: 'exampleUser', + name: 'Example User', + image: '/path/to/image.jpg', + permalink: '/user/exampleUser', + isPlus: true, + companies: [], + coresRole: 3 + }, + award: { + image: 'https://placehold.it/300x300', + name: 'award name' + }, + contentHtml: '

This is an example comment

', + permalink: '/comment/1', + parent: undefined, + userState: { awarded: false, vote: 0 }, + createdAt: new Date().toISOString(), + numUpvotes: 10, + numAwards: 2, + post: { + title: 'Example Post Title', + }, + }, + commentHash: 'hash-1', + postAuthorId: 'author-1', + postScoutId: 'scout-1', + className: { container: 'example-class' }, + children: 'This is a child element', + linkToComment: true, + showContextHeader: true, + actions: , + onClick: action('Comment clicked'), +};