feat: support account card with icons
This commit is contained in:
parent
c2216a159c
commit
2781edec0a
2 changed files with 15 additions and 6 deletions
16
README.md
16
README.md
|
@ -9,7 +9,7 @@ Embed GitHub stats on your [Astro](https://astro.build) page ✨
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
1. Embed GitHub Account stats
|
1. Embed GitHub Account stats (with or without icons)
|
||||||
1. Embed GitHub Account top languages
|
1. Embed GitHub Account top languages
|
||||||
1. Embed GitHub Repositories info with stars
|
1. Embed GitHub Repositories info with stars
|
||||||
|
|
||||||
|
@ -28,13 +28,16 @@ Then use on your Astro page:
|
||||||
import GithubStats from 'astro-github-stats';
|
import GithubStats from 'astro-github-stats';
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- Add your account stats -->
|
<!-- show your account stats -->
|
||||||
<GithubStats username="ayoayco" />
|
<GithubStats username="ayoayco" />
|
||||||
|
|
||||||
<!-- Add your account stats -->
|
<!-- show your account stats w/ icons -->
|
||||||
|
<GithubStats username="ayoayco" showIcons={true} />
|
||||||
|
|
||||||
|
<!-- show your account top languages -->
|
||||||
<GithubStats username="ayoayco" topLanguages={true} />
|
<GithubStats username="ayoayco" topLanguages={true} />
|
||||||
|
|
||||||
<!-- Add a repo card with info and stars -->
|
<!-- show a repo card with info and stars -->
|
||||||
<GithubStats username="withastro" repo="astro" />
|
<GithubStats username="withastro" repo="astro" />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -44,6 +47,11 @@ Example Account Card:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
Example Account Card with Icons:
|
||||||
|
|
||||||
|
<img width="505" alt="Screen Shot 2022-09-30 at 10 59 39 PM" src="https://user-images.githubusercontent.com/4262489/193355585-c5c7b1c3-6682-4157-a013-94f8a5a21a20.png">
|
||||||
|
|
||||||
|
|
||||||
Example Account Top Languages:
|
Example Account Top Languages:
|
||||||
|
|
||||||
<img width="312" alt="Screen Shot 2022-09-29 at 9 09 05 PM" src="https://user-images.githubusercontent.com/4262489/193121588-9737c861-d08a-4103-9d9b-11bcd0c7c713.png">
|
<img width="312" alt="Screen Shot 2022-09-29 at 9 09 05 PM" src="https://user-images.githubusercontent.com/4262489/193121588-9737c861-d08a-4103-9d9b-11bcd0c7c713.png">
|
||||||
|
|
|
@ -3,10 +3,11 @@ export interface Props {
|
||||||
username: string;
|
username: string;
|
||||||
topLanguages?: boolean;
|
topLanguages?: boolean;
|
||||||
repo?: string;
|
repo?: string;
|
||||||
|
showIcons?: boolean;
|
||||||
}
|
}
|
||||||
const { username, repo, topLanguages } = Astro.props;
|
const { username, repo, topLanguages, showIcons } = Astro.props;
|
||||||
const baseUrl = 'https://github-readme-stats.vercel.app/api/';
|
const baseUrl = 'https://github-readme-stats.vercel.app/api/';
|
||||||
let url = `${baseUrl}?username=${username}`;
|
let url = `${baseUrl}?username=${username}&show_icons=${!!showIcons}`;
|
||||||
|
|
||||||
if (repo) {
|
if (repo) {
|
||||||
url = `${baseUrl}/pin/?username=${username}&repo=${repo}`;
|
url = `${baseUrl}/pin/?username=${username}&repo=${repo}`;
|
||||||
|
|
Loading…
Reference in a new issue