mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-13 15:59:23 -05:00
abb59e4603
[web] Migrate the file tree on the editor page to Bootstrap 5 GitOrigin-RevId: e2efec26242c8cdab37a54bc182b83bfb0f1eb3c
40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
import classnames from 'classnames'
|
|
import PropTypes from 'prop-types'
|
|
import Icon from '../../../../shared/components/icon'
|
|
import { useFileTreeActionable } from '../../contexts/file-tree-actionable'
|
|
import * as eventTracking from '../../../../infrastructure/event-tracking'
|
|
import OLButton from '@/features/ui/components/ol/ol-button'
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
|
|
export default function FileTreeModalCreateFileMode({ mode, icon, label }) {
|
|
const { newFileCreateMode, startCreatingFile } = useFileTreeActionable()
|
|
|
|
const handleClick = () => {
|
|
startCreatingFile(mode)
|
|
eventTracking.sendMB('file-modal-click', { method: mode })
|
|
}
|
|
|
|
return (
|
|
<li className={classnames({ active: newFileCreateMode === mode })}>
|
|
<OLButton
|
|
variant="link"
|
|
onClick={handleClick}
|
|
className="modal-new-file-mode"
|
|
>
|
|
<BootstrapVersionSwitcher
|
|
bs3={<Icon type={icon} fw />}
|
|
bs5={<MaterialIcon type={icon} />}
|
|
/>
|
|
|
|
{label}
|
|
</OLButton>
|
|
</li>
|
|
)
|
|
}
|
|
|
|
FileTreeModalCreateFileMode.propTypes = {
|
|
mode: PropTypes.string.isRequired,
|
|
icon: PropTypes.string.isRequired,
|
|
label: PropTypes.string.isRequired,
|
|
}
|