Skip to content

Commit 5e51e02

Browse files
committed
refactor: add MyCalendarPage
1 parent ad50f91 commit 5e51e02

File tree

3 files changed

+68
-59
lines changed

3 files changed

+68
-59
lines changed

src/App.tsx

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
1-
import { Calendar } from './components/common/Calendar.tsx';
1+
import MyCalendarPage from './pages/MyCalendarPage';
22

33
function App() {
4-
return (
5-
<div>
6-
<header className="relative z-10">
7-
<div className="drawer">
8-
<input id="my-drawer-3" type="checkbox" className="drawer-toggle" />
9-
<div className="drawer-content flex flex-col">
10-
{/* Navbar */}
11-
<div className="navbar w-full">
12-
<div className="flex-none lg:hidden">
13-
<label htmlFor="my-drawer-3" aria-label="open sidebar" className="btn btn-square btn-ghost">
14-
<svg
15-
xmlns="http://www.w3.org/2000/svg"
16-
fill="none"
17-
viewBox="0 0 24 24"
18-
className="inline-block h-6 w-6 stroke-current"
19-
>
20-
<path
21-
strokeLinecap="round"
22-
strokeLinejoin="round"
23-
strokeWidth="2"
24-
d="M4 6h16M4 12h16M4 18h16"
25-
></path>
26-
</svg>
27-
</label>
28-
</div>
29-
<div className="flex-1">
30-
<h1 className="base-200 min-w-40 p-2 text-center">개인 일정 캘린더</h1>
31-
</div>
32-
</div>
33-
</div>
34-
<div className="drawer-side">
35-
<label htmlFor="my-drawer-3" aria-label="close sidebar" className="drawer-overlay"></label>
36-
<ul className="menu min-h-full w-80 bg-base-200 p-4">
37-
{/* Sidebar content here */}
38-
<li>
39-
<a>그룹 일정 캘린더 1</a>
40-
</li>
41-
<li>
42-
<a>그룹 일정 캘린더 2</a>
43-
</li>
44-
</ul>
45-
</div>
46-
</div>
47-
</header>
48-
<main className="z-1 relative flex-grow">
49-
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
50-
<div className="rounded bg-white p-6 px-4 sm:px-0">
51-
<Calendar />
52-
</div>
53-
</div>
54-
</main>
55-
</div>
56-
);
4+
return <MyCalendarPage />;
575
}
586

597
export default App;

src/components/common/Calendar.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { useRef, useState, useEffect } from 'react';
55

66
const events = [
77
{ title: 'Meeting', start: new Date() },
8-
{ title: 'Meeting', start: '2024-05-08' },
9-
{ title: 'Meeting', start: '2024-05-08' },
10-
{ title: 'Meeting', start: '2024-05-08' },
8+
{ title: 'Meeting2', start: '2024-05-08', end: '2024-05-12' },
9+
{ title: 'Meeting3', start: '2024-05-08', end: '2024-05-10' },
10+
{ title: 'Meeting4', start: '2024-05-08', end: '2024-05-11' },
1111
];
1212

13-
export function Calendar() {
13+
const Calendar: React.FC = () => {
1414
const [calendarHeight, setCalendarHeight] = useState<string | number>('auto');
1515
const calendarRef = useRef<FullCalendar | null>(null);
1616
const handlePrev = () => {
@@ -81,7 +81,7 @@ export function Calendar() {
8181
/>
8282
</div>
8383
);
84-
}
84+
};
8585

8686
interface EventInfo {
8787
timeText: string;
@@ -98,3 +98,5 @@ function renderEventContent(eventInfo: EventInfo) {
9898
</>
9999
);
100100
}
101+
102+
export default Calendar;

src/pages/MyCalendarPage.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import Calendar from '../components/common/Calendar.tsx';
2+
3+
const MyCalendarPage: React.FC = () => {
4+
return (
5+
<div>
6+
<header className="relative z-10">
7+
<div className="drawer">
8+
<input id="my-drawer-3" type="checkbox" className="drawer-toggle" />
9+
<div className="drawer-content flex flex-col">
10+
{/* Navbar */}
11+
<div className="navbar w-full">
12+
<div className="flex-none lg:hidden">
13+
<label htmlFor="my-drawer-3" aria-label="open sidebar" className="btn btn-square btn-ghost">
14+
<svg
15+
xmlns="http://www.w3.org/2000/svg"
16+
fill="none"
17+
viewBox="0 0 24 24"
18+
className="inline-block h-6 w-6 stroke-current"
19+
>
20+
<path
21+
strokeLinecap="round"
22+
strokeLinejoin="round"
23+
strokeWidth="2"
24+
d="M4 6h16M4 12h16M4 18h16"
25+
></path>
26+
</svg>
27+
</label>
28+
</div>
29+
<div className="flex-1">
30+
<h1 className="base-200 min-w-40 p-2 text-center">개인 일정 캘린더</h1>
31+
</div>
32+
</div>
33+
</div>
34+
<div className="drawer-side">
35+
<label htmlFor="my-drawer-3" aria-label="close sidebar" className="drawer-overlay"></label>
36+
<ul className="menu min-h-full w-80 bg-base-200 p-4">
37+
{/* Sidebar content here */}
38+
<li>
39+
<a>그룹 일정 캘린더 1</a>
40+
</li>
41+
<li>
42+
<a>그룹 일정 캘린더 2</a>
43+
</li>
44+
</ul>
45+
</div>
46+
</div>
47+
</header>
48+
<main className="z-1 relative flex-grow">
49+
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
50+
<div className="rounded bg-white p-6 px-4 sm:px-0">
51+
<Calendar />
52+
</div>
53+
</div>
54+
</main>
55+
</div>
56+
);
57+
};
58+
59+
export default MyCalendarPage;

0 commit comments

Comments
 (0)