-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
frontend/src/components/SearchBar/Calendar/MonthlyCalendar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useRecoilValue } from 'recoil'; | ||
import { calendarModalState } from 'recoil/Atoms'; | ||
import * as S from "components/SearchBar/Calendar/CalendarStyles"; | ||
|
||
interface MonthProps { | ||
monthType: string | ||
} | ||
|
||
const MonthlyCalendar:React.FunctionComponent<MonthProps> = ({monthType}) => { | ||
const { year, month, today} = useRecoilValue(calendarModalState); | ||
const daysOfWeek: string[] = ["일", "월", "화", "수", "목", "금", "토"]; | ||
const startDay: number = new Date(year, month, 1).getDay(); | ||
const endDate: number = new Date(year, month, 0).getDate(); | ||
const emptyDates: (number | string)[] = Array(startDay).fill(""); | ||
const filledDates = Array.from({ length : endDate },(_, i) => i + 1); | ||
const dates = [...emptyDates, ...filledDates]; | ||
const calendarTemplate = dates.map((date, idx) => <div key={'date-' + idx}>{date}</div>) | ||
console.log(monthType); | ||
|
||
return ( | ||
<S.CalendarLayout> | ||
<div className="title-container"> | ||
<S.CurrentMonth> | ||
<div className="calendar-container"> | ||
|
||
<div className="year_and_month">{year}년 {month}월</div> | ||
<div className="days">{daysOfWeek.map(day => <span>{day}</span>)}</div> | ||
<div className="dates">{calendarTemplate}</div> | ||
</div> | ||
</S.CurrentMonth> | ||
</div> | ||
</S.CalendarLayout> | ||
); | ||
}; | ||
|
||
export default MonthlyCalendar; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters