mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 08:37:33 -05:00
9daa8f5d98
[web] rename all the JSX files to .jsx/.tsx GitOrigin-RevId: 82056ae47e017523722cf258dcc83c8a925a28f7
36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
import classnames from 'classnames'
|
|
import { Button } from 'react-bootstrap'
|
|
import PropTypes from 'prop-types'
|
|
import Icon from '../../../../shared/components/icon'
|
|
import { useFileTreeActionable } from '../../contexts/file-tree-actionable'
|
|
import * as eventTracking from '../../../../infrastructure/event-tracking'
|
|
|
|
export default function FileTreeModalCreateFileMode({ mode, icon, label }) {
|
|
const { newFileCreateMode, startCreatingFile } = useFileTreeActionable()
|
|
|
|
const handleClick = () => {
|
|
startCreatingFile(mode)
|
|
eventTracking.sendMB('file-modal-click', { method: mode })
|
|
}
|
|
|
|
return (
|
|
<li className={classnames({ active: newFileCreateMode === mode })}>
|
|
<Button
|
|
bsStyle="link"
|
|
block
|
|
onClick={handleClick}
|
|
className="modal-new-file-mode"
|
|
>
|
|
<Icon type={icon} fw />
|
|
|
|
{label}
|
|
</Button>
|
|
</li>
|
|
)
|
|
}
|
|
|
|
FileTreeModalCreateFileMode.propTypes = {
|
|
mode: PropTypes.string.isRequired,
|
|
icon: PropTypes.string.isRequired,
|
|
label: PropTypes.string.isRequired,
|
|
}
|