Skip to content

Commit

Permalink
Added: Drag and Reject effect on upload component.
Browse files Browse the repository at this point in the history
  • Loading branch information
saiful7778 committed Dec 24, 2024
1 parent e8e9c78 commit 733a28f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/src/components/Upload/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import { useUploadContext } from './UploadContext'
const UploadBody = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
({ children, className, ...props }, ref: Ref<HTMLDivElement>) => {
const { options, horizontal } = useUploadContext()
const { getRootProps, getInputProps } = useDropzone(options)
const { getRootProps, getInputProps, isDragActive, isDragReject } = useDropzone(options)
return (
<div
{...props}
ref={ref}
{...getRootProps()}
className={cn(
horizontal
? 'flex cursor-pointer items-center gap-4 rounded-xl border border-dashed bg-white px-3 transition-all duration-300 hover:bg-metal-25 dark:border-metal-800 dark:bg-metal-900 dark:hover:bg-metal-900'
: 'flex cursor-pointer flex-col items-center rounded-xl border border-dashed border-metal-50 bg-white p-3 text-center transition-all duration-300 hover:bg-metal-25 dark:border-metal-800 dark:bg-metal-900 dark:hover:bg-metal-900',
'flex cursor-pointer items-center rounded-xl border border-dashed bg-white transition-all duration-300 hover:bg-metal-25 dark:border-metal-800 dark:bg-metal-900 dark:hover:bg-metal-900',
horizontal ? 'gap-4 px-3' : 'flex-col border-metal-50 p-3 text-center',
isDragActive && 'border-primary-500 dark:border-primary-400',
isDragReject && 'border-error-500 dark:border-error-500',
className,
)}>
<input {...getInputProps()} />
Expand Down

0 comments on commit 733a28f

Please sign in to comment.