Skip to content

Commit

Permalink
Merge pull request #1 from barnuri/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
barnuri authored Dec 5, 2024
2 parents 1bf0971 + b80ea8c commit b695434
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 3 additions & 1 deletion generateIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ async function getRepos(url) {
if (!response.ok) throw new Error("Failed to fetch repositories");
const repos = await response.json();
return repos.map(repo => ({
html_url: repo.html_url,
name: repo.name,
full_name: repo.full_name,
owner: repo.full_name.replace(`/${repo.name}`, ''),
owner_url: repo.html_url.replace(`/${repo.name}`, ''),
description: repo.description,
contributors_url: repo.contributors_url,
pushed_at: repo.pushed_at,
Expand Down
20 changes: 14 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ <h1 id="page-title">Loading...</h1>
const repoDiv = document.createElement("div");
repoDiv.className = "repo";
repoDiv.innerHTML = `
<h2><a class="repo_title" href="${repo.html_url}" target="_blank">${repo.name}</a></h2>
<p>${repo.description || "No description"}</p>
`;
<div style="display: flex; align-items: center; gap: 8px;">
<h2 style="margin: 0;">
<a class="repo_title" href="${repo.owner_url}" target="_blank" style="text-decoration: none; color: inherit;">${repo.owner}</a>
</h2>
<span>/</span>
<h2 style="margin: 0;">
<a class="repo_title" href="${repo.html_url}" target="_blank" style="text-decoration: none; color: inherit;">${repo.name}</a>
</h2>
</div>
<p>${repo.description || "No description"}</p>
`;

const contributorsDiv = document.createElement("div");
contributorsDiv.className = "contributors";
Expand All @@ -123,9 +131,9 @@ <h2><a class="repo_title" href="${repo.html_url}" target="_blank">${repo.name}</
const contributorDiv = document.createElement("div");
contributorDiv.className = "contributor";
contributorDiv.innerHTML = `
<img src="${contributor.avatar_url}" alt="${contributor.login}" class="avatar">
<a href="${contributor.html_url}" target="_blank">${contributor.login}</a>
`;
<img src="${contributor.avatar_url}" alt="${contributor.login}" class="avatar">
<a href="${contributor.html_url}" target="_blank">${contributor.login}</a>
`;
contributorsDiv.appendChild(contributorDiv);
}
repoDiv.appendChild(contributorsDiv);
Expand Down

0 comments on commit b695434

Please sign in to comment.