mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 07:15:25 -05:00
d905863002
Create a generic ErrorBoundaryFallback component GitOrigin-RevId: 0c9200ddef2be3b90030a32eb8c36a59047cf2b4
28 lines
799 B
TypeScript
28 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 }
|
|
}
|