mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 10:16:48 -05:00
1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
35 lines
960 B
JavaScript
35 lines
960 B
JavaScript
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,
|
|
label: PropTypes.string.isRequired,
|
|
}
|