From 5738ad0997859b8eb403a25e5c62cc83d309aa2e Mon Sep 17 00:00:00 2001 From: HWTjac0 Date: Fri, 17 Nov 2023 20:24:21 +0100 Subject: [PATCH] project component and basic display on home page --- src/components/Project.astro | 13 +++++++++++++ src/pages/index.astro | 13 ++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/components/Project.astro diff --git a/src/components/Project.astro b/src/components/Project.astro new file mode 100644 index 0000000..17d8405 --- /dev/null +++ b/src/components/Project.astro @@ -0,0 +1,13 @@ +--- +interface Props { + name: string; + url: string; +} +const {name, url} = Astro.props; +--- + +
+

{name}

+ Sprawdź +
+ diff --git a/src/pages/index.astro b/src/pages/index.astro index 8591fb8..8912345 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,5 +1,6 @@ --- import { octokit } from "../utilities/github"; +import Project from "../components/Project.astro"; const per_page = 3; const res = await octokit.request(`GET /orgs/{org}/repos?per_page=${per_page}`, { @@ -8,7 +9,14 @@ const res = await octokit.request(`GET /orgs/{org}/repos?per_page=${per_page}`, 'X-GitHub-Api-Version': '2022-11-28' } }); -console.log(res); + +const projects = res.data.map(project => { + return { + name: project.name, + url: project.html_url + }; +}); + --- @@ -21,5 +29,8 @@ console.log(res);

Astro 2

+
+ {projects.map((project: any) => )} +