Skip to content

Commit 7b204c6

Browse files
a quick github stats tool
1 parent 3b9bfa9 commit 7b204c6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

githubstats/index.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<script src="https://cdn.tailwindcss.com"></script>
7+
<title>GitHub Stats</title>
8+
</head>
9+
<body class="bg-[#b8feff] flex min-h-screen items-center justify-center">
10+
<div class="p-8 mx-3 rounded bg-[#97f3f5] shadow-xl">
11+
<div class="text-center">
12+
<h1 class="mb-4 text-2xl font-bold">GitHub Stats</h1>
13+
<div class="mb-4">
14+
<label for="username" class="block text-gray-700">Enter GitHub Username:</label>
15+
<input type="text" id="username" class="mt-1 block w-full p-2 border border-gray-300 rounded" placeholder="e.g., username">
16+
<button id="fetchStats" class="mt-3 bg-blue-500 text-white py-2 px-4 rounded hover:bg-blue-600 active:bg-blue-800">Fetch Stats</button>
17+
</div>
18+
<div id="stats" class="mt-6 flex flex-col items-center space-y-4">
19+
<img id="topLangs" src="" alt="Top Languages" class="max-w-full rounded-lg shadow-md">
20+
<img id="streakStats" src="" alt="Streak Stats" class="max-w-full rounded-lg shadow-md">
21+
</div>
22+
</div>
23+
</div>
24+
<script>
25+
document.getElementById('fetchStats').addEventListener('click', function() {
26+
const username = document.getElementById('username').value.trim();
27+
if (username) {
28+
const topLangsUrl = `https://github-readme-stats.vercel.app/api/top-langs?username=${username}&show_icons=true&locale=en&layout=compact`;
29+
const streakStatsUrl = `https://github-readme-streak-stats.herokuapp.com/?user=${username}`;
30+
31+
document.getElementById('topLangs').src = topLangsUrl;
32+
document.getElementById('streakStats').src = streakStatsUrl;
33+
} else {
34+
alert('Please enter a GitHub username.');
35+
}
36+
});
37+
</script>
38+
</body>
39+
</html>

0 commit comments

Comments
 (0)