modal.tsx 809 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { useState, useCallback } from 'react'
  2. import AccessibleModal from '../../../../shared/components/accessible-modal'
  3. import LeaveModalContent from './modal-content'
  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. <AccessibleModal
  17. animation
  18. show={isOpen}
  19. onHide={handleHide}
  20. id="leave-modal"
  21. backdrop="static"
  22. >
  23. <LeaveModalContent
  24. handleHide={handleHide}
  25. inFlight={inFlight}
  26. setInFlight={setInFlight}
  27. />
  28. </AccessibleModal>
  29. )
  30. }
  31. export default LeaveModal