Show placeholder when initial comment of thread is deleted

This commit is contained in:
Junyoung Choi 2022-03-02 15:45:20 +09:00 committed by Junyoung Choi
parent 9ff1273e96
commit 9efe6d85aa
2 changed files with 18 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import CommentReactions from './CommentReactions'
import EmojiPickHandler from './EmojiPickHandler'
interface CommentThreadProps {
initialComment?: Comment
comments: Comment[]
className: string
updateComment: (comment: Comment, message: string) => Promise<any>
@ -30,6 +31,7 @@ interface CommentThreadProps {
}
function CommentList({
initialComment,
comments,
className,
updateComment,
@ -44,7 +46,12 @@ function CommentList({
}, [comments])
return (
<div className={className}>
<CommentListContainer className={className}>
{initialComment == null && (
<div className={'deleted_initial_comment'}>
This comment has been deleted.
</div>
)}
{sorted.map((comment) => (
<div key={comment.id}>
<CommentItem
@ -59,10 +66,17 @@ function CommentList({
/>
</div>
))}
</div>
</CommentListContainer>
)
}
const CommentListContainer = styled.div`
.deleted_initial_comment {
margin: ${({ theme }) => theme.sizes.spaces.xsm}px 0;
color: ${({ theme }) => theme.colors.text.subtle};
}
`
interface CommentItemProps {
comment: Comment
updateComment: (comment: Comment, message: string) => Promise<any>

View File

@ -162,7 +162,9 @@ function CommentManager({
</Button>
<div className='thread__context'>{state.thread.context}</div>
<CommentList
initialComment={state.thread.initialComment}
comments={state.comments}
className='comment__list'
updateComment={updateComment}