mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-19 12:24:46 +00:00
Update comments component
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m14s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m14s
This commit is contained in:
parent
327b0e67cd
commit
e2387beaa3
@ -52,13 +52,10 @@ Comments.ReplyButton = function ReplyButton({comment}: ReplyButton) {
|
||||
)
|
||||
}
|
||||
|
||||
Comments.Comment = function Comment({comment, children, isReply = false}: {
|
||||
Comments.Comment = function Comment({comment, isReply = false}: {
|
||||
comment: Comment,
|
||||
children?: ReactNode,
|
||||
isReply?: boolean
|
||||
}) {
|
||||
const {data: session} = useSession()
|
||||
|
||||
return (
|
||||
<>
|
||||
<article
|
||||
@ -78,7 +75,6 @@ Comments.Comment = function Comment({comment, children, isReply = false}: {
|
||||
<Comments.ReplyButton comment={comment}/>
|
||||
</div>
|
||||
</article>
|
||||
{children}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -96,11 +92,14 @@ Comments.List = function List({comments}: CommentsListProps) {
|
||||
Comments
|
||||
</h3>
|
||||
{comments.map((comment) => (
|
||||
<Comments.Comment key={comment.id} comment={comment}>
|
||||
{comment.replies && comment.replies.map(reply => (
|
||||
<React.Fragment key={comment.id}>
|
||||
<Comments.Comment comment={comment}/>
|
||||
{(typeof comment.replies !== 'undefined' && comment.replies.length > 0) ?
|
||||
comment.replies.map(reply => (
|
||||
<Comments.Comment key={reply.id} comment={reply} isReply={true}/>
|
||||
))}
|
||||
</Comments.Comment>
|
||||
)) : null
|
||||
}
|
||||
</React.Fragment>
|
||||
))}
|
||||
</section>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user