From a24f3a9c22ef92063c51759581760db818254244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Skolak?= Date: Wed, 19 Jun 2024 21:19:43 +0200 Subject: [PATCH] feat: add stars count to projects (#42) --- src/app/page.tsx | 13 +++++++++++-- src/components/icons.tsx | 2 ++ src/components/project.tsx | 13 +++++++++++-- src/components/projects.tsx | 13 +++++++++++-- src/lib/data.tsx | 3 +++ 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 6d10f0f..b8e9cb5 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -7,8 +7,17 @@ import { Intro } from '@/components/intro'; import { Projects } from '@/components/projects'; import { SectionDivider } from '@/components/section-divider'; import { ThemeToggle } from '@/components/theme-toggle'; +import { projectsData } from '@/lib/data'; + +const Home = async () => { + const starsCount = await Promise.all( + projectsData.map(async ({ links }) => { + const res = await fetch(links.githubApi); + const data = await res.json(); + return data.stargazers_count; + }) + ); -const Home = () => { return ( <>
@@ -16,7 +25,7 @@ const Home = () => { - +