diff --git a/src/models/date.ts b/src/models/date.ts
new file mode 100644
index 0000000..5186bcf
--- /dev/null
+++ b/src/models/date.ts
@@ -0,0 +1 @@
+export type Day = '일' | '월' | '화' | '수' | '목' | '금' | '토';
diff --git a/src/pages/Coop/components/Calendar/Calendar.module.scss b/src/pages/Coop/components/Calendar/Calendar.module.scss
index fcabc41..7ac871f 100644
--- a/src/pages/Coop/components/Calendar/Calendar.module.scss
+++ b/src/pages/Coop/components/Calendar/Calendar.module.scss
@@ -1,109 +1,79 @@
.container {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ padding: 24px 24px 10px;
+ background-color: #fff;
+}
+
+.day {
+ width: 28px;
+ height: 55px;
display: flex;
flex-direction: column;
+ justify-content:space-between;
+ align-items: center;
+ background-color: transparent;
+ cursor: pointer;
+}
+
+.day-of-week {
font-family: Pretendard, sans-serif;
- margin-top: 24px;
- gap: 10px;
+ font-size: 13px;
+ font-weight: 400;
+ line-height: 20.8px;
+ text-align: center;
+ color: #8e8e8e;
- &__calendar {
- display: flex;
- flex-direction: column;
- font-family: Pretendard, sans-serif;
- padding-top: 24px;
- padding-bottom: 8px;
- gap: 16px;
- background-color: #fff;
+ &--after,
+ &--selected {
+ color: #4b4b4b;
}
+}
- &__week {
- display: flex;
- justify-content: space-around;
- text-align: center;
- color: #8e8e8e;
- font-size: 13px;
- font-weight: 400;
- padding: 0 16px;
- }
+.date {
+ position: relative;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ font-family: Pretendard, sans-serif;
+ font-size: 16px;
+ font-weight: 500;
+ line-height: 25.6px;
+ text-align: center;
+ color: #000;
+ width: 28px;
+ height: 28px;
+ border-radius: 99px;
+ background-color: transparent;
+ border: none;
+ padding-top: 2px;
+ box-sizing: border-box;
- &__date {
- display: flex;
- justify-content: space-around;
- align-items: center;
- text-align: center;
+ &--previous {
color: #8e8e8e;
- font-size: 16px;
- font-weight: 500;
- padding: 0 16px;
-
- &--future {
- color: #000;
- }
-
- &--today-font {
- color: #175c8e;
- }
+ }
- &--selected {
- display: flex;
- width: 28px;
- height: 28px;
- padding: 4px;
- margin: -8px;
- border-radius: 999px;
- background-color: #175c8e;
- justify-content: center;
- align-items: center;
- font-size: 16px;
- font-weight: 500;
- color: #fff;
- -webkit-tap-highlight-color: rgb(0 0 0 / 0%);
- -webkit-tap-highlight-color: transparent;
- }
+ &--today {
+ font-size: 15px;
+ line-height: 24px;
+ color: #175c8e;
+ border: 1px solid #175c8e;
- &--today {
- display: flex;
- width: 28px;
- height: 28px;
- padding: 2px;
- margin: -7px;
+ &::after {
+ content: '';
+ position: absolute;
+ bottom: -9px;
border: 1px solid #175c8e;
- border-radius: 999px;
- justify-content: center;
- align-items: center;
- font-size: 16px;
- font-weight: 500;
+ width: 11.5px;
+ border-radius: 10px;
}
-
- &--common {
- width: 20px;
- height: 20px;
- }
-
- &--wrapper {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- gap: 4px;
- }
- }
-
- &__today--border {
- display: flex;
- width: 12px;
- margin-top: 10px;
- border-bottom: 2px solid #175c8e;
- border-radius: 999px;
}
- &__common--border {
- display: flex;
- border-color: none;
- margin-top: 10px;
- border-bottom: 2px solid none;
+ &--selected {
+ font-size: 15px;
+ line-height: 24px;
+ color: #fff;
+ background-color: #175c8e;
}
}
-
-.cursor-pointer {
- cursor: pointer;
-}
diff --git a/src/pages/Coop/components/Calendar/index.tsx b/src/pages/Coop/components/Calendar/index.tsx
index 0ed42ea..86e9019 100644
--- a/src/pages/Coop/components/Calendar/index.tsx
+++ b/src/pages/Coop/components/Calendar/index.tsx
@@ -1,67 +1,49 @@
-import { getDayOfWeek } from 'pages/Coop/hook/useGetDayOfWeek';
import cn from 'utils/className';
+import { getDayOfWeek } from 'utils/date';
import dayjs from 'dayjs';
import styles from './Calendar.module.scss';
-interface DateProps {
- selectedDate: string;
+interface Props {
+ selectedDate: string; // .format('YYYY-MM-DD') 형식
setSelectedDate: (dateType: string) => void;
}
-export default function Calendar({ selectedDate, setSelectedDate }: DateProps) {
+export default function Calendar({ selectedDate, setSelectedDate }: Props) {
const today = dayjs();
- const weekDays = Array.from({ length: 7 }, (_, i) => today.add(i - 3, 'day'));
+ const weekDays = Array.from(
+ { length: 7 },
+ (_, i) => today.add(i - 3, 'day').format('YYYY-MM-DD'),
+ );
return (
-
-
- {weekDays.map((day) => (
-
-
{getDayOfWeek(day.format('YYYY-MM-DD'))}
-
- ))}
-
-
- {weekDays.map((day) => {
- const dayFormat = day.format('YYYY-MM-DD');
- return (
-
setSelectedDate(dayFormat)}
- className={cn({
- [styles['container__date--wrapper']]: true,
- [styles['container__date--future']]: day.isAfter(today, 'day'),
- [styles['container__date--today-font']]: day.isSame(today, 'day'),
- })}
- onKeyDown={(event) => {
- if (event.key === 'Enter' || event.key === ' ') {
- setSelectedDate(dayFormat);
- }
- }}
- >
-
- {day.format('DD')}
-
-
-
- );
- })}
-
+
+ {weekDays.map((day) => (
+
+ ))}
);
}
diff --git a/src/pages/Coop/components/MenuCard/index.tsx b/src/pages/Coop/components/MenuCard/index.tsx
index d48303f..d4f4935 100644
--- a/src/pages/Coop/components/MenuCard/index.tsx
+++ b/src/pages/Coop/components/MenuCard/index.tsx
@@ -20,8 +20,8 @@ import axios from 'axios';
import styles from './MenuCard.module.scss';
interface Props {
- selectedMenuType: DiningType;
- selectedDate: string;
+ diningType: DiningType;
+ date: string;
}
interface FileInfo {
@@ -29,16 +29,16 @@ interface FileInfo {
presignedUrl: string;
}
-export default function MenuCard({ selectedMenuType, selectedDate }: Props) {
+export default function MenuCard({ diningType, date }: Props) {
const { uploadDiningImageMutation } = useUploadDiningImage();
const { toggleSoldOut } = useSoldOut();
const fileInputRefs = useRef<{ [key: number]: HTMLInputElement | null }>({});
const [isSoldOutModalOpen, setIsSoldOutModalOpen] = useState(false);
const [selectedMenu, setSelectedMenu] = useState
(null);
- const formattedDate = selectedDate.replace('-', '').replace('-', '').substring(2);
+ const formattedDate = date.replace('-', '').replace('-', '').substring(2);
const { data: dinings } = useGetDinings(formattedDate);
const [openMenu, setOpenMenu] = useState(
- getOpenMenuType(selectedMenuType, formattedDate),
+ getOpenMenuType(diningType, formattedDate),
);
const uploadImage = async ({ presignedUrl, file }: FileInfo) => {
@@ -97,8 +97,8 @@ export default function MenuCard({ selectedMenuType, selectedDate }: Props) {
};
useEffect(() => {
- setOpenMenu(getOpenMenuType(selectedMenuType, formattedDate));
- }, [selectedMenuType, formattedDate]);
+ setOpenMenu(getOpenMenuType(diningType, formattedDate));
+ }, [diningType, formattedDate]);
return (
}>
diff --git a/src/pages/Coop/components/MenuType/index.tsx b/src/pages/Coop/components/MenuType/index.tsx
index 3b24b6d..31098a7 100644
--- a/src/pages/Coop/components/MenuType/index.tsx
+++ b/src/pages/Coop/components/MenuType/index.tsx
@@ -4,20 +4,20 @@ import cn from 'utils/className';
import styles from './MenuType.module.scss';
interface MenuTypeProps {
- selectedMenuType: DiningType;
- setSelectedMenuType: (menuType: DiningType) => void;
+ diningType: DiningType;
+ setDiningType: (diningType: DiningType) => void;
}
-export default function MenuType({ selectedMenuType, setSelectedMenuType }: MenuTypeProps) {
+export default function MenuType({ diningType, setDiningType }: MenuTypeProps) {
return (