File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
app/admin-new/(components)/ThemeDrawer Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -38,19 +38,24 @@ const ThemeDrawerAnswer = ({
3838 setImgCnt (
3939 3 - answerImages . length - selectedHint . answerImageUrlList . length
4040 ) ;
41+ return ;
4142 }
43+ setImgCnt ( 3 - answerImages . length ) ;
4244 } , [ answerImages , selectedHint . answerImageUrlList ] ) ;
4345
4446 // 이미지 파일 핸들러
45- const handleAnswerFileChange = async ( e : ChangeEvent < HTMLInputElement > ) => {
47+ const handleHintFileClick = ( e : MouseEvent < HTMLInputElement > ) => {
4648 if ( imgCnt === 0 ) {
49+ e . preventDefault ( ) ;
4750 setToast ( {
4851 isOpen : true ,
4952 title : "이미지는 3개까지 추가할 수 있습니다." ,
5053 text : "" ,
5154 } ) ;
5255 return ;
5356 }
57+ } ;
58+ const handleAnswerFileChange = async ( e : ChangeEvent < HTMLInputElement > ) => {
5459 if ( ! e . target . files ) {
5560 return ;
5661 }
@@ -129,6 +134,7 @@ const ThemeDrawerAnswer = ({
129134 < input
130135 type = "file"
131136 multiple
137+ onClick = { handleHintFileClick }
132138 onChange = { handleAnswerFileChange }
133139 accept = "image/*"
134140 style = { { display : "none" } }
Original file line number Diff line number Diff line change @@ -37,19 +37,24 @@ const ThemeDrawerHint = ({
3737 useEffect ( ( ) => {
3838 if ( selectedHint . hintImageUrlList ) {
3939 setImgCnt ( 3 - hintImages . length - selectedHint . hintImageUrlList . length ) ;
40+ return ;
4041 }
42+ setImgCnt ( 3 - hintImages . length ) ;
4143 } , [ hintImages , selectedHint . hintImageUrlList ] ) ;
4244
4345 // 이미지 파일 핸들러
44- const handleHintFileChange = async ( e : ChangeEvent < HTMLInputElement > ) => {
46+ const handleHintFileClick = ( e : MouseEvent < HTMLInputElement > ) => {
4547 if ( imgCnt === 0 ) {
48+ e . preventDefault ( ) ;
4649 setToast ( {
4750 isOpen : true ,
4851 title : "이미지는 3개까지 추가할 수 있습니다." ,
4952 text : "" ,
5053 } ) ;
5154 return ;
5255 }
56+ } ;
57+ const handleHintFileChange = async ( e : ChangeEvent < HTMLInputElement > ) => {
5358 if ( ! e . target . files ) {
5459 return ;
5560 }
@@ -127,6 +132,7 @@ const ThemeDrawerHint = ({
127132 < input
128133 type = "file"
129134 multiple
135+ onClick = { handleHintFileClick }
130136 onChange = { handleHintFileChange }
131137 accept = "image/*"
132138 style = { { display : "none" } }
You can’t perform that action at this time.
0 commit comments