Skip to content

Commit 085e252

Browse files
committed
feat: 캘린더 일정 리스트 UI 추가 및 일정 메뉴버튼 추가
1 parent 63f56ef commit 085e252

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

src/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ function App() {
4747
</header>
4848
<main className="z-1 relative flex-grow">
4949
<div className="ml-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>
50+
<Calendar />
5351
</div>
5452
</main>
5553
</div>

src/components/common/Calendar.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ export function Calendar() {
104104
}, [updateSize]);
105105

106106
return (
107-
<div>
107+
<div >
108+
<div className="rounded bg-white p-6 px-4 sm:px-0">
108109
<FullCalendar
109110
ref={calendarRef}
110111
plugins={[dayGridPlugin, interactionPlugin]}
@@ -138,7 +139,10 @@ export function Calendar() {
138139
nextButton: { click: handleNext },
139140
}}
140141
/>
142+
</div>
143+
<div className='mt-10'>
141144
{selectedDate && <EventCards events={selectedEvents} date={selectedDate} />}
145+
</div>
142146
</div>
143147
);
144148
}
@@ -162,10 +166,12 @@ function renderEventContent(eventInfo: EventInfo) {
162166
}
163167

164168
function EventCards({ events, date }: EventCardsProps) {
169+
const [menuOpen, setMenuOpen] = useState(-1);
170+
165171
if (!date) {
166172
return <div>No date provided</div>; // date가 null인 경우 처리
167173
}
168-
174+
169175
const formattedDate = new Date(date)
170176
.toLocaleDateString('ko-KR', {
171177
year: 'numeric',
@@ -174,16 +180,29 @@ function EventCards({ events, date }: EventCardsProps) {
174180
})
175181
.replace(/\. /g, '.')
176182
.slice(0, -1);
177-
console.log(formattedDate);
178183

179184
return (
180185
<div>
181-
<h2>{formattedDate}</h2>
182-
<div className="flex overflow-x-auto">
186+
<h2 className="ml-2">{formattedDate}</h2>
187+
<div className="flex overflow-x-auto gap-5">
183188
{events.map((event, index) => (
184-
<div key={index} className="m-2 min-w-[200px] bg-blue-200 p-2 text-white">
189+
<div key={index} className="min-w-[240px] min-h-[150px] bg-white p-4 text-black relative">
185190
<h3>{event.title}</h3>
186-
<p>{new Date(event.start).toLocaleTimeString()}</p>
191+
<p className="text-xs mt-1">{new Date(event.start).toLocaleTimeString()}</p>
192+
{/* 메뉴 버튼 */}
193+
<div className="flex flex-col items-center justify-center cursor-pointer absolute top-2 right-2" onClick={() => setMenuOpen(menuOpen === index ? -1 : index)}>
194+
<div className="w-1 h-1 bg-[#429400] rounded-full mb-1"></div>
195+
<div className="w-1 h-1 bg-[#429400] rounded-full mb-1"></div>
196+
<div className="w-1 h-1 bg-[#429400] rounded-full"></div>
197+
</div>
198+
{menuOpen === index && (
199+
<div className="absolute right-0 top-10 bg-white shadow-md rounded-lg z-10">
200+
<ul>
201+
<li className="p-2 hover:bg-gray-100 cursor-pointer">편집</li>
202+
<li className="p-2 hover:bg-gray-100 cursor-pointer">삭제</li>
203+
</ul>
204+
</div>
205+
)}
187206
</div>
188207
))}
189208
</div>

0 commit comments

Comments
 (0)