added drag and drop to file browser

This commit is contained in:
Djeeberjr 2021-08-01 21:42:26 +02:00
parent 483ffb58ca
commit 713a96efc5

View File

@ -2,6 +2,7 @@ import React from "react"
import { useState } from "react" import { useState } from "react"
import { useOpenDirQuery } from "../generated/graphql" import { useOpenDirQuery } from "../generated/graphql"
import Breadcrum from "./Breadcrum" import Breadcrum from "./Breadcrum"
import DragAndDrop from "./DragAndDrop"
import FileBrowserElement from "./FileBrowserElement" import FileBrowserElement from "./FileBrowserElement"
import FileOpen from "./FileOpen" import FileOpen from "./FileOpen"
@ -16,8 +17,18 @@ const FileBrowser: React.FC = () => {
} }
}) })
function handleDrop(files:FileList) {
for (let i = 0; i < files.length; i++) {
const file = files[i]
console.debug(file) // TODO
}
}
return ( return (
<div> <div>
<DragAndDrop
handleDrop={handleDrop}
>
<Breadcrum path={path} onDirClick={(newPath)=>{ <Breadcrum path={path} onDirClick={(newPath)=>{
setPath(newPath) setPath(newPath)
}}/> }}/>
@ -56,6 +67,7 @@ const FileBrowser: React.FC = () => {
{<FileOpen id={openFileId} show={showFile} onCloseClick={()=>{ {<FileOpen id={openFileId} show={showFile} onCloseClick={()=>{
setShowFile(false) setShowFile(false)
}} />} }} />}
</DragAndDrop>
</div> </div>
) )
} }