2021-03-18 05:52:36 -04:00
|
|
|
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'
|
2023-08-22 09:33:19 -04:00
|
|
|
import * as eventTracking from '../../../../infrastructure/event-tracking'
|
2021-03-18 05:52:36 -04:00
|
|
|
|
|
|
|
export default function FileTreeModalCreateFileMode({ mode, icon, label }) {
|
|
|
|
const { newFileCreateMode, startCreatingFile } = useFileTreeActionable()
|
|
|
|
|
|
|
|
const handleClick = () => {
|
|
|
|
startCreatingFile(mode)
|
2023-08-22 09:33:19 -04:00
|
|
|
eventTracking.sendMB('file-modal-click', { method: mode })
|
2021-03-18 05:52:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li className={classnames({ active: newFileCreateMode === mode })}>
|
|
|
|
<Button
|
|
|
|
bsStyle="link"
|
|
|
|
block
|
|
|
|
onClick={handleClick}
|
|
|
|
className="modal-new-file-mode"
|
|
|
|
>
|
2022-01-19 06:56:57 -05:00
|
|
|
<Icon type={icon} fw />
|
2021-03-18 05:52:36 -04:00
|
|
|
|
|
|
|
{label}
|
|
|
|
</Button>
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
FileTreeModalCreateFileMode.propTypes = {
|
|
|
|
mode: PropTypes.string.isRequired,
|
|
|
|
icon: PropTypes.string.isRequired,
|
2021-04-27 03:52:58 -04:00
|
|
|
label: PropTypes.string.isRequired,
|
2021-03-18 05:52:36 -04:00
|
|
|
}
|