refactor file browser list

This commit is contained in:
2021-08-28 15:28:38 +02:00
parent 5e7169079c
commit 24e0bcbf92
3 changed files with 81 additions and 58 deletions

View File

@@ -7,7 +7,7 @@ import FileElement from "./FileElement"
interface Props {
file?: File | null
dir?: Directory | null
onClick?: (data: File | Directory) => void
onClick?: (event: React.MouseEvent ,data: File | Directory) => void
onContextMenu?: (e:React.MouseEvent) => void
}
@@ -15,11 +15,11 @@ const FileBrowserElement: React.FC<Props> = (props) => {
return (
<tr
className="hover:bg-gray-100 dark:hover:bg-gray-900 text-lg"
onClick={()=>{
onClick={(e)=>{
if(props.file){
props.onClick?.(props.file)
props.onClick?.(e,props.file)
}else if(props.dir){
props.onClick?.(props.dir)
props.onClick?.(e,props.dir)
}
}}