Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat#1 eun bean/calendar #13

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bc377e8
[ feat ] Header ์ปดํฌ๋„ŒํŠธ ์ƒ์„ฑ
eunbeann Jun 29, 2023
ccc66e0
[ etc ] ์บ˜๋ฆฐ๋” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜
eunbeann Jun 30, 2023
c0c42d5
[ feat ] ์บ˜๋ฆฐ๋” ์ดˆ๊ธฐ ์„ธํŒ…
eunbeann Jun 30, 2023
df026fb
[ etc ] delete React-Calendar
eunbeann Jul 1, 2023
0fc12fa
[ etc ] react-big-calendar ์„ค์น˜
eunbeann Jul 1, 2023
2bb44be
[ feat ] ์บ˜๋ฆฐ๋” ์ดˆ๊ธฐ ์„ธํŒ…
eunbeann Jul 1, 2023
8375bb9
[ feat ] ์บ˜๋ฆฐ๋” ํ—ค๋” ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€, ๊ธฐ๋ณธ ์ด๋ฒคํŠธ ์ถ”๊ฐ€
eunbeann Jul 1, 2023
1cc3b3d
[ feat ] ํˆดํŒ ํ…Œ์ŠคํŠธ
eunbeann Jul 1, 2023
cdda823
[ style ] ์ปค์Šคํ…€์šฉ CSS ๋ณ€๊ฒฝ;
eunbeann Jul 1, 2023
7c4498a
[ feat ] id ์ถ”๊ฐ€
eunbeann Jul 1, 2023
1dd811f
[ feat ] ๊ฐ™์€ ๋‚  ๋‹ค๋ฅธ ์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€
eunbeann Jul 1, 2023
bb0a448
[ feat ] ์ƒ์ˆ˜ ํŒŒ์ผ ์‚ญ์ œ
eunbeann Jul 1, 2023
5275a7a
[ feat ] ์ปฌ๋Ÿฌ ์„ธํŒ…์„ ์œ„ํ•œ ํƒ€์ž… ์ง€์ •
eunbeann Jul 1, 2023
ca85f7b
[ faet ] ํŽธํ•œ ์ž‘์—…์„ ์œ„ํ•œ ๋ฉ”์ธ ๋ผ์šฐํ„ฐ ์„ค์ • ๐Ÿ˜‰
eunbeann Jul 1, 2023
ae8b3d0
[ feat ] ์ปค์Šคํ…€ ์ด๋ฒคํŠธ ์ถ”๊ฐ€
eunbeann Jul 1, 2023
57f5d17
[ feat ] ์ƒ์ˆ˜ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€
eunbeann Jul 1, 2023
39a162f
[ feat ] ์ฃผ๊ฐ„ ํ’€๋„ค์ž„์œผ๋กœ ๋ณ€๊ฒฝ
eunbeann Jul 2, 2023
8105457
[ etc ] react-moment ์„ค์น˜
eunbeann Jul 4, 2023
b98bb5a
[ feat ] ํ•œ๊ธ€ํ™”
eunbeann Jul 4, 2023
a0ec53e
[ feat ] ํ•œ๊ธ€ ~์š”์ผ
eunbeann Jul 4, 2023
2bce959
[ design ] ํ‘œ ๋ณด๋” ์ˆ˜์ •
eunbeann Jul 4, 2023
0292cbc
[ styles ] ๋‚ ์งœ ์š”์ผ๋งŒ ๋ณด์ด๊ฒŒ
eunbeann Jul 4, 2023
e6142e1
[ style ] ์ž์ž˜ ์ˆ˜์ •๋“ค
eunbeann Jul 4, 2023
a64df20
[ feat ] ์ƒ์ˆ˜ ์ด๋ฒคํŠธ ๋ฐ์ดํ„ฐ ํƒ€์ž… ์ง€์ •
eunbeann Jul 5, 2023
86e03e3
[ style ] ์ƒ์ˆ˜ ๋ฐ์ดํ„ฐ ์ˆ˜์ •
eunbeann Jul 5, 2023
3d270c8
[ feat ] ์ด๋ฒคํŠธ ๋ฐ์ดํ„ฐ 7์›”๋กœ ์ˆ˜์ •
eunbeann Jul 5, 2023
1d8321c
[ style ] ๋ฐ”๋ณด.. ๋‹ฌ์€ ์›๋ž˜ 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค : ์›์ƒ๋ณต๊ท€
eunbeann Jul 5, 2023
d663e4b
[ feat ] ์ผ์š”์ผ ๋นจ๊ฐ„์ƒ‰ ๋ณ€๊ฒฝ
eunbeann Jul 5, 2023
0c45bdd
[ style ] ๋งˆ๋ฌด๋ฆฌ ์ˆ˜์ •
eunbeann Jul 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/fruit.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
as="style"
crossorigin="anonymous"
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.css" />
<link href="https://webfontworld.github.io/kt/YDestreet.css" rel="stylesheet" />
<title>web-pre-task</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
<html lang="ko">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/fruit.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" as="style" crossorigin="anonymous"
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.css" />
<link href="https://webfontworld.github.io/kt/YDestreet.css" rel="stylesheet" />
<title>web-pre-task</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
"format": "prettier --write --cache ."
},
"dependencies": {
"@types/react-big-calendar": "^1.6.4",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-simple-import-sort": "^10.0.0",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-big-calendar": "^1.8.1",
"react-dom": "^18.2.0",
"react-moment": "^1.1.3",
"react-query": "^3.39.3",
"react-router-dom": "^6.14.0",
"recoil": "^0.7.7",
Expand Down
1 change: 1 addition & 0 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function Router() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<EunBean />} />
<Route path="/eun-bean" element={<EunBean />} />
<Route path="/hee-jung" element={<HeeJung />} />
<Route path="/hye-in" element={<Hyein />} />
Expand Down
Empty file removed src/components/eunBean/.keep
Empty file.
103 changes: 103 additions & 0 deletions src/components/eunBean/BeanCalendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { styled } from "styled-components";
import { Calendar, momentLocalizer } from "react-big-calendar";
import moment from "moment";
// ํ•œ๊ธ€ ๋„ฃ๊ธฐ
import "moment/dist/locale/ko";

import "./calendar-style/calendarStyles.css";
import Toolbar from "./calendar-component/Toolbar";
import DateHeader from "./calendar-component/DateHeader";
import { EVENT_LIST } from "./calendar-data/CalendarConstnat";

export default function BeanCalendar() {
// locale ํ•œ๊ธ€๋กœ ์„ค์ •
moment.locale("ko-KR");
// localizer ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ
const localizer = momentLocalizer(moment);

// ์ผ์ • ๋“ฑ๋ก => ์นดํ…Œ๊ณ ๋ฆฌ ๋งˆ๋‹ค ์ƒ‰ ๊ตฌ๋ถ„
const components = {
event: (props: any) => {
// ์‹œ๊ฐ„ ๋งŒ๋“ค๊ธฐ
const dateString = props.event.start;
const dateObject = new Date(dateString);
const timeString = dateObject.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false });
const eventType = props?.event?.type;

// ์ด๋ฒคํŠธ ์ƒ‰ ์ฃผ๊ธฐ
switch (eventType) {
case "ํ† ๋งˆํ† ":
return (
<Event style={{ background: "yellow" }}>
{props.title} {timeString}
</Event>
);
case "ํ‚ค์œ„":
return (
<Event style={{ background: "beige" }}>
{props.title} {timeString}
</Event>
);
case "๋ฐ”๋‚˜๋‚˜":
return (
<Event style={{ background: "lightgrey" }}>
{props.title} {timeString}
</Event>
);
case "์ฒด๋ฆฌ":
return (
<Event style={{ background: "lightblue" }}>
{props.title} {timeString}
</Event>
);
case "๋ณต์ˆญ์•„":
return (
<Event style={{ background: "lightpink" }}>
{props.title} {timeString}
</Event>
);
default:
return null;
}
},
};

return (
<>
<Header> ๋น„๋‹ˆ ์บ˜๋ฆฐ๋” </Header>
<CalendarWrapper>
<Calendar
localizer={localizer}
style={{ height: 500, width: 500 }}
events={EVENT_LIST}
startAccessor="start"
endAccessor="end"
components={{
...components,
toolbar: Toolbar,
dateHeader: DateHeader,
}}
/>
</CalendarWrapper>
</>
);
}

const CalendarWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
`;

const Header = styled.header`
font-size: 3rem;
text-align: center;
margin: 3rem;
`;

const Event = styled.div`
color: black;
border-radius: 3px;
height: 100%;
padding: 0.2rem;
`;
18 changes: 18 additions & 0 deletions src/components/eunBean/calendar-component/DateHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";

export default function DateHeader(props) {
const { date, label } = props;
const isSunday = new Date(date).getDay() === 0;

function headerStyle() {
return {
color: isSunday ? "red" : "inherit",
};
}

return (
<div className="rbc-date-header" style={headerStyle()}>
{label}
</div>
);
}
13 changes: 13 additions & 0 deletions src/components/eunBean/calendar-component/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default function Toolbar(props) {
const { date } = props;

const navigate = (action) => {
props.onNavigate(action);
};

return (
<div className="rbc-toolbar">
<span className="rbc-toolbar-label">{`${date.getFullYear()}๋…„ ${date.getMonth() + 1}์›”`}</span>
</div>
);
}
75 changes: 75 additions & 0 deletions src/components/eunBean/calendar-data/CalendarConstnat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
export interface eventInfo {
id: number;
title: string;
start: Date;
end: Date;
type: string;
}

// ์ด๋ฒคํŠธ ๋ฆฌ์ŠคํŠธ
export const EVENT_LIST = [
{
id: 0,
title: "์ง€์ˆ˜",
start: new Date(2023, 6, 6, 13, 0), // ์‹œ์ž‘ ์‹œ๊ฐ„ (๋…„, ์›”(0๋ถ€ํ„ฐ ์‹œ์ž‘), ์ผ, ์‹œ๊ฐ„, ๋ถ„)
end: new Date(2023, 6, 6, 14, 0), // ์ข…๋ฃŒ ์‹œ๊ฐ„ (๋…„, ์›”(0๋ถ€ํ„ฐ ์‹œ์ž‘), ์ผ, ์‹œ๊ฐ„, ๋ถ„
type: "๋ณต์ˆญ์•„",
// ๊ฐ ์ปฌ๋Ÿฌ ์ง€์ •์„ ์œ„ํ•œ type ์ง€์ •
},
{
id: 1,
title: "ํฌ์ •",
start: new Date(2023, 6, 6, 19, 0),
end: new Date(2023, 6, 6, 20, 0),
type: "ํ‚ค์œ„",
},
{
id: 2,
title: "์€๋นˆ",
start: new Date(2023, 6, 9, 18, 0),
end: new Date(2023, 6, 9, 19, 0),
type: "ํ† ๋งˆํ† ",
},
{
id: 3,
title: "์ง€์ˆ˜",
start: new Date(2023, 6, 13, 13, 0),
end: new Date(2023, 6, 13, 14, 0),
type: "๋ณต์ˆญ์•„",
},
{
id: 4,
title: "ํฌ์ •",
start: new Date(2023, 6, 16, 16, 0),
end: new Date(2023, 6, 16, 24, 0),
type: "ํ‚ค์œ„",
},
{
id: 5,
title: "์ง€์ˆ˜",
start: new Date(2023, 6, 20, 13, 0),
end: new Date(2023, 6, 20, 14, 0),
type: "๋ณต์ˆญ์•„",
},
{
id: 5,
title: "์„ฑ๊ฒฝ",
start: new Date(2023, 6, 22, 11, 0),
end: new Date(2023, 6, 22, 12, 0),
type: "์ฒด๋ฆฌ",
},
{
id: 5,
title: "์ง€์ˆ˜",
start: new Date(2023, 6, 27, 13, 0),
end: new Date(2023, 6, 27, 14, 0),
type: "๋ณต์ˆญ์•„",
},
{
id: 6,
title: "ํ˜œ์ธ",
start: new Date(2023, 6, 30, 15, 0),
end: new Date(2023, 6, 30, 16, 0),
type: "๋ฐ”๋‚˜๋‚˜",
},
];
Loading