Skip to content

Commit

Permalink
Fluent: improve dropzone
Browse files Browse the repository at this point in the history
  • Loading branch information
OEvgeny committed Oct 17, 2024
1 parent 4744d69 commit c8b8244
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
place-content: center;
place-items: center;
position: absolute;
transition: all var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
}

:global(.webchat-fluent) .sendbox__attachment-drop-zone--droppable {
background-color: #e00;
color: White;
background-color: var(--webchat-colorBrandBackground2Hover);
}

:global(.webchat-fluent) .sendbox__attachment-drop-zone-icon {
Expand Down
7 changes: 7 additions & 0 deletions packages/fluent-theme/src/components/dropZone/DropZone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,19 @@ const DropZone = (props: { readonly onFilesAdded: (files: File[]) => void }) =>

const handleDragLeave = () => --entranceCounter <= 0 && setDropZoneState(false);

const handleDragEnd = () => {
entranceCounter = 0;
setDropZoneState(false);
};

document.addEventListener('dragenter', handleDragEnter, false);
document.addEventListener('dragleave', handleDragLeave, false);
document.addEventListener('dragend', handleDragEnd, false);

return () => {
document.removeEventListener('dragenter', handleDragEnter);
document.removeEventListener('dragleave', handleDragLeave);
document.removeEventListener('dragend', handleDragEnd);
};
}, [setDropZoneState]);

Expand Down

0 comments on commit c8b8244

Please sign in to comment.