mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
29 lines
799 B
TypeScript
29 lines
799 B
TypeScript
|
import importOverleafModules from '../../../macros/import-overleaf-module.macro'
|
||
|
import { JSXElementConstructor, useCallback, useState } from 'react'
|
||
|
|
||
|
const [contactUsModalModules] = importOverleafModules('contactUsModal')
|
||
|
const ContactUsModal: JSXElementConstructor<{
|
||
|
show: boolean
|
||
|
handleHide: () => void
|
||
|
}> = contactUsModalModules?.import.default
|
||
|
|
||
|
export const useContactUsModal = () => {
|
||
|
const [show, setShow] = useState(false)
|
||
|
|
||
|
const hideModal = useCallback((event?: Event) => {
|
||
|
event?.preventDefault()
|
||
|
setShow(false)
|
||
|
}, [])
|
||
|
|
||
|
const showModal = useCallback((event?: Event) => {
|
||
|
event?.preventDefault()
|
||
|
setShow(true)
|
||
|
}, [])
|
||
|
|
||
|
const modal = ContactUsModal && (
|
||
|
<ContactUsModal show={show} handleHide={hideModal} />
|
||
|
)
|
||
|
|
||
|
return { modal, hideModal, showModal }
|
||
|
}
|