overleaf/services/web/frontend/js/features/file-tree/components/modals/file-tree-modal-create-file.js
Alf Eaton be804b5fc1 Merge pull request #3832 from overleaf/ae-modal-beta
* Add BetaBadge component
* Add beta_badge_tooltip translation
* Add beta badge to modal headers
* Enable Share and Add Files modals for beta users

GitOrigin-RevId: df0933830a0745c0ecf57db34f2cb75104a570cd
2021-04-01 02:05:38 +00:00

44 lines
1.4 KiB
JavaScript

import React from 'react'
import { useTranslation } from 'react-i18next'
import { Modal } from 'react-bootstrap'
import { useFileTreeActionable } from '../../contexts/file-tree-actionable'
import FileTreeCreateFormProvider from '../../contexts/file-tree-create-form'
import FileTreeModalCreateFileBody from '../file-tree-create/file-tree-modal-create-file-body'
import FileTreeModalCreateFileFooter from '../file-tree-create/file-tree-modal-create-file-footer'
import AccessibleModal from '../../../../shared/components/accessible-modal'
import BetaBadge from '../../../../shared/components/beta-badge'
export default function FileTreeModalCreateFile() {
const { isCreatingFile, cancel } = useFileTreeActionable()
const { t } = useTranslation()
if (!isCreatingFile) {
return null
}
const tooltip = {
id: 'create-file-beta-tooltip',
text: t('beta_badge_tooltip', { feature: 'adding files' })
}
return (
<FileTreeCreateFormProvider>
<AccessibleModal bsSize="large" onHide={cancel} show>
<Modal.Header closeButton>
<Modal.Title>
Add Files &nbsp;
<BetaBadge tooltip={tooltip} />
</Modal.Title>
</Modal.Header>
<Modal.Body className="modal-new-file">
<FileTreeModalCreateFileBody />
</Modal.Body>
<Modal.Footer>
<FileTreeModalCreateFileFooter />
</Modal.Footer>
</AccessibleModal>
</FileTreeCreateFormProvider>
)
}