feat: open modal login/ registe in page account (without login)

:%s
This commit is contained in:
lytrankieio123
2021-09-14 17:21:49 +07:00
parent 9987eda297
commit af93b0ab06
3 changed files with 28 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
import classNames from 'classnames'
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react'
import ModalCommon from '../ModalCommon/ModalCommon'
import FormLogin from './components/FormLogin/FormLogin'
import FormRegister from './components/FormRegister/FormRegister'
@@ -8,11 +8,20 @@ import s from './ModalAuthenticate.module.scss'
interface Props {
visible: boolean,
closeModal: () => void,
mode?: '' | 'register'
}
const ModalAuthenticate = ({ visible, closeModal }: Props) => {
const ModalAuthenticate = ({ visible, mode, closeModal }: Props) => {
const [isLogin, setIsLogin] = useState<boolean>(true)
useEffect(() => {
if (mode === 'register') {
setIsLogin(false)
} else {
setIsLogin(true)
}
}, [mode])
const onSwitch = () => {
setIsLogin(!isLogin)
}