mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-06-28 00:20:20 +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,
|
comment: Comment,
|
||||||
children?: ReactNode,
|
|
||||||
isReply?: boolean
|
isReply?: boolean
|
||||||
}) {
|
}) {
|
||||||
const {data: session} = useSession()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<article
|
<article
|
||||||
@ -78,7 +75,6 @@ Comments.Comment = function Comment({comment, children, isReply = false}: {
|
|||||||
<Comments.ReplyButton comment={comment}/>
|
<Comments.ReplyButton comment={comment}/>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{children}
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -96,11 +92,14 @@ Comments.List = function List({comments}: CommentsListProps) {
|
|||||||
Comments
|
Comments
|
||||||
</h3>
|
</h3>
|
||||||
{comments.map((comment) => (
|
{comments.map((comment) => (
|
||||||
<Comments.Comment key={comment.id} comment={comment}>
|
<React.Fragment key={comment.id}>
|
||||||
{comment.replies && comment.replies.map(reply => (
|
<Comments.Comment comment={comment}/>
|
||||||
<Comments.Comment key={reply.id} comment={reply} isReply={true}/>
|
{(typeof comment.replies !== 'undefined' && comment.replies.length > 0) ?
|
||||||
))}
|
comment.replies.map(reply => (
|
||||||
</Comments.Comment>
|
<Comments.Comment key={reply.id} comment={reply} isReply={true}/>
|
||||||
|
)) : null
|
||||||
|
}
|
||||||
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user