diff --git a/packages/components/src/ButtonShowReplies/ButtonShowReplies.stories.tsx b/packages/components/src/ButtonShowReplies/ButtonShowReplies.stories.tsx index 38308b6cd9..3a2a8a5ed8 100644 --- a/packages/components/src/ButtonShowReplies/ButtonShowReplies.stories.tsx +++ b/packages/components/src/ButtonShowReplies/ButtonShowReplies.stories.tsx @@ -70,7 +70,7 @@ export const NoCreatorName: StoryFn = () => { creatorName={null} isShowReplies={false} replies={replies} - setIsShowReplies={mockSetIsShowReplies} + setIsShowReplies={() => null} /> ) } diff --git a/packages/components/src/CommentItem/CommentItem.stories.tsx b/packages/components/src/CommentItem/CommentItem.stories.tsx index 17873475f9..41528a722a 100644 --- a/packages/components/src/CommentItem/CommentItem.stories.tsx +++ b/packages/components/src/CommentItem/CommentItem.stories.tsx @@ -10,35 +10,74 @@ export default { component: CommentItem, } as Meta +const handleEdit = () => { + return +} + export const Default: StoryFn = () => { const comment = fakeComment({ creatorImage: faker.image.avatar() }) - return + return ( + + ) } export const WithoutAvatar: StoryFn = () => { const comment = fakeComment() - return + return ( + + ) } export const Editable: StoryFn = () => { const comment = fakeComment({ isEditable: true }) - return + return ( + + ) } export const Edited: StoryFn = () => { const comment = fakeComment({ _edited: new Date().toISOString() }) - return + return ( + + ) } export const LongText: StoryFn = () => { const text = `Ut dignissim, odio a cursus pretium, erat ex dictum quam, a eleifend augue mauris vel metus. Suspendisse pellentesque, elit efficitur rutrum maximus, arcu enim congue ipsum, vel aliquam ipsum urna quis tellus. Mauris at imperdiet nisi. Integer at neque ex. Nullam vel ipsum sodales, porttitor nulla vitae, tincidunt est. Pellentesque vitae lectus arcu. Integer dapibus rutrum facilisis. Nullam tincidunt quam at arcu interdum, vitae egestas libero vehicula. Morbi metus tortor, dapibus id finibus ac, egestas quis leo. Phasellus scelerisque suscipit mauris sed rhoncus. In quis ultricies ipsum. Integer vitae iaculis risus, sit amet elementum augue. Pellentesque vitae sagittis erat, eget consectetur lorem.\n\nUt pharetra molestie quam id dictum. In molestie, arcu sit amet faucibus pulvinar, eros erat egestas leo, at molestie nunc velit a arcu. Aliquam erat volutpat. Vivamus vehicula mi sit amet nibh auctor efficitur. Duis fermentum sem et nibh facilisis, ut tincidunt sem commodo. Nullam ornare ex a elementum accumsan. Etiam a neque ut lacus suscipit blandit. Maecenas id tortor velit.\n\nInterdum et malesuada fames ac ante ipsum primis in faucibus. Nam ut commodo tellus. Maecenas at leo metus. Vivamus ullamcorper ex purus, volutpat auctor nunc lobortis a. Integer sit amet ornare nisi, sed ultrices enim. Pellentesque ut aliquam urna, eu fringilla ante. Nullam dui nibh, feugiat id vestibulum nec, efficitur a lorem. In vitae pellentesque tellus. Pellentesque sed odio iaculis, imperdiet turpis at, aliquam ex. Praesent iaculis bibendum nibh, vel egestas turpis ultrices ac. Praesent tincidunt libero sed gravida ornare. Aliquam vehicula risus ut molestie suscipit. Nunc erat odio, venenatis nec posuere in, placerat eget massa. Sed in ultrices ex, vel egestas quam. Integer lectus magna, ornare at nisl sed, convallis euismod enim. Cras pretium commodo arcu non bibendum.\n\nNullam dictum lectus felis. Duis vitae lacus vitae nisl aliquet faucibus. Integer neque lacus, dignissim sed mi et, dignissim luctus metus. Cras sollicitudin vestibulum leo, ac ultrices sapien bibendum ac. Phasellus lobortis aliquam libero eu volutpat. Donec vitae rutrum tellus. Fusce vel ante ipsum. Suspendisse mollis tempus porta. Sed a orci tempor, rhoncus tortor eu, sodales justo.` const comment = fakeComment({ text }) - return + return ( + + ) } export const ShortTextWithLink: StoryFn = () => { @@ -46,5 +85,12 @@ export const ShortTextWithLink: StoryFn = () => { text: `Ut dignissim, odio a cursus pretium. https://example.com`, }) - return + return ( + + ) } diff --git a/packages/components/src/CommentItem/CommentItem.tsx b/packages/components/src/CommentItem/CommentItem.tsx index 4b9b02706a..75dab9a70c 100644 --- a/packages/components/src/CommentItem/CommentItem.tsx +++ b/packages/components/src/CommentItem/CommentItem.tsx @@ -16,7 +16,7 @@ const DELETED_COMMENT = 'The original comment got deleted' export interface IProps { comment: IComment handleDelete?: (commentId: string) => Promise - handleEdit?: (commentId: string, newCommentText: string) => void + handleEdit: (commentId: string, newCommentText: string) => void handleEditRequest?: (commentId: string) => Promise isReply: boolean showAvatar: boolean @@ -66,6 +66,7 @@ export const CommentItem = (props: IProps) => { const date = formatDate(_edited || _created) const maxHeight = isShowMore ? 'max-content' : '128px' + const item = isReply ? 'ReplyItem' : 'CommentItem' useEffect(() => { if (textRef.current) { @@ -85,14 +86,10 @@ export const CommentItem = (props: IProps) => { } return ( - + {_deleted && ( - + [{DELETED_COMMENT}] )} @@ -151,7 +148,7 @@ export const CommentItem = (props: IProps) => { }} >