2023-08-18 05:26:22 -04:00
|
|
|
import { useFileTreeSelectable } from '../contexts/file-tree-selectable'
|
2023-10-12 04:38:31 -04:00
|
|
|
import { useCallback } from 'react'
|
2023-08-18 05:26:22 -04:00
|
|
|
|
|
|
|
type FileTreeInnerProps = {
|
|
|
|
children: React.ReactNode
|
|
|
|
}
|
|
|
|
|
|
|
|
function FileTreeInner({ children }: FileTreeInnerProps) {
|
|
|
|
const { setIsRootFolderSelected } = useFileTreeSelectable()
|
|
|
|
|
2023-10-12 04:38:31 -04:00
|
|
|
const handleFileTreeClick = useCallback(() => {
|
2023-08-18 05:26:22 -04:00
|
|
|
setIsRootFolderSelected(true)
|
2023-10-12 04:38:31 -04:00
|
|
|
}, [setIsRootFolderSelected])
|
2023-08-18 05:26:22 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
|
|
<div
|
|
|
|
className="file-tree-inner"
|
|
|
|
onClick={handleFileTreeClick}
|
|
|
|
data-testid="file-tree-inner"
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FileTreeInner
|