Merge pull request #603 from Champetaman/fix-import-drag-area-colors-blue

Fix: Enhance Dropzone visual feedback for dropzone
This commit is contained in:
Ahmed Bouhuolia
2024-08-14 16:17:44 +02:00
committed by GitHub
2 changed files with 19 additions and 6 deletions

View File

@@ -1,5 +1,3 @@
.root { .root {
padding: 20px; padding: 20px;
border: 2px dotted #c5cbd3; border: 2px dotted #c5cbd3;
@@ -9,4 +7,14 @@
flex-direction: column; flex-direction: column;
background: #fff; background: #fff;
position: relative; position: relative;
transition: background-color 0.3s ease, border-color 0.3s ease;
&.dropzoneAccept {
border-color: rgb(0, 82, 204);
background: rgba(0, 82, 204, 0.05);
}
&.dropzoneReject {
border-color: #AC2F33;
background: rgba(172, 47, 51, 0.05)
}
} }

View File

@@ -235,7 +235,14 @@ export const Dropzone = (_props: DropzoneProps) => {
> >
<Box <Box
{...getRootProps({ {...getRootProps({
className: clsx(styles.root, classNames?.root), className: clsx(
styles.root,
{
[styles.dropzoneAccept]: isDragAccept,
[styles.dropzoneReject]: isDragReject
},
classNames?.root
),
})} })}
// {...getStyles('root', { focusable: true })} // {...getStyles('root', { focusable: true })}
{...others} {...others}
@@ -253,7 +260,7 @@ export const Dropzone = (_props: DropzoneProps) => {
<input {...getInputProps(inputProps)} name={name} /> <input {...getInputProps(inputProps)} name={name} />
<div <div
data-enable-pointer-events={enablePointerEvents || undefined} data-enable-pointer-events={enablePointerEvents || undefined}
className={classNames?.content} className={clsx(styles.content, classNames?.content)}
> >
{children} {children}
</div> </div>
@@ -268,8 +275,6 @@ Dropzone.Idle = DropzoneIdle;
Dropzone.Reject = DropzoneReject; Dropzone.Reject = DropzoneReject;
type PossibleRef<T> = Ref<T> | undefined; type PossibleRef<T> = Ref<T> | undefined;
export function assignRef<T>(ref: PossibleRef<T>, value: T) { export function assignRef<T>(ref: PossibleRef<T>, value: T) {