From 41aa1802ea3fe2acf76a1a0be9446218b3ead20b Mon Sep 17 00:00:00 2001 From: MarconLP <13001502+MarconLP@users.noreply.github.com> Date: Tue, 11 Apr 2023 00:43:53 +0200 Subject: [PATCH] use dynamic values --- src/pages/videos.tsx | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/pages/videos.tsx b/src/pages/videos.tsx index 3f6e529..25ba913 100644 --- a/src/pages/videos.tsx +++ b/src/pages/videos.tsx @@ -2,6 +2,7 @@ import { type NextPage } from "next"; import Head from "next/head"; import { api } from "~/utils/api"; +import Link from "next/link"; const VideoList: NextPage = () => { const hello = api.example.hello.useQuery({ text: "from tRPC" }); @@ -15,8 +16,12 @@ const VideoList: NextPage = () => {
- {[1, 2, 3].map((id) => ( - + {[ + { title: "are pings bad?", id: "4e98f4a" }, + { title: "do you really need a backend?", id: "h4b98rt" }, + { title: "how next works", id: "h7r9e" }, + ].map(({ title, id }) => ( + ))}
@@ -24,20 +29,27 @@ const VideoList: NextPage = () => { ); }; -const VideoCard = () => { +interface VideoCardProps { + title: string; + id: string; +} + +const VideoCard = ({ title, id }: VideoCardProps) => { return ( -
-
- Shoes -
-
- Are pings bad? - 12 days ago + +
+
+ Shoes +
+
+ {title} + 12 days ago +
-
+ ); };