@@ -6,9 +6,9 @@ import { DAY, MONTH_NAMES } from "../../contants/calendarConst";
6
6
import { getCalendarDate } from "../../utils/getCalendarDate" ;
7
7
8
8
function SelectDateCalendar ( {
9
- handleDisabledNextBtn ,
9
+ handleSelectDate ,
10
10
} : {
11
- handleDisabledNextBtn : ( isDisabled : boolean ) => void ;
11
+ handleSelectDate : ( isSelected : boolean ) => void ;
12
12
} ) {
13
13
const [ year , setYear ] = useState ( new Date ( ) . getFullYear ( ) ) ;
14
14
const [ month , setMonth ] = useState ( new Date ( ) . getMonth ( ) + 1 ) ;
@@ -173,18 +173,12 @@ function SelectDateCalendar({
173
173
] ;
174
174
175
175
setSelectedDate ( updatedDate ) ;
176
-
177
- if ( updatedDate . length === 0 ) handleDisabledNextBtn ( true ) ;
178
- else {
179
- if ( selectedDateNum . current < 14 ) handleDisabledNextBtn ( false ) ;
180
- }
176
+ handleSelectDate ( false ) ;
181
177
} else {
182
178
const lastDate = selectedDate [ selectedDate . length - 1 ] ;
183
179
const isStartDateNull = lastDate && lastDate . startDate === 0 && lastDate . endDate !== 0 ;
184
180
const isEndDateNull = lastDate && lastDate . startDate !== 0 && lastDate . endDate === 0 ;
185
181
186
- handleDisabledNextBtn ( false ) ;
187
-
188
182
// 선택된 날짜가 없는 경우
189
183
if ( selectedDate . length === 0 ) {
190
184
setSelectedDate ( [
@@ -197,6 +191,7 @@ function SelectDateCalendar({
197
191
endDate : 0 ,
198
192
} ,
199
193
] ) ;
194
+ handleSelectDate ( false ) ;
200
195
}
201
196
202
197
// 시작 날짜와 끝나는 날짜 중 하나가 선택되어 있는 경우
@@ -217,9 +212,11 @@ function SelectDateCalendar({
217
212
month : startMonth ,
218
213
date : startDate ,
219
214
} ) ;
215
+ handleSelectDate ( true ) ;
220
216
if ( selectedDateNum . current >= 14 ) {
217
+ // 선택한 날짜가 14일을 넘었을 때 동작하는 플로우 추가 시 삭제 예정
221
218
alert ( "14일 넘음" ) ;
222
- handleDisabledNextBtn ( true ) ;
219
+ handleSelectDate ( false ) ;
223
220
}
224
221
}
225
222
@@ -236,9 +233,11 @@ function SelectDateCalendar({
236
233
month : endMonth ,
237
234
date : endDate ,
238
235
} ) ;
236
+ handleSelectDate ( true ) ;
239
237
if ( selectedDateNum . current >= 14 ) {
238
+ // 선택한 날짜가 14일을 넘었을 때 동작하는 플로우 추가 시 삭제 예정
240
239
alert ( "14일 넘음" ) ;
241
- handleDisabledNextBtn ( true ) ;
240
+ handleSelectDate ( false ) ;
242
241
}
243
242
}
244
243
}
@@ -256,12 +255,13 @@ function SelectDateCalendar({
256
255
endDate : 0 ,
257
256
} ,
258
257
] ) ;
258
+ handleSelectDate ( false ) ;
259
259
}
260
260
}
261
261
} ;
262
262
263
263
return (
264
- < article className = "flex flex-col mt-[5.6rem ]" >
264
+ < article className = "flex flex-col h-[38.3rem] mb-[2rem ]" >
265
265
< header className = "flex items-center justify-center mb-[2.2rem]" >
266
266
< button type = "button" onClick = { ( ) => handleClickArrow ( "left" ) } >
267
267
< MobileIconArrowLeftGray />
@@ -339,7 +339,7 @@ function SelectDateCalendar({
339
339
{ ( ( isRightSelection && isClickedNum ) || isInRange ) && (
340
340
< span
341
341
className = { `absolute top-0 ${ isStartDate ? "right-0" : "left-0" } ${
342
- isClickedNum ? "w-[2.45rem]" : "w-[4.9rem ]"
342
+ isClickedNum ? "w-[2.45rem]" : "w-[100% ]"
343
343
} h-[3.6rem] bg-sub-1`}
344
344
/>
345
345
) }
0 commit comments