Skip to content

Commit 7209233

Browse files
committed
fix: clerk can't interactive when modal open
1 parent 8873514 commit 7209233

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
"cross-env": "7.0.3",
103103
"dotenv": "16.3.1",
104104
"eslint": "8.56.0",
105-
"husky": "8.0.3",
106105
"lint-staged": "15.2.0",
107106
"postcss": "8.4.32",
108107
"postcss-import": "16.0.0",
@@ -141,4 +140,4 @@
141140
"string.prototype.matchall": "npm:@nolyfill/string.prototype.matchall@latest"
142141
}
143142
}
144-
}
143+
}

src/components/widgets/comment/CommentBox/SignedOutContent.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import { SignInButton } from '@clerk/nextjs'
77
import { UserArrowLeftIcon } from '~/components/icons/user-arrow-left'
88
import { StyledButton } from '~/components/ui/button'
99
import { urlBuilder } from '~/lib/url-builder'
10+
import { useModalStack } from '~/providers/root/modal-stack-provider'
1011

1112
import { CommentBoxMode, setCommentMode } from './hooks'
1213

1314
export function CommentBoxSignedOutContent() {
1415
const pathname = usePathname()
16+
const { dismissAll } = useModalStack()
1517

1618
return (
1719
<div className="flex h-[150px] w-full space-x-4 rounded-lg bg-gray-100/80 center dark:bg-zinc-900/80">
@@ -25,7 +27,13 @@ export function CommentBoxSignedOutContent() {
2527
免登录评论
2628
</StyledButton>
2729
<SignInButton mode="modal" redirectUrl={urlBuilder(pathname).href}>
28-
<StyledButton variant="primary" type="button">
30+
<StyledButton
31+
onClick={() => {
32+
dismissAll()
33+
}}
34+
variant="primary"
35+
type="button"
36+
>
2937
<UserArrowLeftIcon className="mr-1 h-5 w-5" />
3038
登录后才可以留言噢
3139
</StyledButton>

src/styles/clerk.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
.cl-userButtonPopoverCard {
33
@apply border shadow-xl shadow-zinc-500/10 backdrop-blur-xl backdrop-saturate-150;
44
@apply border-zinc-200 bg-zinc-50/80 text-zinc-800;
5-
@apply py-4;
5+
@apply pointer-events-auto py-4;
6+
67
--accent: theme('colors.zinc.900');
78
--accentDark: theme('colors.zinc.800');
89
}

0 commit comments

Comments
 (0)