-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (22 loc) · 788 Bytes
/
Copy pathscript.js
File metadata and controls
27 lines (22 loc) · 788 Bytes
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
// script.js
const projectsContainer = document.getElementById('projects');
fetch('https://api.github.com/users/coderooz/repos')
.then(response => response.json())
.then(data => {
data.forEach(project => {
const projectCard = createProjectCard(project);
projectsContainer.appendChild(projectCard);
});
})
.catch(error => console.error('Error fetching GitHub projects:', error));
function createProjectCard(project) {
const card = document.createElement('div');
card.classList.add('card');
const cardContent = `
<h3>${project.name}</h3>
<p>${project.description}</p>
<a href="${project.html_url}" target="_blank">View on GitHub</a>
`;
card.innerHTML = cardContent;
return card;
}