diff --git a/features/record/components/organisms/form.tsx b/features/record/components/organisms/form.tsx index 7e755165..e36f132d 100644 --- a/features/record/components/organisms/form.tsx +++ b/features/record/components/organisms/form.tsx @@ -60,6 +60,9 @@ export function Form() { const setIsPoolSearchPageModalOpen = useSetAtom(isPoolSearchPageModalOpen); const setIsDistancePageModalOpen = useSetAtom(isDistancePageModalOpen); const setTimeBottomSheetState = useSetAtom(timeBottomSheetState); + + const startTime = methods.watch('startTime'); + const endTime = methods.watch('endTime'); return ( //react-hook-form 전역적으로 사용 @@ -77,9 +80,7 @@ export function Form() { variant="select" isRequired hasDownArrow - value={ - methods.watch('startTime') ? methods.watch('startTime') : '' - } + value={startTime || ''} placeholder="00:00" label="수영 시간" wrapperClassName={timeStyles.field} @@ -96,7 +97,7 @@ export function Form() { variant="select" isRequired hasDownArrow - value={methods.watch('endTime') ? methods.watch('endTime') : ''} + value={endTime || ''} label="수영 시간" placeholder="00:00" wrapperClassName={timeStyles.field} diff --git a/features/record/hooks/use-get-browser-width.tsx b/features/record/hooks/use-get-browser-width.tsx index 702519a2..a1cbab1d 100644 --- a/features/record/hooks/use-get-browser-width.tsx +++ b/features/record/hooks/use-get-browser-width.tsx @@ -6,16 +6,16 @@ export default function useGetBrowserWidth() { const [width, setWidth] = useState(0); const handleResize = () => { - setWidth(window.innerWidth); + if (window.innerWidth > 600) setWidth(600); + else setWidth(window.innerWidth); }; useEffect(() => { - // Check if window object exists (for browser environments) if (typeof window !== 'undefined') { - setWidth(window.innerWidth); + if (window.innerWidth > 600) setWidth(600); + else setWidth(window.innerWidth); window.addEventListener('resize', handleResize); return () => { - // cleanup window.removeEventListener('resize', handleResize); }; } diff --git a/features/record/store/bottom-sheet.ts b/features/record/store/bottom-sheet.ts index b0644a59..740a938e 100644 --- a/features/record/store/bottom-sheet.ts +++ b/features/record/store/bottom-sheet.ts @@ -1,14 +1,14 @@ import { atom } from 'jotai'; -type timeVariantType = 'start' | 'end'; +type TimeVariantType = 'start' | 'end'; -interface timeBottomSheetStateProps { - variant: timeVariantType; +interface TimeBottomSheetStateProps { + variant: TimeVariantType; time: string; isOpen: boolean; } -const initialTimeBottomSheetState: timeBottomSheetStateProps = { +const initialTimeBottomSheetState: TimeBottomSheetStateProps = { variant: 'start', time: '', isOpen: false, @@ -18,6 +18,6 @@ const initialTimeBottomSheetState: timeBottomSheetStateProps = { * @description 레인 길이 선택 bottom-sheet open 상태 관리 atom */ export const isLaneLengthBottomSheetOpen = atom(false); -export const timeBottomSheetState = atom( +export const timeBottomSheetState = atom( initialTimeBottomSheetState, );