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'
|
|
|
|
|
|
|
|
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 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
|
|
|
}
|