mirror of
https://github.com/vercel/commerce.git
synced 2025-07-24 10:41:23 +00:00
✨ feat: open modal login/ registe in page account (without login)
:%s
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user