2021-03-18 09:52:36 +00: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'
|
|
|
|
|
|
|
|
export default function FileTreeModalCreateFileMode({ mode, icon, label }) {
|
|
|
|
const { newFileCreateMode, startCreatingFile } = useFileTreeActionable()
|
|
|
|
|
|
|
|
const handleClick = () => {
|
|
|
|
startCreatingFile(mode)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li className={classnames({ active: newFileCreateMode === mode })}>
|
|
|
|
<Button
|
|
|
|
bsStyle="link"
|
|
|
|
block
|
|
|
|
onClick={handleClick}
|
|
|
|
className="modal-new-file-mode"
|
|
|
|
>
|
2022-01-19 11:56:57 +00:00
|
|
|
<Icon type={icon} fw />
|
2021-03-18 09:52:36 +00:00
|
|
|
|
|
|
|
{label}
|
|
|
|
</Button>
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
FileTreeModalCreateFileMode.propTypes = {
|
|
|
|
mode: PropTypes.string.isRequired,
|
|
|
|
icon: PropTypes.string.isRequired,
|
2021-04-27 07:52:58 +00:00
|
|
|
label: PropTypes.string.isRequired,
|
2021-03-18 09:52:36 +00:00
|
|
|
}
|