Toggle navigation
Toggle navigation
This project
Loading...
Sign in
HyeonJun Jeon
/
Extended-Calendar
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
HyeonJun Jeon
2022-05-25 04:26:04 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c76d685eb504e0596eb0ae4eabaa18e65b721925
c76d685e
1 parent
7631ddab
[Fix] Day/week/month button
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
src/components/Header.js
src/components/Header.js
View file @
c76d685
import
{
useContext
}
from
"react"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
CalendarStateContext
}
from
"../pages/Calendar"
;
import
"../styles/Header.css"
;
const
Header
=
()
=>
{
const
[
state
,
setState
]
=
useContext
(
CalendarStateContext
);
const
handleChangeState
=
(
e
)
=>
{
const
navigate
=
useNavigate
();
const
setScope
=
(
e
)
=>
{
setState
({
...
state
,
[
e
.
target
.
name
]:
e
.
target
.
value
,
});
navigate
(
"/calendar/"
+
e
.
target
.
value
);
};
const
gotoToday
=
()
=>
{
...
...
@@ -78,7 +81,7 @@ const Header = () => {
<
div
className
=
"hrd"
>
<
button
disabled
=
{
state
.
scope
===
"day"
}
onClick
=
{
handleChangeStat
e
}
onClick
=
{
setScop
e
}
name
=
"scope"
value
=
"day"
>
...
...
@@ -86,7 +89,7 @@ const Header = () => {
<
/button
>
<
button
disabled
=
{
state
.
scope
===
"week"
}
onClick
=
{
handleChangeStat
e
}
onClick
=
{
setScop
e
}
name
=
"scope"
value
=
"week"
>
...
...
@@ -94,7 +97,7 @@ const Header = () => {
<
/button
>
<
button
disabled
=
{
state
.
scope
===
"month"
}
onClick
=
{
handleChangeStat
e
}
onClick
=
{
setScop
e
}
name
=
"scope"
value
=
"month"
>
...
...
Please
register
or
login
to post a comment