overleaf/services/web/frontend/js/features/clone-project-modal/components/clone-project-modal.jsx
ilkin-overleaf c3ed95bc48 Merge pull request #19027 from overleaf/ii-bs5-projects-list-table
[web] BS5 projects table migration

GitOrigin-RevId: 237bd8113c68d7fd1b66712f7361eb956b1e10e7
2024-07-15 09:03:45 +00:00

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 OLModal from '@/features/ui/components/ol/ol-modal'
function CloneProjectModal({
show,
handleHide,
handleAfterCloned,
projectId,
projectName,
projectTags,
}) {
const [inFlight, setInFlight] = useState(false)
const onHide = useCallback(() => {
if (!inFlight) {
handleHide()
}
}, [handleHide, inFlight])
return (
<OLModal
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}
/>
</OLModal>
)
}
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)