Skip to content

Commit f33b475

Browse files
committed
1.0.0
0 parents  commit f33b475

2 files changed

Lines changed: 225 additions & 0 deletions

File tree

assets/logo.png

227 KB
Loading

index.html

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
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+
<title>GitHub Profile Viewer</title>
7+
<link rel="shortcut icon" href="assets/logo.png" type="image/x-icon">
8+
<style>
9+
* {
10+
box-sizing: border-box;
11+
margin: 0;
12+
padding: 0;
13+
font-family: 'Poppins', sans-serif;
14+
}
15+
16+
body {
17+
background: radial-gradient(circle at top left, #0f172a, #020617);
18+
color: #e2e8f0;
19+
min-height: 100vh;
20+
display: flex;
21+
flex-direction: column;
22+
align-items: center;
23+
padding: 30px;
24+
}
25+
26+
h1 {
27+
font-size: 2.3rem;
28+
margin-bottom: 20px;
29+
background: linear-gradient(90deg, #60a5fa, #38bdf8, #a855f7);
30+
-webkit-background-clip: text;
31+
-webkit-text-fill-color: transparent;
32+
}
33+
34+
.search-box {
35+
display: flex;
36+
gap: 10px;
37+
margin-bottom: 40px;
38+
background: rgba(255, 255, 255, 0.08);
39+
backdrop-filter: blur(10px);
40+
padding: 10px 20px;
41+
border-radius: 12px;
42+
box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
43+
}
44+
45+
input {
46+
background: transparent;
47+
border: none;
48+
outline: none;
49+
color: #fff;
50+
width: 220px;
51+
font-size: 1rem;
52+
}
53+
54+
button {
55+
background: linear-gradient(90deg, #2563eb, #7c3aed);
56+
border: none;
57+
color: white;
58+
padding: 8px 16px;
59+
border-radius: 8px;
60+
cursor: pointer;
61+
transition: 0.3s;
62+
font-weight: 500;
63+
}
64+
65+
button:hover {
66+
background: linear-gradient(90deg, #7c3aed, #2563eb);
67+
transform: scale(1.05);
68+
}
69+
70+
.profile {
71+
background: rgba(255, 255, 255, 0.05);
72+
border-radius: 16px;
73+
padding: 30px;
74+
width: 90%;
75+
max-width: 800px;
76+
display: none;
77+
box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
78+
backdrop-filter: blur(10px);
79+
}
80+
81+
.profile-header {
82+
display: flex;
83+
align-items: center;
84+
gap: 20px;
85+
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
86+
padding-bottom: 20px;
87+
margin-bottom: 20px;
88+
}
89+
90+
.profile-header img {
91+
width: 100px;
92+
height: 100px;
93+
border-radius: 50%;
94+
border: 3px solid #38bdf8;
95+
}
96+
97+
.profile-header div h2 {
98+
font-size: 1.8rem;
99+
color: #93c5fd;
100+
}
101+
102+
.profile-header div p {
103+
color: #94a3b8;
104+
font-size: 0.95rem;
105+
}
106+
107+
.repos {
108+
display: grid;
109+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
110+
gap: 15px;
111+
}
112+
113+
.repo {
114+
background: rgba(255, 255, 255, 0.05);
115+
border-radius: 12px;
116+
padding: 15px;
117+
transition: all 0.3s ease;
118+
cursor: pointer;
119+
border: 1px solid transparent;
120+
}
121+
122+
.repo:hover {
123+
background: rgba(255, 255, 255, 0.1);
124+
border: 1px solid #38bdf8;
125+
transform: translateY(-5px);
126+
}
127+
128+
.repo h3 {
129+
font-size: 1.1rem;
130+
margin-bottom: 8px;
131+
color: #60a5fa;
132+
}
133+
134+
.repo p {
135+
font-size: 0.9rem;
136+
color: #cbd5e1;
137+
}
138+
139+
.footer {
140+
margin-top: 50px;
141+
color: #64748b;
142+
font-size: 0.85rem;
143+
}
144+
145+
.footer span {
146+
color: #38bdf8;
147+
}
148+
149+
@keyframes fadeIn {
150+
from { opacity: 0; transform: translateY(10px); }
151+
to { opacity: 1; transform: translateY(0); }
152+
}
153+
154+
.fade-in {
155+
animation: fadeIn 0.6s ease-in-out forwards;
156+
}
157+
</style>
158+
</head>
159+
<body>
160+
161+
162+
<h1>GitHub Profile Viewer</h1>
163+
164+
165+
<div class="search-box">
166+
<input type="text" id="username" placeholder="Enter GitHub username..." />
167+
<button onclick="fetchProfile()">Search</button>
168+
</div>
169+
170+
171+
<div class="profile fade-in" id="profile"></div>
172+
173+
<div class="footer">🚀 Built by <span> <a href="http://dms-menula.github.io" style="text-decoration: none;">Menula De Silva</a></span></div>
174+
175+
176+
177+
<script>
178+
async function fetchProfile() {
179+
const username = document.getElementById("username").value.trim();
180+
const profileContainer = document.getElementById("profile");
181+
if (!username) return alert("Please enter a username");
182+
183+
profileContainer.innerHTML = "<p>Loading...</p>";
184+
profileContainer.style.display = "block";
185+
186+
try {
187+
const userRes = await fetch(`https://api.github.com/users/${username}`);
188+
const userData = await userRes.json();
189+
190+
if (userData.message === "Not Found") {
191+
profileContainer.innerHTML = "<p>User not found 😕</p>";
192+
return;
193+
}
194+
195+
const repoRes = await fetch(`https://api.github.com/users/${username}/repos?sort=updated`);
196+
const repos = await repoRes.json();
197+
198+
profileContainer.innerHTML = `
199+
<div class="profile-header fade-in">
200+
<img src="${userData.avatar_url}" alt="${userData.login}">
201+
<div>
202+
<h2>${userData.name || userData.login}</h2>
203+
<p>@${userData.login}</p>
204+
<p>${userData.bio || "No bio available"}</p>
205+
<p>🌍 ${userData.location || "Unknown"}</p>
206+
<p>👥 ${userData.followers} followers • ${userData.following} following</p>
207+
<p>📦 ${userData.public_repos} public repositories</p>
208+
</div>
209+
</div>
210+
<div class="repos fade-in">
211+
${repos.map(repo => `
212+
<div class="repo" onclick="window.open('${repo.html_url}', '_blank')">
213+
<h3>${repo.name}</h3>
214+
<p>${repo.description ? repo.description.substring(0, 80) : "No description"}</p>
215+
</div>
216+
`).join("")}
217+
</div>
218+
`;
219+
} catch (error) {
220+
profileContainer.innerHTML = "<p>Something went wrong 😥</p>";
221+
}
222+
}
223+
</script>
224+
</body>
225+
</html>

0 commit comments

Comments
 (0)