11import { useRouter } from "next/router" ;
2- import React , { useState } from "react" ;
2+ import React , { useEffect , useState } from "react" ;
33import { Text , Modal } from "../atomic" ;
44import Login from "./Login" ;
55import Signup from "./Signup" ;
@@ -18,16 +18,17 @@ const AuthenticationModal = ({
1818 const [ isLogin , setIsLogin ] = useState ( false ) ;
1919 const router = useRouter ( ) ;
2020
21- const reset = ( ) => {
22- setIsLogin ( false ) ;
23- onClose ( ) ;
24- }
21+ useEffect ( ( ) => {
22+ if ( isOpen ) {
23+ setIsLogin ( false ) ;
24+ }
25+ } , [ isOpen ] ) ;
2526
2627 return (
27- < Modal isOpen = { isOpen } onClose = { reset } >
28+ < Modal isOpen = { isOpen } onClose = { onClose } >
2829 < div className = "flex flex-col w-144" >
2930 < button
30- onClick = { reset }
31+ onClick = { onClose }
3132 className = "cursor-pointer focus:outline-none self-end"
3233 >
3334 < img src = "/static/Close.svg" className = "h-4 w-4" />
@@ -36,8 +37,8 @@ const AuthenticationModal = ({
3637 < div >
3738 < div className = "flex flex-col space-y-1" >
3839 { programName ? (
39- < Text h3 b >
40- Login to join < Text i > { programName } </ Text >
40+ < Text h3 >
41+ Login to join < Text b > { programName } </ Text >
4142 </ Text >
4243 ) : (
4344 < Text h3 b >
@@ -58,8 +59,8 @@ const AuthenticationModal = ({
5859 < div >
5960 < div className = "flex flex-col" >
6061 { programName ? (
61- < Text h3 b >
62- Create an account to join < Text i > { programName } </ Text >
62+ < Text h3 >
63+ Create an account to join < Text b > { programName } </ Text >
6364 </ Text >
6465 ) : (
6566 < Text h3 b >
@@ -75,9 +76,7 @@ const AuthenticationModal = ({
7576 </ div >
7677 < div className = "h-6" />
7778 < Signup
78- onSuccessfulGoogleSignup = { ( ) => {
79- location . reload ( ) ;
80- } }
79+ onSuccessfulGoogleSignup = { onClose }
8180 onSuccessfulEmailSignup = { ( ) => {
8281 router . push ( {
8382 pathname : "/verify" ,
0 commit comments