mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-08-04 23:00:05 +02:00

Remove PropTypes from file-tree components GitOrigin-RevId: 7ecbf9778da59b852be8678c5dff61e13d927b9c
36 lines
949 B
TypeScript
36 lines
949 B
TypeScript
import classnames from 'classnames'
|
|
import { useFileTreeActionable } from '../../contexts/file-tree-actionable'
|
|
import * as eventTracking from '../../../../infrastructure/event-tracking'
|
|
import OLButton from '@/features/ui/components/ol/ol-button'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
|
|
export default function FileTreeModalCreateFileMode({
|
|
mode,
|
|
icon,
|
|
label,
|
|
}: {
|
|
mode: string
|
|
icon: string
|
|
label: string
|
|
}) {
|
|
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"
|
|
>
|
|
<MaterialIcon type={icon} />
|
|
|
|
{label}
|
|
</OLButton>
|
|
</li>
|
|
)
|
|
}
|