-
Notifications
You must be signed in to change notification settings - Fork 10
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
12 changed files
with
296 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true | ||
"useTabs": false, | ||
"printWidth": 80 | ||
} |
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
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,16 @@ | ||
import React from 'react'; | ||
import Header from './Header'; | ||
import Weeks from './Weeks'; | ||
|
||
export default function Calendar({ currentMonth, preMonth, nextMonth }) { | ||
return ( | ||
<div> | ||
<Header | ||
currentMonth={currentMonth} | ||
preMonth={preMonth} | ||
nextMonth={nextMonth} | ||
/> | ||
<Weeks currentMonth={currentMonth} /> | ||
</div> | ||
); | ||
} |
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,15 @@ | ||
.days { | ||
display: flex; | ||
justify-content: space-around; | ||
font-size: 15px; | ||
} | ||
.each_days { | ||
width: 40px; | ||
text-align: center; | ||
} | ||
@media screen and (min-width: 1200px) { | ||
.days { | ||
font-size: 20px; | ||
padding: 10px 20px; | ||
} | ||
} |
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,16 @@ | ||
import React from 'react'; | ||
import './Days.css'; | ||
|
||
export default function Days() { | ||
const days = ['SUN', 'MON', 'THU', 'WED', 'THRS', 'FRI', 'SAT']; | ||
const days_s = []; | ||
|
||
for (let i = 0; i < 7; i++) { | ||
days_s.push( | ||
<div className="each_days" key={i}> | ||
{days[i]} | ||
</div> | ||
); | ||
} | ||
return <div className="days">{days_s}</div>; | ||
} |
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 @@ | ||
.header { | ||
padding: 20px 10px 20px 10px; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
.current_month { | ||
font-size: 90px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
.current_year { | ||
font-size: 15px; | ||
} | ||
.month_button { | ||
color: rgb(223, 197, 138); | ||
cursor: pointer; | ||
width: 35px; | ||
height: 35px; | ||
font-size: 30px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
.month_button:hover { | ||
color: black; | ||
} |
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,40 @@ | ||
import React, { useState } from 'react'; | ||
import { addMonths, subMonths, format } from 'date-fns'; | ||
import './Header.css'; | ||
import Days from './Days'; | ||
import Weeks from './Weeks'; | ||
|
||
export default function Header() { | ||
const [currentMonth, setCurrentMonth] = useState(new Date()); | ||
const [currentDate, setCurrentDate] = useState(new Date()); | ||
|
||
const preMonth = () => { | ||
setCurrentMonth(subMonths(currentMonth, 1)); | ||
}; | ||
|
||
const nextMonth = () => { | ||
setCurrentMonth(addMonths(currentMonth, 1)); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div className="header"> | ||
<span className="month_button" onClick={preMonth}> | ||
{'<'} | ||
</span> | ||
|
||
<div className="current_month"> | ||
{format(currentMonth, 'M')} | ||
<span className="current_year">{format(currentMonth, 'yyyy')}</span> | ||
</div> | ||
|
||
<span className="month_button" onClick={nextMonth}> | ||
{'>'} | ||
</span> | ||
</div> | ||
|
||
<Days /> | ||
<Weeks currentMonth={currentMonth} currentDate={currentDate} /> | ||
</div> | ||
); | ||
} |
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,38 @@ | ||
.month { | ||
display: flex; | ||
flex-direction: column; | ||
font-size: 15px; | ||
} | ||
.one_month { | ||
display: flex; | ||
justify-content: space-around; | ||
margin: 20px 0; | ||
} | ||
.one_weeksame_month { | ||
width: 40px; | ||
text-align: center; | ||
} | ||
.one_weeksame_month:hover { | ||
color: rgb(255, 222, 121); | ||
} | ||
.one_weeksame_day { | ||
width: 40px; | ||
text-align: center; | ||
color: rgb(193, 141, 18); | ||
font-weight: bold; | ||
} | ||
.one_weeksame_day:hover { | ||
color: rgb(255, 222, 121); | ||
} | ||
.one_weeknot_same_month { | ||
color: gray; | ||
width: 40px; | ||
text-align: center; | ||
} | ||
|
||
@media screen and (min-width: 1200px) { | ||
.month { | ||
font-size: 20px; | ||
padding: 0 20px; | ||
} | ||
} |
Oops, something went wrong.