Skip to content

Commit c219899

Browse files
committed
feat: Add hover card glow effect and glitch effect
1 parent 3e66eee commit c219899

File tree

8 files changed

+828
-150
lines changed

8 files changed

+828
-150
lines changed

package-lock.json

Lines changed: 591 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": {
3+
"http-server": "^14.1.1"
4+
}
5+
}

script.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

contributors.json renamed to src/contributors.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[
2+
"saurabhkun",
23
"sanjanamutkiri",
34
"komal",
45
"SotaKabasawa",
File renamed without changes.

src/script.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
const grid = document.getElementById("devGrid");
2+
const searchInput = document.getElementById("search");
3+
4+
fetch("../contributors.json")
5+
.then((res) => res.json())
6+
.then((usernames) => {
7+
usernames.forEach((username, index) => {
8+
fetch(`https://api.github.com/users/${username}`)
9+
.then((res) => res.json())
10+
.then((user) => {
11+
if (!user || user.message === "Not Found") {
12+
console.warn(`User ${username} not found.`);
13+
return;
14+
}
15+
16+
fetch(user.repos_url)
17+
.then((res) => res.json())
18+
.then((repos) => {
19+
if (!Array.isArray(repos)) {
20+
console.warn(
21+
`Repo data for ${username} is not an array:`,
22+
repos,
23+
);
24+
return;
25+
}
26+
27+
const langCount = {};
28+
repos.forEach((repo) => {
29+
if (repo.language) {
30+
langCount[repo.language] =
31+
(langCount[repo.language] || 0) + 1;
32+
}
33+
});
34+
35+
const topLangs =
36+
Object.entries(langCount)
37+
.sort((a, b) => b[1] - a[1])
38+
.slice(0, 3)
39+
.map((entry) => entry[0])
40+
.join(", ") || "N/A";
41+
42+
const card = document.createElement("div");
43+
card.className = "card";
44+
card.style.animationDelay = `${index * 0.1}s`; // staggered animation
45+
46+
card.innerHTML = `
47+
<img src="${user.avatar_url}" alt="${user.login}">
48+
<h3>${user.name || user.login}</h3>
49+
<p>@${user.login}</p>
50+
<p><strong>Top Languages:</strong> ${topLangs}</p>
51+
<a href="${user.html_url}" target="_blank">View GitHub</a>
52+
`;
53+
grid.appendChild(card);
54+
})
55+
.catch((err) =>
56+
console.error(`Error fetching repos for ${username}:`, err),
57+
);
58+
})
59+
.catch((err) =>
60+
console.error(`Failed to load user data for ${username}:`, err),
61+
);
62+
});
63+
})
64+
.catch((err) => console.error("Error loading contributors.json:", err));
65+
66+
// 🔍 Live Search
67+
searchInput.addEventListener("input", (e) => {
68+
const value = e.target.value.toLowerCase();
69+
Array.from(grid.children).forEach((card) => {
70+
const username = card.querySelector("p").textContent.toLowerCase();
71+
card.style.display = username.includes(value) ? "block" : "none";
72+
});
73+
});

src/style.css

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
body {
2+
background-color: #0f0f0f;
3+
color: #00ff88;
4+
font-family: 'Courier New', Courier, monospace;
5+
padding: 20px;
6+
}
7+
8+
h1 {
9+
font-size: 2rem;
10+
}
11+
12+
.cursor {
13+
animation: blink 1s step-start infinite;
14+
}
15+
16+
@keyframes blink {
17+
50% {
18+
opacity: 0;
19+
}
20+
}
21+
22+
.sub {
23+
font-size: 1rem;
24+
margin: 8px 0 20px 0;
25+
color: #00cc66;
26+
}
27+
28+
#search {
29+
width: 100%;
30+
padding: 10px;
31+
background-color: #1c1c1c;
32+
border: 1px solid #00ff88;
33+
color: #00ff88;
34+
margin-bottom: 20px;
35+
border-radius: 5px;
36+
}
37+
38+
.grid {
39+
display: grid;
40+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
41+
gap: 20px;
42+
}
43+
44+
/* 🔥 Updated Card Styling */
45+
.card {
46+
background-color: #1a1a1a;
47+
border: 1px solid #00ff88;
48+
padding: 15px;
49+
border-radius: 8px;
50+
text-align: center;
51+
transition: transform 0.3s ease, box-shadow 0.3s ease;
52+
position: relative;
53+
overflow: hidden;
54+
55+
/* Fade-in effect */
56+
opacity: 0;
57+
transform: translateY(10px);
58+
animation: fadeUp 0.6s ease forwards;
59+
}
60+
61+
@keyframes fadeUp {
62+
to {
63+
opacity: 1;
64+
transform: translateY(0);
65+
}
66+
}
67+
68+
/* 🔁 Hover Effects */
69+
.card::before {
70+
content: '';
71+
position: absolute;
72+
top: -50%;
73+
left: -50%;
74+
width: 200%;
75+
height: 200%;
76+
background: radial-gradient(circle, rgba(0, 255, 170, 0.2) 0%, transparent 60%);
77+
transform: rotate(25deg);
78+
opacity: 0;
79+
transition: opacity 0.4s ease;
80+
}
81+
82+
.card:hover::before {
83+
opacity: 1;
84+
}
85+
86+
.card:hover {
87+
transform: scale(1.05);
88+
border-color: #00ffaa;
89+
box-shadow: 0 0 20px rgba(0, 255, 170, 0.3);
90+
}
91+
92+
.card img {
93+
width: 80px;
94+
height: 80px;
95+
border-radius: 50%;
96+
margin-bottom: 10px;
97+
border: 2px solid #00ff88;
98+
}
99+
100+
.card h3 {
101+
margin: 5px 0;
102+
color: #ffffff;
103+
}
104+
105+
.card p {
106+
font-size: 0.85rem;
107+
margin: 3px 0;
108+
}
109+
110+
.card a {
111+
text-decoration: none;
112+
color: #00ffaa;
113+
font-weight: bold;
114+
}
115+
116+
footer {
117+
margin-top: 40px;
118+
text-align: center;
119+
font-size: 0.8rem;
120+
color: #00cc66;
121+
}
122+
123+
@keyframes glitch {
124+
0% {
125+
transform: translate(0);
126+
}
127+
128+
20% {
129+
transform: translate(-2px, 2px);
130+
}
131+
132+
40% {
133+
transform: translate(2px, -2px);
134+
}
135+
136+
60% {
137+
transform: translate(-1px, 1px);
138+
}
139+
140+
80% {
141+
transform: translate(1px, -1px);
142+
}
143+
144+
100% {
145+
transform: translate(0);
146+
}
147+
}
148+
149+
.card:hover {
150+
transform: scale(1.03);
151+
border-color: #00ffaa;
152+
box-shadow: 0 0 10px #00ffaa, 0 0 20px #00ffaa33;
153+
animation: glitch 0.3s steps(2, end) infinite;
154+
}
155+
156+
.card h3:hover {
157+
animation: glitch 0.3s steps(2, end) infinite;
158+
}

style.css

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)