mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
9daa8f5d98
[web] rename all the JSX files to .jsx/.tsx GitOrigin-RevId: 82056ae47e017523722cf258dcc83c8a925a28f7
60 lines
1.5 KiB
JavaScript
60 lines
1.5 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,
|
|
projectTags,
|
|
}) {
|
|
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}
|
|
projectTags={projectTags}
|
|
/>
|
|
</AccessibleModal>
|
|
)
|
|
}
|
|
|
|
CloneProjectModal.propTypes = {
|
|
handleHide: PropTypes.func.isRequired,
|
|
show: PropTypes.bool.isRequired,
|
|
handleAfterCloned: PropTypes.func.isRequired,
|
|
projectId: PropTypes.string,
|
|
projectName: PropTypes.string,
|
|
projectTags: PropTypes.arrayOf(
|
|
PropTypes.shape({
|
|
_id: PropTypes.string.isRequired,
|
|
name: PropTypes.string.isRequired,
|
|
color: PropTypes.string,
|
|
})
|
|
),
|
|
}
|
|
|
|
export default memo(CloneProjectModal)
|