From aa27c3d656009f9b34eb8deb5ce58271cdad2c41 Mon Sep 17 00:00:00 2001 From: emiliebunny Date: Wed, 14 Aug 2024 08:41:29 +0000 Subject: [PATCH] Issue #2 [Frontend]: Calendar --- src/app/page.tsx | 50 +++++++++++++++++ src/components/Calendar/Calendar.tsx | 71 ++++++++++++++++++++++++ src/components/Calendar/CalendarSlot.tsx | 5 ++ src/components/Calendar/index.tsx | 2 + src/types/Schedule.ts | 5 ++ 5 files changed, 133 insertions(+) create mode 100644 src/components/Calendar/Calendar.tsx create mode 100644 src/components/Calendar/CalendarSlot.tsx create mode 100644 src/components/Calendar/index.tsx create mode 100644 src/types/Schedule.ts diff --git a/src/app/page.tsx b/src/app/page.tsx index 2acfd44..f2e7ebc 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,4 +1,50 @@ import Image from "next/image"; +import { Calendar } from "@/components/Calendar"; +import { Schedule } from "@/types/Schedule"; + +const sample_data: Schedule[] = [ + { + "title": "Streaming", + "start": "2024-08-14T16:45:00+07:00", + "end": "2024-08-14T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-15T16:45:00+07:00", + "end": "2024-08-15T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-16T16:45:00+07:00", + "end": "2024-08-16T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-17T16:45:00+07:00", + "end": "2024-08-17T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-18T16:45:00+07:00", + "end": "2024-08-18T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-19T16:45:00+07:00", + "end": "2024-08-19T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-20T16:45:00+07:00", + "end": "2024-08-20T22:45:00+07:00" + }, + { + "title": "Streaming", + "start": "2024-08-21T16:45:00+07:00", + "end": "2024-08-21T22:45:00+07:00" + } +]; + export default function Home() { return ( @@ -28,6 +74,10 @@ export default function Home() { +
+ +
+
+
+
+ { + Array.from(Array(24).keys()).map(el => +
{`${el.toString().padStart(2, "0")}`}:00
+ ) + } +
24:00
+
+ { + lanes.map(el => ( +
+ {/* */} + +
+ )) + } +
; +} + +type LaneProps = { + title: string; + active: boolean; +}; + +function Lane({ title, active }: LaneProps) { + return
+
+ {title} +
+
+ +
+
; +} \ No newline at end of file diff --git a/src/components/Calendar/CalendarSlot.tsx b/src/components/Calendar/CalendarSlot.tsx new file mode 100644 index 0000000..8fcfaa3 --- /dev/null +++ b/src/components/Calendar/CalendarSlot.tsx @@ -0,0 +1,5 @@ +export default function CalendarSlot() { + return <> + CalendarSlot + ; +} \ No newline at end of file diff --git a/src/components/Calendar/index.tsx b/src/components/Calendar/index.tsx new file mode 100644 index 0000000..7b8fbbb --- /dev/null +++ b/src/components/Calendar/index.tsx @@ -0,0 +1,2 @@ +export { default as Calendar } from './Calendar'; +export { default as CalendarSlot } from './CalendarSlot'; diff --git a/src/types/Schedule.ts b/src/types/Schedule.ts new file mode 100644 index 0000000..5ce65c8 --- /dev/null +++ b/src/types/Schedule.ts @@ -0,0 +1,5 @@ +export type Schedule = { + title: string, + start: string, + end: string +} \ No newline at end of file