mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-19 12:24:46 +00:00
Reply button changes
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m9s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m9s
This commit is contained in:
parent
09009300cf
commit
327b0e67cd
@ -30,10 +30,14 @@ type ReplyButton = {
|
||||
Comments.ReplyButton = function ReplyButton({comment}: ReplyButton) {
|
||||
const replyContext = useContext(ReplyContext)
|
||||
const commentFormContext = useContext(CommentFormContext)
|
||||
const {data: session} = useSession()
|
||||
|
||||
const handleReplyButton = (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
const handleReplyButton = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||
e.preventDefault()
|
||||
replyContext?.setReplyTo(comment)
|
||||
if (!session) {
|
||||
await loginWithGitHub()
|
||||
}
|
||||
replyContext?.setReplyTo(comment);
|
||||
commentFormContext?.focusCommentForm()
|
||||
}
|
||||
|
||||
@ -71,9 +75,7 @@ Comments.Comment = function Comment({comment, children, isReply = false}: {
|
||||
</p>
|
||||
</div>
|
||||
<p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400 max-w-xl">{comment.content}</p>
|
||||
{session &&
|
||||
<Comments.ReplyButton comment={comment}/>
|
||||
}
|
||||
<Comments.ReplyButton comment={comment}/>
|
||||
</div>
|
||||
</article>
|
||||
{children}
|
||||
|
Loading…
Reference in New Issue
Block a user