HyeonJun Jeon

[Style] Combine .css

...@@ -98,6 +98,7 @@ const GridItem = ({ targetDate }) => { ...@@ -98,6 +98,7 @@ const GridItem = ({ targetDate }) => {
98 className="GridItem gi" 98 className="GridItem gi"
99 relative={month - calMonth || null} 99 relative={month - calMonth || null}
100 onClick={click} 100 onClick={click}
101 + scope={calState.scope}
101 > 102 >
102 <span className="date gi"> 103 <span className="date gi">
103 {calMonth !== month ? month + "/" + date : date} 104 {calMonth !== month ? month + "/" + date : date}
......
...@@ -3,7 +3,6 @@ import { useContext } from "react"; ...@@ -3,7 +3,6 @@ import { useContext } from "react";
3 import { useNavigate } from "react-router-dom"; 3 import { useNavigate } from "react-router-dom";
4 4
5 import { CalendarStateContext } from "../pages/Calendar"; 5 import { CalendarStateContext } from "../pages/Calendar";
6 -import "../styles/Header.css";
7 import { moveDate, toYMD } from "../utils/Dates"; 6 import { moveDate, toYMD } from "../utils/Dates";
8 7
9 const Header = () => { 8 const Header = () => {
......
...@@ -3,7 +3,6 @@ import GridItem from "./GridItem.js"; ...@@ -3,7 +3,6 @@ import GridItem from "./GridItem.js";
3 3
4 import { CalendarStateContext } from "../pages/Calendar"; 4 import { CalendarStateContext } from "../pages/Calendar";
5 import { moveDate, toSunday } from "../utils/Dates"; 5 import { moveDate, toSunday } from "../utils/Dates";
6 -import "../styles/Month.css";
7 6
8 const GridHead = () => { 7 const GridHead = () => {
9 const days = ["일", "월", "화", "수", "목", "금", "토"]; 8 const days = ["일", "월", "화", "수", "목", "금", "토"];
......
1 -import { useRef } from "react"; 1 +import { useContext, useRef } from "react";
2 import zoomSymbol from "../assets/zoom.png"; 2 import zoomSymbol from "../assets/zoom.png";
3 import ecampusSymbol from "../assets/e-Campus.png"; 3 import ecampusSymbol from "../assets/e-Campus.png";
4 +import { CalendarStateContext } from "pages/Calendar";
4 5
5 const ScheduleItem = ({ schedule, finish }) => { 6 const ScheduleItem = ({ schedule, finish }) => {
7 + const { state: calState } = useContext(CalendarStateContext);
6 const { 8 const {
7 name: subjectName, 9 name: subjectName,
8 nickname: subjectNickname, 10 nickname: subjectNickname,
...@@ -19,6 +21,8 @@ const ScheduleItem = ({ schedule, finish }) => { ...@@ -19,6 +21,8 @@ const ScheduleItem = ({ schedule, finish }) => {
19 } = schedule; 21 } = schedule;
20 let sTime = startTime ? startTime.substring(0, 5) : ""; //HHMM 22 let sTime = startTime ? startTime.substring(0, 5) : ""; //HHMM
21 let eTime = endTime ? endTime.substring(0, 5) : ""; 23 let eTime = endTime ? endTime.substring(0, 5) : "";
24 + const subStr =
25 + calState.scope !== "month" ? `${subjectNickname || subjectName}` : null;
22 26
23 const selectSymbol = () => { 27 const selectSymbol = () => {
24 let symbol; 28 let symbol;
...@@ -57,6 +61,11 @@ const ScheduleItem = ({ schedule, finish }) => { ...@@ -57,6 +61,11 @@ const ScheduleItem = ({ schedule, finish }) => {
57 onClick={click} 61 onClick={click}
58 ref={thisRef} 62 ref={thisRef}
59 > 63 >
64 + {subStr && (
65 + <span className="s_substr ss">
66 + {subStr} <br />
67 + </span>
68 + )}
60 <img className="s_symbol ss" src={selectSymbol()} alt="404" /> 69 <img className="s_symbol ss" src={selectSymbol()} alt="404" />
61 {startTime && <span className="s_start ss">{sTime}</span>} 70 {startTime && <span className="s_start ss">{sTime}</span>}
62 {endTime && <span className="s_end ss">{eTime}</span>} 71 {endTime && <span className="s_end ss">{eTime}</span>}
......
...@@ -3,7 +3,6 @@ import GridItem from "./GridItem.js"; ...@@ -3,7 +3,6 @@ import GridItem from "./GridItem.js";
3 3
4 import { CalendarStateContext } from "../pages/Calendar"; 4 import { CalendarStateContext } from "../pages/Calendar";
5 import { moveDate, toSunday } from "../utils/Dates"; 5 import { moveDate, toSunday } from "../utils/Dates";
6 -import "../styles/Week.css";
7 6
8 const GridHead = () => { 7 const GridHead = () => {
9 const days = ["일", "월", "화", "수", "목", "금", "토"]; 8 const days = ["일", "월", "화", "수", "목", "금", "토"];
......
1 import React, { useEffect, useReducer, useState } from "react"; 1 import React, { useEffect, useReducer, useState } from "react";
2 import { useNavigate, Route, Routes } from "react-router-dom"; 2 import { useNavigate, Route, Routes } from "react-router-dom";
3 +import localforage from "localforage";
4 +import axios from "axios";
3 5
4 import Month from "../components/Month"; 6 import Month from "../components/Month";
5 import Header from "../components/Header"; 7 import Header from "../components/Header";
6 import Side from "../components/Side"; 8 import Side from "../components/Side";
7 -import localforage from "localforage";
8 -import axios from "axios";
9 import Week from "../components/Week"; 9 import Week from "../components/Week";
10 +import Day from "components/Day";
11 +import "../styles/Calendar.css";
12 +import "../styles/Header.css";
10 13
11 export const CalendarStateContext = React.createContext(); 14 export const CalendarStateContext = React.createContext();
12 15
...@@ -80,7 +83,7 @@ const Calendar = () => { ...@@ -80,7 +83,7 @@ const Calendar = () => {
80 <Routes> 83 <Routes>
81 <Route path="/month/*" element={<Month />} /> 84 <Route path="/month/*" element={<Month />} />
82 <Route path="/week/*" element={<Week />} /> 85 <Route path="/week/*" element={<Week />} />
83 - <Route path="/day/*" element={<></>} /> 86 + <Route path="/day/*" element={<Day />} />
84 </Routes> 87 </Routes>
85 </div> 88 </div>
86 </div> 89 </div>
......
1 -.Month { 1 +.Month,
2 +.Week {
2 display: flex; 3 display: flex;
3 flex-direction: column; 4 flex-direction: column;
4 flex-grow: 1; 5 flex-grow: 1;
5 } 6 }
6 7
8 +.Grid {
9 + display: grid;
10 + grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
11 + overflow-y: scroll;
12 + height: calc(100vh - 115px);
13 + border: solid thin gray;
14 +}
15 +
16 +.Row {
17 + display: flex;
18 + overflow-y: scroll;
19 + height: calc(100vh - 115px);
20 + border: solid thin gray;
21 +}
22 +
23 +.Day {
24 + display: flex;
25 + flex-direction: column;
26 + flex-grow: 1;
27 + overflow-y: scroll;
28 + height: calc(100vh - 80px);
29 + border: solid thin gray;
30 + margin-top: 5px;
31 +}
32 +
33 +/* Common */
34 +
7 .GridItem, 35 .GridItem,
8 .GridHeadItem { 36 .GridHeadItem {
9 flex-basis: 100px; 37 flex-basis: 100px;
...@@ -33,14 +61,6 @@ ...@@ -33,14 +61,6 @@
33 margin-right: 16.8px; 61 margin-right: 16.8px;
34 } 62 }
35 63
36 -.Grid {
37 - display: grid;
38 - grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
39 - overflow-y: scroll;
40 - height: calc(100vh - 115px);
41 - border: solid thin gray;
42 -}
43 -
44 .GridItem[relative] > span { 64 .GridItem[relative] > span {
45 color: gray; 65 color: gray;
46 } 66 }
......
1 -.Week {
2 - display: flex;
3 - flex-direction: column;
4 - flex-grow: 1;
5 -}
6 -
7 -.GridItem,
8 -.GridHeadItem {
9 - flex-basis: 100px;
10 - flex-grow: 1;
11 -}
12 -
13 -.GridItem {
14 - border: solid thin lightgray;
15 - display: flex;
16 - flex-direction: column;
17 - /* height: 150px; */
18 - padding: 5px;
19 -}
20 -
21 -.GridHeadItem {
22 - height: 20px;
23 - text-align: center;
24 - line-height: 20px;
25 - padding: 10px 5px 10px 5px;
26 -}
27 -
28 -.GridHead {
29 - display: flex;
30 -}
31 -
32 -.GridHead {
33 - margin-right: 16.8px;
34 -}
35 -
36 -.Row {
37 - display: flex;
38 - overflow-y: scroll;
39 - height: calc(100vh - 115px);
40 - border: solid thin gray;
41 -}
42 -
43 -.GridItem[relative] > span {
44 - color: gray;
45 -}