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

* Use the leadingIcon prop instead of spacing * Remove duplicated ID * Make the alt text to be empty since image is decorative * Make switcher input visually hidden The switcher's input previously used 'pointer-events: none', which prevented proper interaction in the test. It replaces that hack. * Add accessibilityLabel to the info icon that is actually a clickable link * Use more specific selectors * It should display * Use more specific selectors * Use more specific selectors GitOrigin-RevId: a555d96cf972d06dd5432f44a23b02355cedcd94
34 lines
863 B
TypeScript
34 lines
863 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'
|
|
|
|
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"
|
|
leadingIcon={icon}
|
|
>
|
|
{label}
|
|
</OLButton>
|
|
</li>
|
|
)
|
|
}
|