Skip to content

Commit

Permalink
project component and basic display on home page
Browse files Browse the repository at this point in the history
  • Loading branch information
HWTjac0 committed Nov 17, 2023
1 parent 2eb7b4e commit 5738ad0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/components/Project.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
interface Props {
name: string;
url: string;
}
const {name, url} = Astro.props;
---

<div>
<h2 class="font-bold">{name}</h2>
<a href={url}>Sprawdź</a>
</div>

13 changes: 12 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -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}`, {
Expand All @@ -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
};
});
---

<html lang="en">
Expand All @@ -21,5 +29,8 @@ console.log(res);
</head>
<body>
<h1 class="bg-red-500">Astro 2</h1>
<main>
{projects.map((project: any) => <Project {...project} />)}
</main>
</body>
</html>

0 comments on commit 5738ad0

Please sign in to comment.