| 22 | } |
| 23 | } |
| 24 | function createUserCard(user) { |
| 25 | const userID = user.name || user.login |
| 26 | const userBio = user.bio ? `<p>${user.bio}</p>` : '' |
| 27 | const cardHTML = ` |
| 28 | <div class="card"> |
| 29 | <div> |
| 30 | <img src="${user.avatar_url}" alt="${user.name}" class="avatar"> |
| 31 | </div> |
| 32 | <div class="user-info"> |
| 33 | <h2>${userID}</h2> |
| 34 | ${userBio} |
| 35 | <ul> |
| 36 | <li>${user.followers} <strong>Followers</strong></li> |
| 37 | <li>${user.following} <strong>Following</strong></li> |
| 38 | <li>${user.public_repos} <strong>Repos</strong></li> |
| 39 | </ul> |
| 40 | <div id="repos"></div> |
| 41 | </div> |
| 42 | </div> |
| 43 | ` |
| 44 | main.innerHTML = cardHTML |
| 45 | } |
| 46 | function createErrorCard(msg) { |
| 47 | const cardHTML = ` |
| 48 | <div class="card"> |