diff --git a/src/components/pages/post-meetup/modals/date-picker-modal/calendar/calendar-footer/index.tsx b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/calendar-footer/index.tsx
new file mode 100644
index 00000000..eb3a698c
--- /dev/null
+++ b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/calendar-footer/index.tsx
@@ -0,0 +1,24 @@
+import { useContextCalendars, useContextDays } from '@rehookify/datepicker';
+
+interface Props {
+ currentTab: 'date' | 'time';
+}
+
+export const CalendarFooter = ({ currentTab }: Props) => {
+ const { calendars } = useContextCalendars();
+ const { selectedDates } = useContextDays();
+
+ const { year, month } = calendars[0];
+
+ return (
+
+ {year}년
+
+ {month}월 {selectedDates[0].getDate()}일
+
+ 12:20
+ AM
+ PM
+
+ );
+};
diff --git a/src/components/pages/post-meetup/modals/date-picker-modal/date-picker/index.tsx b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/date-picker/index.tsx
similarity index 51%
rename from src/components/pages/post-meetup/modals/date-picker-modal/date-picker/index.tsx
rename to src/components/pages/post-meetup/modals/date-picker-modal/calendar/date-picker/index.tsx
index d04fbbc5..fb827e13 100644
--- a/src/components/pages/post-meetup/modals/date-picker-modal/date-picker/index.tsx
+++ b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/date-picker/index.tsx
@@ -1,47 +1,35 @@
-import { useEffect, useState } from 'react';
+'use client';
-import { useDatePicker } from '@rehookify/datepicker';
+import { useEffect } from 'react';
+
+import {
+ useContextCalendars,
+ useContextDatePickerOffsetPropGetters,
+ useContextDays,
+ useContextDaysPropGetters,
+} from '@rehookify/datepicker';
import clsx from 'clsx';
import { Icon } from '@/components/icon';
interface Props {
- currentTab: 'date' | 'time';
- handleDateChange: (date: string) => void;
+ handleDateChange: (selectedDate: string) => void;
}
-export const DatePicker = ({ currentTab, handleDateChange }: Props) => {
- const nowDate = new Date();
- const [selectedDates, onDatesChange] = useState([nowDate]);
-
- useEffect(() => {
- handleDateChange(selectedDates.toString());
- }, [selectedDates]);
+export const DatePicker = ({ handleDateChange }: Props) => {
+ const { formattedDates } = useContextDays();
+ const { calendars, weekDays } = useContextCalendars();
+ const { addOffset, subtractOffset } = useContextDatePickerOffsetPropGetters();
+ const { dayButton } = useContextDaysPropGetters();
- const {
- data: { weekDays, calendars },
- propGetters: { dayButton, addOffset, subtractOffset },
- } = useDatePicker({
- selectedDates,
- onDatesChange,
- locale: {
- day: 'numeric',
- weekday: 'short',
- monthName: 'numeric',
- },
- dates: {
- minDate: nowDate,
- maxDate: new Date(nowDate.getFullYear() + 1, 12, 0),
- },
- calendar: {
- mode: 'fluid',
- },
- });
+ const { month, days } = calendars[0];
- const { year, month, days } = calendars[0];
+ useEffect(() => {
+ handleDateChange(formattedDates[0].toString());
+ }, [formattedDates]);
return (
-
+
-
-
- {year}년
-
- {month}월 {selectedDates[0].getDate()}일
-
- 12:20
- AM
- PM
-
-
+
);
};
diff --git a/src/components/pages/post-meetup/modals/date-picker-modal/calendar/index.tsx b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/index.tsx
new file mode 100644
index 00000000..e9301dc0
--- /dev/null
+++ b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/index.tsx
@@ -0,0 +1,45 @@
+import { Activity, useState } from 'react';
+
+import { DatePickerStateProvider } from '@rehookify/datepicker';
+
+import { CalendarFooter } from '@/components/pages/post-meetup/modals/date-picker-modal/calendar/calendar-footer';
+import { DatePicker } from '@/components/pages/post-meetup/modals/date-picker-modal/calendar/date-picker';
+
+interface Props {
+ currentTab: 'date' | 'time';
+ handleDateChange: (selectedDate: string) => void;
+}
+
+export const Calendar = ({ currentTab, handleDateChange }: Props) => {
+ const nowDate = new Date();
+ const [selectedDates, onDatesChange] = useState([nowDate]);
+
+ return (
+
+ );
+};
diff --git a/src/components/pages/post-meetup/modals/date-picker-modal/calendar/time-picker/index.tsx b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/time-picker/index.tsx
new file mode 100644
index 00000000..08b2c0ee
--- /dev/null
+++ b/src/components/pages/post-meetup/modals/date-picker-modal/calendar/time-picker/index.tsx
@@ -0,0 +1,3 @@
+export const TimePicker = () => {
+ return ;
+};
diff --git a/src/components/pages/post-meetup/modals/date-picker-modal/index.tsx b/src/components/pages/post-meetup/modals/date-picker-modal/index.tsx
index 30cbe6f7..decdfda6 100644
--- a/src/components/pages/post-meetup/modals/date-picker-modal/index.tsx
+++ b/src/components/pages/post-meetup/modals/date-picker-modal/index.tsx
@@ -6,8 +6,8 @@ import { AnyFieldApi } from '@tanstack/react-form';
import clsx from 'clsx';
import { Icon } from '@/components/icon';
-import { DatePicker } from '@/components/pages/post-meetup/modals/date-picker-modal/date-picker';
-import { ModalContent, ModalTitle, useModal } from '@/components/ui';
+import { Calendar } from '@/components/pages/post-meetup/modals/date-picker-modal/calendar';
+import { ModalContent, ModalTitle } from '@/components/ui';
interface Props {
field: AnyFieldApi;
@@ -15,7 +15,6 @@ interface Props {
export const DatePickerModal = ({ field }: Props) => {
const [tabMenu, setTabMenu] = useState<'date' | 'time'>('date');
- const { close } = useModal();
return (
@@ -40,9 +39,11 @@ export const DatePickerModal = ({ field }: Props) => {
))}
- field.handleChange({ ...field.state.value, date })}
+ handleDateChange={(selectedDate: string) =>
+ field.handleChange({ ...field.state.value, selectedDate })
+ }
/>