From bc8216fbe26493e779ec65b01552362d93f195b5 Mon Sep 17 00:00:00 2001 From: M1000 Date: Sun, 29 Dec 2024 03:25:51 +0100 Subject: [PATCH] feat: implement Conference List & Card --- package.json | 1 + src/app/components/Conference/Card.tsx | 58 +++++++++++++++++++ src/app/components/Conference/Conference.d.ts | 16 +++++ src/app/components/Conference/List.tsx | 23 ++++++++ .../{Header.tsx => Header/index.tsx} | 2 +- src/app/page.tsx | 46 +++++++++++++++ 6 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/app/components/Conference/Card.tsx create mode 100644 src/app/components/Conference/Conference.d.ts create mode 100644 src/app/components/Conference/List.tsx rename src/app/components/{Header.tsx => Header/index.tsx} (93%) diff --git a/package.json b/package.json index 0e4d5bf..1abe152 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@internationalized/date": "^3.6.0", "@nextui-org/navbar": "^2.2.7", "@nextui-org/react": "^2.6.10", "@nextui-org/system": "^2.4.5", diff --git a/src/app/components/Conference/Card.tsx b/src/app/components/Conference/Card.tsx new file mode 100644 index 0000000..0ad34c0 --- /dev/null +++ b/src/app/components/Conference/Card.tsx @@ -0,0 +1,58 @@ +"use client"; + +import { parseDate, Time } from "@internationalized/date"; + +import { + Card, + CardBody, + CardHeader, + DateInput, + Divider, + TimeInput, +} from "@nextui-org/react"; +import { Conference } from "./Conference"; + +export const ConferenceCard = ({ + id, + title, + author, + date, + hours, +}: Conference) => { + return ( + + +
+

{title}

+

{author}

+
+
+ + + + {hours.map((hour, hourIndex) => ( +
+ + - + +
+ ))} +
+
+ ); +}; diff --git a/src/app/components/Conference/Conference.d.ts b/src/app/components/Conference/Conference.d.ts new file mode 100644 index 0000000..8898c01 --- /dev/null +++ b/src/app/components/Conference/Conference.d.ts @@ -0,0 +1,16 @@ +export interface Conference { + id: string; + title: string; + author: string; + date: string; + hours: { + start: { + hours: number; + minutes: number; + }; + end: { + hours: number; + minutes: number; + }; + }[]; +} diff --git a/src/app/components/Conference/List.tsx b/src/app/components/Conference/List.tsx new file mode 100644 index 0000000..31b6bd0 --- /dev/null +++ b/src/app/components/Conference/List.tsx @@ -0,0 +1,23 @@ +import { ConferenceCard } from "./Card"; +import { Conference } from "./Conference"; + +export const ConferenceList = ({ + conferences, +}: { + conferences: Conference[]; +}) => { + return ( +
+ {conferences.map((conference) => ( + + ))} +
+ ); +}; diff --git a/src/app/components/Header.tsx b/src/app/components/Header/index.tsx similarity index 93% rename from src/app/components/Header.tsx rename to src/app/components/Header/index.tsx index cfb06e5..527ae4a 100644 --- a/src/app/components/Header.tsx +++ b/src/app/components/Header/index.tsx @@ -15,7 +15,7 @@ export const Header = () => { const { data: session } = useSession(); return ( - +

Toogether

diff --git a/src/app/page.tsx b/src/app/page.tsx index 22ece9e..a2e62d4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,9 +1,55 @@ +import { ConferenceList } from "./components/Conference/List"; import { Header } from "./components/Header"; +const RandomConferenceData = [ + { + id: "1", + title: "Conference sur les conférences", + author: "Rémi Formentel", + date: "2021-09-01", + hours: [ + { + start: { hours: 9, minutes: 0 }, + end: { hours: 12, minutes: 0 }, + }, + { + start: { hours: 13, minutes: 0 }, + end: { hours: 15, minutes: 0 }, + }, + ], + }, + { + id: "2", + title: "Apprendre a dev pour les nuls", + author: "Fabien Taupin", + date: "2021-09-01", + hours: [ + { + start: { hours: 18, minutes: 0 }, + end: { hours: 23, minutes: 0 }, + }, + ], + }, +]; + const HomePage = () => { return ( <>
+
+
+

Cours a venir

+ +
+
+

Cours passés

+ +
+
+

Autres cours

+ +
+
); };