mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 09:27:42 -05:00
37 lines
809 B
TypeScript
37 lines
809 B
TypeScript
|
import { useState, useCallback } from 'react'
|
||
|
import AccessibleModal from '../../../../shared/components/accessible-modal'
|
||
|
import LeaveModalContent from './modal-content'
|
||
|
|
||
|
type LeaveModalProps = {
|
||
|
isOpen: boolean
|
||
|
handleClose: () => void
|
||
|
}
|
||
|
|
||
|
function LeaveModal({ isOpen, handleClose }: LeaveModalProps) {
|
||
|
const [inFlight, setInFlight] = useState(false)
|
||
|
|
||
|
const handleHide = useCallback(() => {
|
||
|
if (!inFlight) {
|
||
|
handleClose()
|
||
|
}
|
||
|
}, [handleClose, inFlight])
|
||
|
|
||
|
return (
|
||
|
<AccessibleModal
|
||
|
animation
|
||
|
show={isOpen}
|
||
|
onHide={handleHide}
|
||
|
id="leave-modal"
|
||
|
backdrop="static"
|
||
|
>
|
||
|
<LeaveModalContent
|
||
|
handleHide={handleHide}
|
||
|
inFlight={inFlight}
|
||
|
setInFlight={setInFlight}
|
||
|
/>
|
||
|
</AccessibleModal>
|
||
|
)
|
||
|
}
|
||
|
|
||
|
export default LeaveModal
|