mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-21 23:54:37 +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) {
|
Comments.ReplyButton = function ReplyButton({comment}: ReplyButton) {
|
||||||
const replyContext = useContext(ReplyContext)
|
const replyContext = useContext(ReplyContext)
|
||||||
const commentFormContext = useContext(CommentFormContext)
|
const commentFormContext = useContext(CommentFormContext)
|
||||||
|
const {data: session} = useSession()
|
||||||
|
|
||||||
const handleReplyButton = (e: React.MouseEvent<HTMLButtonElement>) => {
|
const handleReplyButton = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
replyContext?.setReplyTo(comment)
|
if (!session) {
|
||||||
|
await loginWithGitHub()
|
||||||
|
}
|
||||||
|
replyContext?.setReplyTo(comment);
|
||||||
commentFormContext?.focusCommentForm()
|
commentFormContext?.focusCommentForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,9 +75,7 @@ Comments.Comment = function Comment({comment, children, isReply = false}: {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400 max-w-xl">{comment.content}</p>
|
<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>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{children}
|
{children}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user