From fabc7e704936516e372de471cd86312a2596cd03 Mon Sep 17 00:00:00 2001 From: Ayo Date: Tue, 27 Sep 2022 15:46:41 +0200 Subject: [PATCH] feat: suport repo cards (#2) --- src/GithubStats.astro | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/GithubStats.astro b/src/GithubStats.astro index 8d7aa30..41bcad5 100644 --- a/src/GithubStats.astro +++ b/src/GithubStats.astro @@ -1,6 +1,15 @@ --- -const { username } = Astro.props; -const url = "https://github-readme-stats.vercel.app/api/" - + `?username=${username}`; +export interface Props { + username: string; + repo?: string; +} +const { username, repo } = Astro.props; +const baseUrl = 'https://github-readme-stats.vercel.app/api/'; +let url = `${baseUrl}?username=${username}`; + +if (repo) { + url = `${baseUrl}/pin/?username=${username}&repo=${repo}`; +} --- +