Skip to content

Commit

Permalink
Update contributors.html
Browse files Browse the repository at this point in the history
  • Loading branch information
RadhikaMalpani1702 committed Aug 6, 2024
1 parent fcb912b commit 4d48752
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions pages/contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,33 +309,39 @@ <h1 class="text-center text-3xl font-semibold mb-8">🤝Our Contributors</h1>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function () {
const contributorsContainer = document.getElementById('contributors');
const contributorsContainer = document.getElementById('contributors');

async function fetchContributors() {
try {
const response = await fetch('https://api.github.com/repos/sk66641/Random-Disco-Light-Simulator/contributors');
const contributors = await response.json();
async function fetchContributors(page = 1) {
try {
const response = await fetch(`https://api.github.com/repos/sk66641/Random-Disco-Light-Simulator/contributors?page=${page}&per_page=100`);
const contributors = await response.json();

contributors.forEach(contributor => {
const contributorCard = document.createElement('a');
contributorCard.href = contributor.html_url;
contributorCard.target = '_blank';
contributorCard.className = 'contributor-card';
contributorCard.innerHTML = `
<img src="${contributor.avatar_url}" alt="${contributor.login}">
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">${contributor.login}</h2>
<p class="text-gray-700 dark:text-gray-400">Contributions: ${contributor.contributions}</p>
<p class="text-gray-700 dark:text-gray-400 flex-center"><i class="fa-brands fa-github mr-1"></i>GitHub Profile</p>
`;
contributorsContainer.appendChild(contributorCard);
});
} catch (error) {
console.error('Error fetching contributors:', error);
}
if (contributors.length > 0) {
contributors.forEach(contributor => {
const contributorCard = document.createElement('a');
contributorCard.href = contributor.html_url;
contributorCard.target = '_blank';
contributorCard.className = 'contributor-card';
contributorCard.innerHTML = `
<img src="${contributor.avatar_url}" alt="${contributor.login}">
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">${contributor.login}</h2>
<p class="text-gray-700 dark:text-gray-400">Contributions: ${contributor.contributions}</p>
<p class="text-gray-700 dark:text-gray-400 flex-center"><i class="fa-brands fa-github mr-1"></i>GitHub Profile</p>
`;
contributorsContainer.appendChild(contributorCard);
});

// Fetch the next page
fetchContributors(page + 1);
}
} catch (error) {
console.error('Error fetching contributors:', error);
}
}

fetchContributors();
});

fetchContributors();
});
</script>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script src="../js/background.js"></script>
Expand Down

0 comments on commit 4d48752

Please sign in to comment.