Skip to content

Commit 7fe7408

Browse files
authored
github badge
1 parent 5be495d commit 7fe7408

File tree

3 files changed

+76
-8
lines changed

3 files changed

+76
-8
lines changed

docusaurus.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ module.exports = {
4848
type: 'html',
4949
position: 'right',
5050
value: `
51-
<div style="display: flex; align-items: center; gap: 8px;">
52-
<a href="https://github.com/SPID-Protocol-project/spidprotocol-docs" target="_blank" rel="noopener noreferrer">
53-
<img src="https://img.shields.io/github/v/release/SPID-Protocol-project/spidprotocol-docs?label=version&color=brightgreen" alt="version" />
51+
<div style="display: flex; align-items: center; gap: 6px;">
52+
<a href="https://github.com/SPID-Protocol-project/spidprotocol-docs" target="_blank" title="GitHub Repo">
53+
<img alt="version" src="https://img.shields.io/github/v/release/SPID-Protocol-project/spidprotocol-docs?label=v0.0.1&color=blueviolet" />
5454
</a>
55-
<a href="https://github.com/SPID-Protocol-project/spidprotocol-docs/stargazers" target="_blank" rel="noopener noreferrer">
56-
<img src="https://img.shields.io/github/stars/SPID-Protocol-project/spidprotocol-docs?style=social" alt="stars" />
55+
<a href="https://github.com/SPID-Protocol-project/spidprotocol-docs/stargazers" target="_blank" title="Stars">
56+
<img alt="stars" src="https://img.shields.io/github/stars/SPID-Protocol-project/spidprotocol-docs?style=social" />
5757
</a>
58-
<a href="https://github.com/SPID-Protocol-project/spidprotocol-docs/network/members" target="_blank" rel="noopener noreferrer">
59-
<img src="https://img.shields.io/github/forks/SPID-Protocol-project/spidprotocol-docs?style=social" alt="forks" />
58+
<a href="https://github.com/SPID-Protocol-project/spidprotocol-docs/network/members" target="_blank" title="Forks">
59+
<img alt="forks" src="https://img.shields.io/github/forks/SPID-Protocol-project/spidprotocol-docs?style=social" />
6060
</a>
6161
</div>
6262
`,
63-
},
63+
}
6464

6565
{
6666
type: 'search',

src/components/GitHubBadge.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React, { useEffect, useState } from 'react';
2+
3+
export default function GitHubBadge() {
4+
const [stats, setStats] = useState(null);
5+
6+
useEffect(() => {
7+
fetch('https://api.github.com/repos/SPID-Protocol-project/spidprotocol-docs')
8+
.then((res) => res.json())
9+
.then((data) => {
10+
setStats({
11+
stars: data.stargazers_count,
12+
forks: data.forks_count,
13+
});
14+
})
15+
.catch((err) => console.error('GitHub API error:', err));
16+
}, []);
17+
18+
return (
19+
<div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
20+
<a
21+
href="https://github.com/SPID-Protocol-project/spidprotocol-docs"
22+
target="_blank"
23+
rel="noopener noreferrer"
24+
style={{
25+
textDecoration: 'none',
26+
color: 'inherit',
27+
display: 'flex',
28+
alignItems: 'center',
29+
fontSize: '0.9rem',
30+
}}
31+
>
32+
<svg
33+
height="20"
34+
viewBox="0 0 16 16"
35+
version="1.1"
36+
width="20"
37+
aria-hidden="true"
38+
style={{ marginRight: '0.5rem' }}
39+
>
40+
<path
41+
fill="currentColor"
42+
d="M8 0C3.58 0 0 3.58 0 8a8 8 0 005.47 7.59c.4.07.55-.17.55-.38v-1.33C4.13
43+
14.91 3.63 13.91 3.63 13.91c-.36-.91-.88-1.15-.88-1.15-.72-.5.06-.49.06-.49.79.06
44+
1.2.82 1.2.82.71 1.21 1.87.86 2.33.66.07-.52.28-.86.5-1.06-2.67-.3-5.47-1.34-5.47-5.96
45+
0-1.31.47-2.38 1.24-3.22-.13-.3-.54-1.52.12-3.18 0 0 1.01-.32
46+
3.3 1.23a11.5 11.5 0 016 0c2.29-1.55
47+
3.3-1.23 3.3-1.23.66 1.66.25 2.88.12
48+
3.18.77.84 1.24 1.91 1.24 3.22
49+
0 4.63-2.8 5.66-5.47 5.96.29.25.54.74.54
50+
1.49v2.21c0 .21.15.46.55.38A8.01
51+
8.01 0 0016 8c0-4.42-3.58-8-8-8z"
52+
></path>
53+
</svg>
54+
<span>SPID Protocol</span>
55+
</a>
56+
{stats && (
57+
<ul style={{ listStyle: 'none', display: 'flex', gap: '1rem', margin: 0 }}>
58+
<li>{stats.stars}</li>
59+
<li>🍴 {stats.forks}</li>
60+
</ul>
61+
)}
62+
</div>
63+
);
64+
}

src/pages/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import Layout from '@theme/Layout';
33
import styles from './index.module.css';
4+
import GitHubBadge from '../components/GitHubBadge';
45

56
export default function Home() {
67
return (
@@ -9,6 +10,9 @@ export default function Home() {
910
<div className={styles.container}>
1011
<h1 className={styles.title}>SPID Protocol</h1>
1112
<p className={styles.tagline}>Smart Packets. Structured Answers. Voice-Ready.</p>
13+
<p className={styles.tagline}>Smart Packets. Structured Answers. Voice-Ready.</p>
14+
<GitHubBadge />
15+
1216
</div>
1317
</header>
1418

0 commit comments

Comments
 (0)