modal.tsx 791 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { useState, useCallback } from 'react'
  2. import LeaveModalContent from './modal-content'
  3. import OLModal from '@/features/ui/components/ol/ol-modal'
  4. type LeaveModalProps = {
  5. isOpen: boolean
  6. handleClose: () => void
  7. }
  8. function LeaveModal({ isOpen, handleClose }: LeaveModalProps) {
  9. const [inFlight, setInFlight] = useState(false)
  10. const handleHide = useCallback(() => {
  11. if (!inFlight) {
  12. handleClose()
  13. }
  14. }, [handleClose, inFlight])
  15. return (
  16. <OLModal
  17. animation
  18. show={isOpen}
  19. onHide={handleHide}
  20. id="leave-modal"
  21. bs3Props={{ backdrop: 'static' }}
  22. >
  23. <LeaveModalContent
  24. handleHide={handleHide}
  25. inFlight={inFlight}
  26. setInFlight={setInFlight}
  27. />
  28. </OLModal>
  29. )
  30. }
  31. export default LeaveModal