-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] 달에 따른 일수 렌더링
- Loading branch information
Showing
12 changed files
with
164 additions
and
23 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
export const pageStyle = css({ | ||
padding: '2rem 16rem', | ||
}); | ||
|
||
export const sectionStyle = css({ | ||
display: 'flex', | ||
|
||
flexDirection: 'column', | ||
gap: '2rem', | ||
|
||
overflow: 'hidden', | ||
}); | ||
|
||
export const daySectionStyle = css({ | ||
display: 'flex', | ||
|
||
borderRadius: '6px', | ||
|
||
overflow: 'scroll', | ||
|
||
scrollBehavior: 'smooth', | ||
|
||
'&::-webkit-scrollbar': { | ||
display: 'none', | ||
}, | ||
}); |
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,47 @@ | ||
import { daySectionStyle, pageStyle, sectionStyle } from '@/page/archiving/Archiving.style'; | ||
import DaySection from '@/page/archiving/component/DaySection/DaySection'; | ||
import MonthHeader from '@/page/archiving/component/MonthHeader/MonthHeader'; | ||
import { MonthType } from '@/page/archiving/type/monthType'; | ||
import { getMonthDate } from '@/page/archiving/util/getMonthDate'; | ||
import { endOfMonth } from 'date-fns'; | ||
|
||
import { useState } from 'react'; | ||
|
||
const ArchivingPage = () => { | ||
const currentDate = new Date(); | ||
const [selectedMonth, setSelectedMonth] = useState<MonthType>(`${currentDate.getMonth() + 1}월` as MonthType); | ||
const dateOfMonth = getMonthDate(selectedMonth); | ||
const endDay = endOfMonth(dateOfMonth); | ||
const [clickedDay, setClickedDay] = useState<number | null>(null); | ||
|
||
return ( | ||
<div css={pageStyle}> | ||
<section css={sectionStyle}> | ||
<MonthHeader | ||
onMonthClick={(month: MonthType) => { | ||
setSelectedMonth(month); | ||
setClickedDay(null); | ||
}} | ||
/> | ||
<div css={daySectionStyle}> | ||
{Array.from({ length: endDay.getDate() }, (_, index) => { | ||
const day = index + 1; | ||
const isEven = day % 2 === 0; | ||
const isClicked = clickedDay === day; | ||
return ( | ||
<DaySection | ||
key={day} | ||
day={day} | ||
isClicked={isClicked} | ||
isEven={isEven} | ||
onDayClick={() => setClickedDay(day)} | ||
/> | ||
); | ||
})} | ||
</div> | ||
</section> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ArchivingPage; |
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
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
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,13 @@ | ||
export type MonthType = | ||
| '1월' | ||
| '2월' | ||
| '3월' | ||
| '4월' | ||
| '5월' | ||
| '6월' | ||
| '7월' | ||
| '8월' | ||
| '9월' | ||
| '10월' | ||
| '11월' | ||
| '12월'; |
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,9 @@ | ||
import { MONTHS } from '@/page/archiving/constant/month'; | ||
import { MonthType } from '@/page/archiving/type/monthType'; | ||
|
||
export const getMonthDate = (monthName: MonthType) => { | ||
const monthIndex = MONTHS.indexOf(monthName); | ||
const year = new Date().getFullYear(); | ||
|
||
return new Date(year, monthIndex); | ||
}; |
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