half broken dropzone component to be used later fr

This commit is contained in:
grngxd 2025-06-10 01:19:27 +01:00
parent 39005e75e0
commit 7be62fcbb2
4 changed files with 99 additions and 3 deletions

28
src/hooks/dropzone.tsx Normal file
View file

@ -0,0 +1,28 @@
import { $, useSignal } from '@builder.io/qwik';
export const useDropzone = () => {
const highlight = useSignal(false);
const onInputChange = $(async (e: Event) => {
e.preventDefault();
});
const fileInputRef = useSignal<HTMLInputElement | undefined>(undefined);
return {
highlight,
onDragOver: $((e: DragEvent) => {
e.preventDefault();
highlight.value = true;
}),
onDragLeave: $((e: DragEvent) => {
e.preventDefault();
highlight.value = false;
}),
onInputChange,
triggerFileInput: $(() => {
fileInputRef.value?.click();
}),
fileInputRef,
};
}