mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 16:05:10 -05:00
e855b96953
GitOrigin-RevId: 9e9f24aed6442a892ed95c1ee598fc82ec931a1b
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
import React, { memo, useCallback, useState } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import CloneProjectModalContent from './clone-project-modal-content'
|
|
import AccessibleModal from '../../../shared/components/accessible-modal'
|
|
|
|
function CloneProjectModal({
|
|
show,
|
|
handleHide,
|
|
handleAfterCloned,
|
|
projectId,
|
|
projectName,
|
|
}) {
|
|
const [inFlight, setInFlight] = useState(false)
|
|
|
|
const onHide = useCallback(() => {
|
|
if (!inFlight) {
|
|
handleHide()
|
|
}
|
|
}, [handleHide, inFlight])
|
|
|
|
return (
|
|
<AccessibleModal
|
|
animation
|
|
show={show}
|
|
onHide={onHide}
|
|
id="clone-project-modal"
|
|
// backdrop="static" will disable closing the modal by clicking
|
|
// outside of the modal element
|
|
backdrop={inFlight ? 'static' : undefined}
|
|
>
|
|
<CloneProjectModalContent
|
|
handleHide={onHide}
|
|
inFlight={inFlight}
|
|
setInFlight={setInFlight}
|
|
handleAfterCloned={handleAfterCloned}
|
|
projectId={projectId}
|
|
projectName={projectName}
|
|
/>
|
|
</AccessibleModal>
|
|
)
|
|
}
|
|
|
|
CloneProjectModal.propTypes = {
|
|
handleHide: PropTypes.func.isRequired,
|
|
show: PropTypes.bool.isRequired,
|
|
handleAfterCloned: PropTypes.func.isRequired,
|
|
projectId: PropTypes.string,
|
|
projectName: PropTypes.string,
|
|
}
|
|
|
|
export default memo(CloneProjectModal)
|