-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathauth-choice-modal.tsx
72 lines (67 loc) · 2.29 KB
/
auth-choice-modal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
'use client';
import { Dialog, DialogContent, DialogTitle } from '@/components/ui/dialog';
import { BackgroundGradient } from '@/components/ui/background-gradient';
import { Button } from '@/components/ui/button';
import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
interface AuthChoiceModalProps {
isOpen: boolean;
onClose: () => void;
onSignUpClick: () => void;
onSignInClick: () => void;
}
export function AuthChoiceModal({
isOpen,
onClose,
onSignUpClick,
onSignInClick,
}: AuthChoiceModalProps) {
return (
<Dialog open={isOpen} onOpenChange={onClose}>
<DialogContent className="sm:max-w-[425px] fixed top-[50%] left-[50%] transform -translate-x-[50%] -translate-y-[50%]">
{/* Invisible but accessible DialogTitle */}
<VisuallyHidden>
<DialogTitle>Choose Authentication Method</DialogTitle>
</VisuallyHidden>
<BackgroundGradient className="rounded-[22px] p-4 bg-white dark:bg-zinc-900">
<div className="w-full p-6 space-y-6">
<h2 className="text-2xl font-semibold text-center dark:text-white">
Welcome to CodeFox
</h2>
<p className="text-center text-neutral-600 dark:text-neutral-400">
Choose how you want to continue
</p>
<div className="space-y-4">
{/* Sign In button */}
<Button
className="w-full py-6 text-lg bg-primary hover:bg-primary/90"
onClick={() => {
// 1) Close current modal
onClose();
// 2) After a brief delay, call onSignInClick
setTimeout(() => {
onSignInClick();
}, 100);
}}
>
Sign in
</Button>
{/* Sign Up button */}
<Button
variant="outline"
className="w-full py-6 text-lg"
onClick={() => {
onClose();
setTimeout(() => {
onSignUpClick();
}, 100);
}}
>
Create an account
</Button>
</div>
</div>
</BackgroundGradient>
</DialogContent>
</Dialog>
);
}