Skip to content

Commit 0bb0375

Browse files
authored
Added Profile Link support in Contributors list
1 parent 7b05683 commit 0bb0375

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

script.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@ fetch("https://api.github.com/repos/TusharKesarwani/Front-End-Projects/contribut
8989
// Extract the data for each contributor
9090
const contributors = data.map(contributor => ({
9191
username: contributor.login,
92-
avatarUrl: contributor.avatar_url
92+
avatarUrl: contributor.avatar_url,
93+
profileUrl: contributor.html_url
9394
}));
9495

9596
// Create and append HTML elements to display the contributors
9697
const contributorsList = document.querySelector("#contributors-list");
9798
contributors.forEach(contributor => {
9899
const li = document.createElement("li");
99-
li.innerHTML = `<img src="${contributor.avatarUrl}" alt="${contributor.username}">`;
100+
li.innerHTML = `<a href="${contributor.profileUrl}"><img src="${contributor.avatarUrl}" alt="${contributor.username}"></a>`;
100101
contributorsList.appendChild(li);
101102
});
102-
});
103+
});

0 commit comments

Comments
 (0)