-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthenticationModal.tsx
More file actions
94 lines (89 loc) · 2.58 KB
/
AuthenticationModal.tsx
File metadata and controls
94 lines (89 loc) · 2.58 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import { Text, Modal } from "../atomic";
import Login from "./Login";
import Signup from "./Signup";
type AuthenticationModalProps = {
isOpen: boolean;
onClose: () => void;
programName?: string;
};
const AuthenticationModal = ({
isOpen,
onClose,
programName = "",
}: AuthenticationModalProps) => {
const [isLogin, setIsLogin] = useState(false);
const router = useRouter();
useEffect(() => {
if (isOpen) {
setIsLogin(false);
}
}, [isOpen]);
return (
<Modal isOpen={isOpen} onClose={onClose}>
<div className="flex flex-col w-144">
<button
onClick={onClose}
className="cursor-pointer focus:outline-none self-end"
>
<img src="/static/Close.svg" className="h-4 w-4" />
</button>
{isLogin ? (
<div>
<div className="flex flex-col space-y-1">
{programName ? (
<Text h3>
Login to join <Text b>{programName}</Text>
</Text>
) : (
<Text h3 b>
Login to access the Mentor Center
</Text>
)}
<Text>
Don't have a <Text>Mentor Center </Text>account?{" "}
<button onClick={() => setIsLogin(false)}>
<Text u>Sign up now</Text>
</button>
</Text>
</div>
<div className="h-6" />
<Login />
</div>
) : (
<div>
<div className="flex flex-col">
{programName ? (
<Text h3>
Create an account to join <Text b>{programName}</Text>
</Text>
) : (
<Text h3 b>
Create an account to access the Mentor Center
</Text>
)}
<Text>
Already have a <Text>Mentor Center </Text>account?{" "}
<button onClick={() => setIsLogin(true)}>
<Text u>Login</Text>
</button>
</Text>
</div>
<div className="h-6" />
<Signup
onSuccessfulGoogleSignup={onClose}
onSuccessfulEmailSignup={() => {
router.push({
pathname: "/verify",
query: { to: router.asPath },
});
}}
/>
</div>
)}
</div>
</Modal>
);
};
export default AuthenticationModal;