mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
19b38340ac
* Convert OLModal to named exports only
* Make closeButton the default for OLModalHeader
* Set `closeButton={false}` for modal that is not dismissible
* Fix duplicated imports
* Remove another unnecessary `closeButton` prop
* Fix import
---------
Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>
GitOrigin-RevId: ddd7be6e59a966ac634683d2494d6e9d2c3732e6
31 lines
721 B
TypeScript
31 lines
721 B
TypeScript
import { useState, useCallback } from 'react'
|
|
import LeaveModalContent from './modal-content'
|
|
import { OLModal } from '@/shared/components/ol/ol-modal'
|
|
|
|
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 (
|
|
<OLModal animation show={isOpen} onHide={handleHide} id="leave-modal">
|
|
<LeaveModalContent
|
|
handleHide={handleHide}
|
|
inFlight={inFlight}
|
|
setInFlight={setInFlight}
|
|
/>
|
|
</OLModal>
|
|
)
|
|
}
|
|
|
|
export default LeaveModal
|