@@ -26,11 +26,12 @@ const getBorderColor = (theme: Theme, props: DropzoneState) => {
26
26
export interface SingleUploadProps {
27
27
onDrop : ( acceptedFiles : File [ ] ) => void ;
28
28
onCancel : ( ) => void ;
29
+ isUploading : boolean ;
29
30
progress : Progress ;
30
31
}
31
32
32
- const SingleUpload : FC < SingleUploadProps > = ( { onDrop, onCancel, progress } ) => {
33
- const isUploading = progress . total > 0 ;
33
+ const SingleUpload : FC < SingleUploadProps > = ( { onDrop, onCancel, isUploading , progress } ) => {
34
+ const uploading = isUploading && progress . total > 0 ;
34
35
35
36
const dropzoneState = useDropzone ( {
36
37
onDrop,
@@ -48,7 +49,7 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, progress }) =>
48
49
const { LL } = useI18nContext ( ) ;
49
50
50
51
const progressText = ( ) => {
51
- if ( isUploading ) {
52
+ if ( uploading ) {
52
53
if ( progress . total ) {
53
54
return LL . UPLOADING ( ) + ': ' + Math . round ( ( progress . loaded * 100 ) / progress . total ) + '%' ;
54
55
}
@@ -68,7 +69,7 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, progress }) =>
68
69
color : theme . palette . grey [ 400 ] ,
69
70
transition : 'border .24s ease-in-out' ,
70
71
width : '100%' ,
71
- cursor : isUploading ? 'default' : 'pointer' ,
72
+ cursor : uploading ? 'default' : 'pointer' ,
72
73
borderColor : getBorderColor ( theme , dropzoneState )
73
74
}
74
75
} ) }
@@ -77,7 +78,7 @@ const SingleUpload: FC<SingleUploadProps> = ({ onDrop, onCancel, progress }) =>
77
78
< Box flexDirection = "column" display = "flex" alignItems = "center" >
78
79
< CloudUploadIcon fontSize = "large" />
79
80
< Typography variant = "h6" > { progressText ( ) } </ Typography >
80
- { isUploading && (
81
+ { uploading && (
81
82
< Fragment >
82
83
< Box width = "100%" p = { 2 } >
83
84
< LinearProgress
0 commit comments