Skip to content

Commit

Permalink
feat(docs): add contributors list to home page (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgriffing committed Apr 23, 2024
1 parent e645742 commit ee52e68
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
31 changes: 31 additions & 0 deletions apps/docs/src/components/ContributorsList.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
import type {Contributor} from "@/types/github";
import SectionHr from "./home/common/section-hr.astro";
import SectionTitle from "./home/common/section-title.astro";
let contributors: Contributor[] = [];
const contributorsResponse = await fetch("https://api.github.com/repos/Vexilla/vexilla/contributors");
if (contributorsResponse.ok) {
contributors = await contributorsResponse.json()
}
---

{Boolean(contributors.length) &&
<section class="text-emphasis body-font" id="contributors">
<div class="container px-5 py-24 mx-auto flex-col flex-wrap">
<SectionTitle> Contributors </SectionTitle>
<p class="max-w-[20rem] text-center mx-auto mt-4">Would you like to help contribute? Check out some of the open <a href="https://github.com/Vexilla/vexilla/issues" target="_blank" class="always-underline">Issues on GitHub</a>.</p>
<SectionHr />
<div class="flex items-center justify-center gap-2">
{contributors.map(contributor =>
<a href={contributor.html_url} target="_blank">
<img src={contributor.avatar_url} class="rounded-full w-16" />
</a>)}
</div>
</div>
</section>
}
2 changes: 2 additions & 0 deletions apps/docs/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import HomeFeatures from "../components/home/features.astro";
import HomeDocumentation from "../components/home/documentation.astro";
import HomeHelp from "../components/home/help.astro";
import HomeServices from "../components/home/services.astro";
import ContributorsList from "@/components/ContributorsList.astro";
---

<Layout title="Vexilla">
Expand All @@ -18,5 +19,6 @@ import HomeServices from "../components/home/services.astro";
<HomeHowItWorks />
<HomeDocumentation />
<HomeHelp />
<ContributorsList />
</main>
</Layout>
21 changes: 21 additions & 0 deletions apps/docs/src/types/github.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export interface Contributor {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
contributions: number;
}

0 comments on commit ee52e68

Please sign in to comment.