Skip to content

Commit

Permalink
removed null display bug when user name or bio was not found in githu…
Browse files Browse the repository at this point in the history
…b-profiles project
  • Loading branch information
rafat17 committed Jul 31, 2021
1 parent 0cb9fd3 commit 1c9c4cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions github-profiles/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ async function getRepos(username) {
}

function createUserCard(user) {
const userID = user.name || user.login
const userBio = user.bio ? `<p>${user.bio}</p>` : ''
const cardHTML = `
<div class="card">
<div>
<img src="${user.avatar_url}" alt="${user.name}" class="avatar">
</div>
<div class="user-info">
<h2>${user.name}</h2>
<p>${user.bio}</p>
<h2>${userID}</h2>
${userBio}
<ul>
<li>${user.followers} <strong>Followers</strong></li>
<li>${user.following} <strong>Following</strong></li>
Expand Down

0 comments on commit 1c9c4cf

Please sign in to comment.