Skip to content

Commit

Permalink
fix: 코드 중복 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
JeongWon-CHO committed Oct 15, 2024
1 parent 803938f commit 4c17f44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/Coop/components/Calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export default function Calendar({ selectedDate, setSelectedDate }: CalendarProp
setSelectedDate(today);
};

const getSelectedDate = () => `${selectedDate.getMonth() + 1}${selectedDate.getDate()}${DAYS[selectedDate.getDay()]}요일`;

return (
<div>
{isMobile ? (
Expand All @@ -108,7 +110,7 @@ export default function Calendar({ selectedDate, setSelectedDate }: CalendarProp
{dateListFormState === 'month' ? '월간 식단' : '주간 식단'}
</div>
<div className={styles['title--sub-mobile']}>
{`${selectedDate.getMonth() + 1}${selectedDate.getDate()}${DAYS[selectedDate.getDay()]}요일`}
{getSelectedDate()}
</div>
</div>

Expand Down Expand Up @@ -176,7 +178,7 @@ export default function Calendar({ selectedDate, setSelectedDate }: CalendarProp
{dateListFormState === 'month' ? '월간 식단' : '주간 식단'}
</div>
<div className={styles['title--sub']}>
{`${selectedDate.getMonth() + 1}${selectedDate.getDate()}${DAYS[selectedDate.getDay()]}요일`}
{getSelectedDate()}
</div>
<div className={styles['move-wrapper']}>
<DateMover
Expand Down

0 comments on commit 4c17f44

Please sign in to comment.