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-06-07 02:07:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3d795dbddbad79e7e1272fdb26110f76fcf0909c
3d795dbd
1 parent
731af35b
[Add] Week calendar
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
2 deletions
src/components/Week.js
src/pages/Calendar.js
src/styles/App.css
src/styles/Week.css
src/components/Week.js
0 → 100644
View file @
3d795db
import
React
,
{
useContext
}
from
"react"
;
import
GridItem
from
"./GridItem.js"
;
import
{
CalendarStateContext
}
from
"../pages/Calendar"
;
import
{
moveDate
,
toSunday
}
from
"../utils/Dates"
;
import
"../styles/Week.css"
;
const
GridHead
=
()
=>
{
const
days
=
[
"일"
,
"월"
,
"화"
,
"수"
,
"목"
,
"금"
,
"토"
];
const
renderItems
=
()
=>
{
const
items
=
[];
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
items
.
push
(
<
div
className
=
"GridHeadItem"
key
=
{
i
}
>
{
days
[
i
]}
<
/div
>
);
}
return
items
;
};
return
<
div
className
=
"GridHead"
>
{
renderItems
()}
<
/div>
;
};
const
Row
=
()
=>
{
const
{
state
}
=
useContext
(
CalendarStateContext
);
const
renderItems
=
()
=>
{
const
items
=
[];
const
ndate
=
new
Date
(
state
.
date
);
toSunday
(
ndate
);
for
(
let
i
=
0
;
i
<
6
;
i
++
)
{
items
.
push
(
<
GridItem
key
=
{
i
}
targetDate
=
{
new
Date
(
ndate
)}
/>
)
;
moveDate
(
ndate
,
"day"
,
1
);
}
return
items
;
};
return
<
div
className
=
"Row"
>
{
renderItems
()}
<
/div>
;
};
const
Week
=
()
=>
{
return
(
<
div
className
=
"Week"
>
<
GridHead
/>
<
Row
/>
<
/div
>
);
};
export
default
Week
;
src/pages/Calendar.js
View file @
3d795db
...
...
@@ -6,6 +6,7 @@ import Header from "../components/Header";
import
Side
from
"../components/Side"
;
import
localforage
from
"localforage"
;
import
axios
from
"axios"
;
import
Week
from
"../components/Week"
;
export
const
CalendarStateContext
=
React
.
createContext
();
...
...
@@ -77,7 +78,7 @@ const Calendar = () => {
<
Side
/>
<
Routes
>
<
Route
path
=
"/month/*"
element
=
{
<
Month
/>
}
/
>
<
Route
path
=
"/week/*"
element
=
{
<
><
/>} /
>
<
Route
path
=
"/week/*"
element
=
{
<
Week
/>
}
/
>
<
Route
path
=
"/day/*"
element
=
{
<><
/>} /
>
<
/Routes
>
<
/div
>
...
...
src/styles/App.css
View file @
3d795db
...
...
@@ -64,7 +64,7 @@ button:disabled {
}
.s_start
{
color
:
deepsky
blue
;
color
:
blue
;
/* text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white; */
}
...
...
@@ -87,6 +87,7 @@ button:disabled {
left
:
20px
;
background
:
rgb
(
246
,
246
,
246
);
border
:
solid
thin
black
;
border-radius
:
5px
;
display
:
none
;
padding
:
10px
;
cursor
:
auto
;
...
...
src/styles/Week.css
0 → 100644
View file @
3d795db
.Week
{
display
:
flex
;
flex-direction
:
column
;
flex-grow
:
1
;
}
.GridItem
,
.GridHeadItem
{
flex-basis
:
100px
;
flex-grow
:
1
;
}
.GridItem
{
border
:
solid
thin
lightgray
;
display
:
flex
;
flex-direction
:
column
;
/* height: 150px; */
padding
:
5px
;
}
.GridHeadItem
{
height
:
20px
;
text-align
:
center
;
line-height
:
20px
;
padding
:
10px
5px
10px
5px
;
}
.GridHead
{
display
:
flex
;
}
.GridHead
{
margin-right
:
16.8px
;
}
.Row
{
display
:
flex
;
overflow-y
:
auto
;
height
:
calc
(
100vh
-
115px
);
border
:
solid
thin
gray
;
}
.GridItem
[
relative
]
>
span
{
color
:
gray
;
}
Please
register
or
login
to post a comment