Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion GitHubCard/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import axios from "axios"

/*
STEP 1: using axios, send a GET request to the following URL
(replacing the placeholder with your Github name):
https://api.github.com/users/<your name>
*/

axios.get("https://api.github.com/users/Jericho-West")
.then (x => {
let pancake = x.data


/*
STEP 2: Inspect and study the data coming back, this is YOUR
github info! You will need to understand the structure of this
Expand All @@ -28,7 +35,7 @@
user, and adding that card to the DOM.
*/

const followersArray = [];
const followersArray = ["https://api.github.com/users/krueng", "https://api.github.com/users/EstrellaDionis", "https://api.github.com/users/joseph-fantuzzi", "https://api.github.com/users/CRHarding", "https://api.github.com/users/Jericho-West"];

/*
STEP 3: Create a function that accepts a single object as its only argument.
Expand Down Expand Up @@ -58,3 +65,63 @@ const followersArray = [];
luishrd
bigknell
*/

function cardMaker (card0) {
let attach = document.querySelector(".cards")

let mainDiv = document.createElement("div")
let img0 = document.createElement("img")
let sideDiv = document.createElement("div")
let water = document.createElement("h3")
let p0 = document.createElement("p")
let p1 = document.createElement("p")
let p2 = document.createElement("p")
let p3 = document.createElement("p")
let p4 = document.createElement("p")
let p5 = document.createElement("p")
let aa = document.createElement("a")

mainDiv.className = "card"
sideDiv.className = "card-info"
water.className = "name"
p0.className = "username"
img0.src = card0.avatar_url
aa.href = card0.html_url
water.textContent = card0.name
p0.textContent = card0.login
p1.textContent = `Location: ${card0.location}`
p2.textContent = "Profile: "
p3.textContent = `Followers: ${card0.followers}`
p4.textContent = `Following: ${card0.following}`
p5.textContent = `Bio: ${card0.bio}`
aa.textContent = `${card0.html_url}`


attach.appendChild(mainDiv)
mainDiv.appendChild(img0)
mainDiv.appendChild(sideDiv)
sideDiv.appendChild(water)
sideDiv.appendChild(p0)
sideDiv.appendChild(p1)
sideDiv.appendChild(p2)
sideDiv.appendChild(p3)
sideDiv.appendChild(p4)
sideDiv.appendChild(p5)
p2.appendChild(aa)
}


followersArray.forEach(element => {
console.log(element)
axios.get(element)
.then(whee => {
cardMaker(whee.data)
})


});

})
.catch (err => {
console.log(err)
})
Loading