Skip to content

Commit 95510df

Browse files
Kara HowesKara Howes
authored andcommitted
user prodile data extracted from GitHub
1 parent 48cc152 commit 95510df

4 files changed

Lines changed: 65 additions & 24 deletions

File tree

code/chart.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const drawChart = (amount) =>{
1515
label: 'My First Dataset',
1616
data: [amount , 20-amount],
1717
backgroundColor: [
18-
'rgb(255, 99, 132)',
19-
'rgb(54, 162, 235)'
18+
'rgb(255, 192, 203)',
19+
'rgb(135,190,231)'
2020

2121
],
2222
hoverOffset: 4

code/index.html

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,8 @@
2323
</section>
2424

2525
</header>
26-
<section class="profile-container">
27-
<div class="profile-wrapper">
28-
<div class="profile-photo">
29-
<img src="./assets/KH_profile.jpeg" alt="Profile Picture of User">
30-
</div>
31-
<div class="profile-username">
32-
<h1>Kara</h1>
33-
<h2>KaraHowes</h1>
34-
</div>
35-
</div>
36-
<div class="profile-text">
37-
<p> New to coding, a little more experienced at life. PhD in Chemistry (UK), Post-doc at ETH Zürich. Always looking for new opportunities to learn and grow</p>
38-
</div>
39-
26+
<section class="profile-container" id="profile-container">
27+
4028
</section>
4129

4230
<main id="projects" class="projects-container">
@@ -48,6 +36,14 @@ <h2>KaraHowes</h1>
4836

4937
<!-- This will be used to draw the chart 👇 -->
5038
<canvas id="chart" class="canvas-chart"></canvas>
39+
<footer>
40+
<div class="footer">
41+
<img src="./assets/GitHub-Mark-120px-plus.png" alt="">
42+
<p> A GitHub tracker project by Kara Howes </p>
43+
</div>
44+
45+
46+
</footer>
5147

5248
<script src="./script.js"></script>
5349
<script src="./chart.js"></script>

code/script.js

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
const USER = 'KaraHowes'
2+
const USER_URL = `https://api.github.com/users/${USER}`
23
const repoURL = `https://api.github.com/users/${USER}/repos`
4+
const profileContainer = document.getElementById('profile-container')
35
const projectsContainer = document.getElementById('projects')
46
const cardsContainer = document.getElementById('cards-container')
7+
const profileText = document.getElementById('profile-text')
8+
const profileImage = document.getElementById('profile-image')
59

6-
10+
const userProfile = () => {
11+
fetch (USER_URL)
12+
.then (response => response.json())
13+
.then (data => {
14+
console.log ('profile', data)
15+
profileContainer.innerHTML+= `
16+
<div class="profile-wrapper" id="profile-wrapper">
17+
<div class="profile-photo" id=" profile-image">
18+
<img src="https://avatars.githubusercontent.com/u/70952682?v=4" alt="Profile Picture of User" >
19+
</div>
20+
<div class="profile-username" id ="profile-username">
21+
<h1>${data.name}</h1>
22+
<h2>${data.login}</h1>
23+
</div>
24+
</div>
25+
<div class="profile-text" id="profile-text">
26+
<p> ${data.bio}</p>
27+
</div>`
28+
})
29+
}
30+
userProfile()
731

832
const getRepos = ()=>{
933
// This function fetches the data from the Githug API
@@ -62,9 +86,14 @@ const getPullRequests = (forkedProjects) => {
6286
.then((data) => {
6387
//console.log(data)
6488
const myPullRequests = data.find(pull => pull.user.login === repo.owner.login)
65-
//console.log('howdy', myPullRequests)
66-
67-
getCommits(myPullRequests.commits_url, repo.name)
89+
90+
if (myPullRequests) {
91+
getCommits(myPullRequests.commits_url, repo.name)
92+
} else {
93+
document.getElementById(`commit-${repo.name}`).innerHTML =
94+
'Sorry, no pull request done yet'
95+
}
96+
6897
})
6998

7099

@@ -77,7 +106,7 @@ const getCommits = (myCommitsUrl, myRepoName) => {
77106
.then((response) => response.json())
78107
.then ((data) => {
79108

80-
console.log(data)
109+
//console.log(data)
81110
document.getElementById(`commit-${myRepoName}`).innerHTML+=data.length
82111

83112
}

code/style.css

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ p {
5050

5151
.header img {
5252
width: 250px;
53-
margin: 0 auto 5px auto;
53+
margin: 0 auto 20px auto;
54+
padding-bottom: 10px;
5455
display: block;
5556

5657
}
@@ -101,14 +102,14 @@ margin: 0 auto;
101102
width: 90%;
102103
background-color: white;
103104
border: 1px solid #DADBDB;
104-
box-shadow: 1px 1px 3px rgba(0,0,0,.25);
105+
box-shadow: 2px 2px 4px rgba(0,0,0,.25);
105106
margin: 20px auto;
106107
}
107108

108109
.card-projectname {
109110
margin: 20px 0 0 0;
110111
padding: 20px 0 0 0;
111-
border-bottom: 3px solid pink;
112+
border-bottom: 3px solid rgb(255, 192, 203);
112113

113114
}
114115
.updated, .branch, .URL, .number-commits, .blank-line, .times-forked {
@@ -140,4 +141,19 @@ margin: 0 auto;
140141
.canvas-chart{
141142
max-width: 500px;
142143

144+
}
145+
146+
.footer{
147+
width: 100%;
148+
border-top: 1px solid #B2B3B4;
149+
justify-items: center;
150+
margin-top: 50px;
151+
text-align: center;
152+
153+
}
154+
155+
.footer img{
156+
width: 50px;
157+
margin: 20px auto;
158+
display: block;
143159
}

0 commit comments

Comments
 (0)