context menu
This commit is contained in:
@@ -8,17 +8,23 @@ interface Props {
|
||||
file?: File | null
|
||||
dir?: Directory | null
|
||||
onClick?: (data: File | Directory) => void
|
||||
onContextMenu?: (e:React.MouseEvent) => void
|
||||
}
|
||||
|
||||
const FileBrowserElement: React.FC<Props> = (props) => {
|
||||
return (
|
||||
<tr onClick={()=>{
|
||||
if(props.file){
|
||||
props.onClick?.(props.file)
|
||||
}else if(props.dir){
|
||||
props.onClick?.(props.dir)
|
||||
}
|
||||
}}>
|
||||
<tr
|
||||
onClick={()=>{
|
||||
if(props.file){
|
||||
props.onClick?.(props.file)
|
||||
}else if(props.dir){
|
||||
props.onClick?.(props.dir)
|
||||
}
|
||||
}}
|
||||
|
||||
onContextMenu={(e)=>props.onContextMenu?.(e)}
|
||||
|
||||
>
|
||||
{(props.file) ? <FileElement file={props.file}/>:(props.dir)?<DirectoryComponent dir={props.dir} />:<></>}
|
||||
</tr>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user