Last active
June 11, 2021 04:44
-
-
Save tofusoup429/eef000d4109bad5d01c129742de74d3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useDropzone} from '@tofusoup429/dropzone'; | |
import { useEffect } from 'react'; | |
const FolderImage = () => { | |
return( | |
<svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" enableBackground="new 0 0 48 48"> | |
<path fill="#FFA000" d="M40,12H22l-4-4H8c-2.2,0-4,1.8-4,4v8h40v-4C44,13.8,42.2,12,40,12z"/> | |
<path fill="#FFCA28" d="M40,12H8c-2.2,0-4,1.8-4,4v20c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4V16C44,13.8,42.2,12,40,12z"/> | |
</svg> | |
) | |
} | |
const Dropzone = () => { | |
let {fileName, dndStatus, fileContent, fileSize} = useDropzone(); | |
useEffect(()=>{ | |
console.log(fileName, dndStatus, fileContent, fileSize) | |
},[dndStatus, fileContent, fileSize]) | |
return ( | |
<> | |
<div id='dropzone' style={{width:'100px', height:'100px', backgroundColor:(dndStatus==='dragover'?"red":'yellow')}}><FolderImage /></div> | |
{(fileContent) && | |
<> | |
<div id="filename">{`filename:${fileName}`}</div> | |
<div id="fileContent" style={{color:"red"}}>{fileContent}</div> | |
</> | |
} | |
</> | |
) | |
} | |
export default Dropzone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment