Skip to content

Commit

Permalink
Add icons to view buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
2KAbhishek committed Aug 14, 2022
1 parent 8a27409 commit 87c1e88
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,21 @@ const displayRepos = (repos) => {

if (repo.language) {
listItem.innerHTML += `<a href="${langUrl}">
<span>${devicons[repo.language]}</span> </a>`
<span>${devicons[repo.language]}</span></a>`
}

if (repo.forks_count > 0) {
listItem.innerHTML += `<a href="${starsUrl}">
<span>${devicons["Git"]}${repo.forks_count}</span></a>`
<span>${devicons["Git"]} ${repo.forks_count}</span></a>`
}

if (repo.homepage) {
listItem.innerHtml += `
<br /> <br />
<a class="link-btn" href=${repo.html_url}>View Source</a>
<a class="link-btn" href=${repo.homepage}>View Live</a>
<br />`;
if (repo.homepage && repo.homepage !== "") {
listItem.innerHTML += `<br /> <br />
<a class="link-btn" href=${repo.html_url}>Code ${devicons["Github"]}</a>
<a class="link-btn" href=${repo.homepage}>Live ${devicons["Chrome"]}</a> <br />`;
} else {
listItem.innerHtml += `
<br /> <br />
<a class="link-btn" href=${repo.html_url}>View Project</a><br />`;
listItem.innerHTML += `<br /> <br />
<a class="link-btn" href=${repo.html_url}>View Project ${devicons["Github"]}</a><br />`;
}

repoList.append(listItem);
Expand All @@ -136,6 +133,8 @@ filterInput.addEventListener('input', (e) => {
// for programming language icons
const devicons = {
Git: '<i class="devicon-git-plain" style="color: #555"></i>',
Github: '<i class="devicon-github-plain" style="color: #1688f0"></i>',
Chrome: '<i class="devicon-chrome-plain" style="color: #1688f0"></i>',
Assembly: '<i class="devicon-labview-plain colored"></i> Assembly',
'C#': '<i class="devicon-csharp-plain colored"></i> C#',
'C++': '<i class="devicon-cplusplus-plain colored"></i> C++',
Expand Down

0 comments on commit 87c1e88

Please sign in to comment.