Skip to content

Commit

Permalink
Fluent: improve dropzone (#5328)
Browse files Browse the repository at this point in the history
* Fluent: improve dropzone

* Changelog
  • Loading branch information
OEvgeny authored Oct 18, 2024
1 parent 7f4b09c commit ae69d04
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/
- Resolved [#4847](https://github.com/microsoft/BotFramework-WebChat/issues/4847). Migrated to npm workspaces from lerna, in PR [#5301](https://github.com/microsoft/BotFramework-WebChat/pull/5301), by [@compulim](https://github.com/compulim)
- Resolved [#5302](https://github.com/microsoft/BotFramework-WebChat/issues/5302). Migrated to `core-js-pure/Promise.withResolveers` from `p-defer`, in PR [#5301](https://github.com/microsoft/BotFramework-WebChat/pull/5301), by [@compulim](https://github.com/compulim)
- Improved message bubble layout in Fluent theme to allow growth beyond 450px up to 75% of container width, in PR [#5324](https://github.com/microsoft/BotFramework-WebChat/pull/5324), by [@OEvgeny](https://github.com/OEvgeny)
- Improved drop zone behavior and styling in Fluent theme, in PR [#5328](https://github.com/microsoft/BotFramework-WebChat/pull/5328), by [@OEvgeny](https://github.com/OEvgeny)

### Fixed

Expand Down
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 ae69d04

Please sign in to comment.