feat: open modal authen from the header

:%s
This commit is contained in:
lytrankieio123
2021-08-27 17:50:45 +07:00
parent d228ea0e31
commit f29f675438
7 changed files with 93 additions and 39 deletions

View File

@@ -0,0 +1,23 @@
import { useState } from 'react';
interface Props {
initialValue?: boolean,
}
export const useModalCommon = ({ initialValue = false }: Props) => {
const [visible, setVisible] = useState<boolean>(initialValue)
const openModal = (e?: any) => {
e && e.stopPropagation()
setVisible(true)
}
const closeModal = (e?: any) => {
e && e.stopPropagation()
setVisible(false)
}
return {
visible, openModal, closeModal
}
};