-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.html
More file actions
57 lines (54 loc) Β· 2.19 KB
/
index.html
File metadata and controls
57 lines (54 loc) Β· 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>First Commit Contributors</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>First Commit Contributors</h1>
<input type="text" id="searchBox" placeholder="Search by user name..." style="margin-bottom:20px;padding:8px;width:100%;max-width:320px;">
<div id="contributors"></div>
</div>
<script>
let allContributors = [];
const contributorsDiv = document.getElementById('contributors');
const searchBox = document.getElementById('searchBox');
function renderContributors(list) {
contributorsDiv.innerHTML = '';
list.forEach(contributor => {
const contributorElement = document.createElement('div');
contributorElement.className = 'contributor-card';
let linkedinHtml = '';
if (
contributor.linkedin &&
contributor.linkedin !== 'https://linkedin.com/in/yourlinkedin'
) {
linkedinHtml = `<p>LinkedIn: <a href="${contributor.linkedin}" target="_blank">${contributor.linkedin}</a></p>`;
}
contributorElement.innerHTML = `
<h2>${contributor.name}</h2>
<p>GitHub: <a href="${contributor.github}" target="_blank">${contributor.github}</a></p>
${linkedinHtml}
`;
contributorsDiv.appendChild(contributorElement);
});
}
fetch('src/data/contributors.json')
.then(response => response.json())
.then(data => {
allContributors = data;
renderContributors(allContributors);
});
searchBox.addEventListener('input', function() {
const keyword = this.value.trim().toLowerCase();
const filtered = allContributors.filter(c =>
c.name.toLowerCase().includes(keyword)
);
renderContributors(filtered);
});
</script>
</body>
</html>