@@ -21,6 +21,15 @@ function PhotoVideoPicker({
21
21
inputOptions,
22
22
file,
23
23
} ) {
24
+ const renderUpload = ( ) => (
25
+ < React . Fragment >
26
+ < p styleName = "infoText hide-mobile" >
27
+ { infoText }
28
+ </ p >
29
+ < button styleName = "btn hide-mobile" type = "button" > { btnText } </ button >
30
+ </ React . Fragment >
31
+ ) ;
32
+
24
33
return (
25
34
< React . Fragment >
26
35
< Dropzone
@@ -66,7 +75,7 @@ function PhotoVideoPicker({
66
75
< React . Fragment >
67
76
68
77
< section
69
- styleName = { cn ( 'container' , { hasError : ! ! errorMsg , hasFile : ! ! file && ! ! file . length } ) }
78
+ styleName = { cn ( 'container' , { hasError : ! ! errorMsg , hasFile : ! ! file && ! ! file . length , 'hide-mobile' : file . length === 3 } ) }
70
79
{ ...getRootProps ( ) }
71
80
className = { cn ( className , getRootProps ( ) . className ) }
72
81
>
@@ -76,44 +85,48 @@ function PhotoVideoPicker({
76
85
} ) }
77
86
/>
78
87
{
79
- file && file . length ? (
80
- < div styleName = "photo-list hide-mobile" >
81
- { file . map ( ( fileInfo , index ) => (
82
- < div
83
- styleName = "photo-item"
84
- key = { fileInfo . name }
85
- > < PhotoVideoItem notSelectable file = { fileInfo } />
86
- < button
87
- type = "button"
88
- styleName = "btn-delete"
89
- onClick = { ( e ) => {
90
- e . stopPropagation ( ) ;
91
- e . preventDefault ( ) ;
92
- const newFile = [ ...file ] ;
93
- newFile . splice ( index , 1 ) ;
94
- onFilePick ( newFile ) ;
95
- } }
96
- > < BtnDeletePhoto />
97
- </ button >
98
- </ div >
99
- ) ) }
100
- </ div >
101
- ) : (
102
- < React . Fragment >
103
- < p styleName = "infoText hide-mobile" >
104
- { infoText }
105
- </ p >
106
- < button styleName = "btn hide-mobile" type = "button" > { btnText } </ button >
107
- </ React . Fragment >
108
- )
109
- }
88
+ file && file . length ? (
89
+ < div styleName = "photo-list hide-mobile" >
90
+ { file . map ( ( fileInfo , index ) => (
91
+ < div
92
+ styleName = "photo-item"
93
+ key = { fileInfo . name }
94
+ > < PhotoVideoItem notSelectable file = { fileInfo } />
95
+ < button
96
+ type = "button"
97
+ styleName = "btn-delete"
98
+ onClick = { ( e ) => {
99
+ e . stopPropagation ( ) ;
100
+ e . preventDefault ( ) ;
101
+ const newFile = [ ...file ] ;
102
+ newFile . splice ( index , 1 ) ;
103
+ onFilePick ( newFile ) ;
104
+ } }
105
+ > < BtnDeletePhoto />
106
+ </ button >
107
+ </ div >
108
+ ) ) }
109
+ {
110
+ file . length < 3 && (
111
+ < div styleName = "photo-item browse-button" >
112
+ { renderUpload ( ) }
113
+ </ div >
114
+ )
115
+ }
116
+ </ div >
117
+ ) : renderUpload ( )
118
+ }
110
119
111
- < React . Fragment >
112
- < p styleName = "infoText hide-desktop show-mobile" >
113
- { infoTextMobile }
114
- </ p >
115
- < button styleName = "btn hide-desktop show-mobile" type = "button" > { btnText } </ button >
116
- </ React . Fragment >
120
+ {
121
+ ( file || [ ] ) . length < 3 && (
122
+ < React . Fragment >
123
+ < p styleName = "infoText hide-desktop show-mobile" >
124
+ { infoTextMobile }
125
+ </ p >
126
+ < button styleName = "btn hide-desktop show-mobile" type = "button" > { btnText } </ button >
127
+ </ React . Fragment >
128
+ )
129
+ }
117
130
</ section >
118
131
119
132
</ React . Fragment >
0 commit comments