Skip to content

Commit

Permalink
chore: 코드 리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
wokbjso committed Aug 2, 2024
1 parent cb79627 commit c2786f2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions features/record/components/organisms/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 전역적으로 사용
<FormProvider {...methods}>
Expand All @@ -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}
Expand All @@ -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}
Expand Down
8 changes: 4 additions & 4 deletions features/record/hooks/use-get-browser-width.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
Expand Down
10 changes: 5 additions & 5 deletions features/record/store/bottom-sheet.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -18,6 +18,6 @@ const initialTimeBottomSheetState: timeBottomSheetStateProps = {
* @description 레인 길이 선택 bottom-sheet open 상태 관리 atom
*/
export const isLaneLengthBottomSheetOpen = atom<boolean>(false);
export const timeBottomSheetState = atom<timeBottomSheetStateProps>(
export const timeBottomSheetState = atom<TimeBottomSheetStateProps>(
initialTimeBottomSheetState,
);

0 comments on commit c2786f2

Please sign in to comment.