@@ -8,6 +8,7 @@ import { useMessageInputContext, useTranslationContext } from '../../context';
88import { useAttachmentManagerState , useMessageComposer } from './hooks' ;
99import { useStateStore } from '../../store' ;
1010import { useIsCooldownActive } from './hooks/useIsCooldownActive' ;
11+ import { IconFileArrowLeftIn } from '../Icons' ;
1112
1213const DragAndDropUploadContext = React . createContext < {
1314 subscribeToDrop : ( ( fn : ( files : File [ ] ) => void ) => ( ) => void ) | null ;
@@ -123,34 +124,35 @@ export const WithDragAndDropUpload = ({
123124 // nested WithDragAndDropUpload components render wrappers without functionality
124125 // (MessageInputFlat has a default WithDragAndDropUpload)
125126 if ( dragAndDropUploadContext . subscribeToDrop !== null ) {
126- return React . createElement ( Component , { className } , children ) ;
127+ return < Component className = { className } > { children } </ Component > ;
127128 }
128129
129130 const rootClassName = clsx ( 'str-chat__dropzone-root' , className ) ;
130131
131- const overlay = isDragActive
132- ? React . createElement (
133- 'div' ,
134- {
135- className : clsx ( 'str-chat__dropzone-container' , {
136- 'str-chat__dropzone-container--not-accepted' : isDragReject ,
137- } ) ,
138- role : 'presentation' ,
139- } ,
140- isDragReject
141- ? React . createElement ( 'p' , null , t ( 'Some of the files will not be accepted' ) )
142- : React . createElement ( 'p' , null , t ( 'Drag your files here' ) ) ,
143- )
144- : null ;
145-
146- return React . createElement (
147- DragAndDropUploadContext . Provider ,
148- { value : { subscribeToDrop } } ,
149- React . createElement (
150- Component ,
151- getRootProps ( { className : rootClassName , style } ) ,
152- overlay ,
153- children ,
154- ) ,
132+ return (
133+ < DragAndDropUploadContext . Provider value = { { subscribeToDrop } } >
134+ < Component { ...getRootProps ( { className : rootClassName , style } ) } >
135+ { isDragActive && (
136+ < div
137+ className = { clsx ( 'str-chat__dropzone-container' , {
138+ 'str-chat__dropzone-container--not-accepted' : isDragReject ,
139+ } ) }
140+ role = 'presentation'
141+ >
142+ < div className = 'str-chat__dropzone-container__content' >
143+ { isDragReject ? (
144+ < p > { t ( 'Some of the files will not be accepted' ) } </ p >
145+ ) : (
146+ < >
147+ < IconFileArrowLeftIn />
148+ < p > { t ( 'Drag your files here' ) } </ p >
149+ </ >
150+ ) }
151+ </ div >
152+ </ div >
153+ ) }
154+ { children }
155+ </ Component >
156+ </ DragAndDropUploadContext . Provider >
155157 ) ;
156158} ;
0 commit comments