demo: fix drag enter counts for non-files

This commit is contained in:
Kenny Daniel 2024-11-02 13:54:44 -07:00
parent ecacb2b03b
commit 302ba655c3
No known key found for this signature in database
GPG Key ID: 90AB653A8CAD7E45
5 changed files with 21 additions and 9 deletions

@ -67,7 +67,10 @@ export default function Dropzone({ children, onFileDrop, onUrlDrop, onError }: D
function onDragOver(e: DragEvent) {
e.preventDefault()
}
function onDragLeave() {
function onDragLeave(e: DragEvent) {
const items = e.dataTransfer?.items
if (!items) return
if (!Array.from(items).some(item => item.kind === 'file')) return
setEnters(enters => enters - 1)
}
function handleFileDrop(e: DragEvent) {

2
demo/bundle.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -52,9 +52,8 @@ sub img {
display: flex;
}
.overlay {
align-items: center;
font-size: 125%;
position: absolute;
position: fixed;
top: 0;
bottom: 0;
right: 0;
@ -65,6 +64,16 @@ sub img {
padding: 12px;
z-index: 40;
}
.target {
border: 6px dashed #444;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
height: 100%;
width: 100%;
}
/* sidebar */
nav {

@ -32,20 +32,20 @@
"@rollup/plugin-replace": "6.0.1",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "12.1.1",
"@types/node": "22.8.2",
"@types/node": "22.8.6",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@vitest/coverage-v8": "2.1.4",
"eslint": "9.13.0",
"eslint": "9.14.0",
"eslint-plugin-jsdoc": "50.4.3",
"hightable": "0.6.3",
"http-server": "14.1.1",
"hyparquet-compressors": "0.1.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"rollup": "4.24.2",
"rollup": "4.24.3",
"typescript": "5.6.3",
"typescript-eslint": "8.12.1",
"typescript-eslint": "8.12.2",
"vitest": "2.1.4"
}
}