-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
32 lines (28 loc) · 925 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const url = "https://api.github.com/users";
const fetchUsers = () => {
fetch(url)
.then((response) => response.json())
.then((data) => userInfo(data));
};
const userInfo = (users) => {
const userDiv = document.querySelector(".users");
console.log(users);
users.forEach((user) => {
const { login, avatar_url, id } = user;
userDiv.innerHTML += `
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card border-dark" style="width: 18rem;">
<img src="${avatar_url}" class="card-img-top" alt="...">
<ul class="list-group list-group-flush">
<li class="list-group-item">Login Name : ${login} </li>
<li class="list-group-item">ID Number : ${id} </li>
</ul>
<div class="card-body">
<a href="https://github.com/${login}" class="card-link">https://github.com/${login}</a>
</div>
</div>
</div>
`;
});
};
fetchUsers();