2021-03-18 05:52:36 -04:00
|
|
|
import React from 'react'
|
|
|
|
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"
|
|
|
|
>
|
|
|
|
<Icon modifier="fw" type={icon} />
|
|
|
|
|
|
|
|
{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
|
|
|
}
|