Skip to content

Commit 3707158

Browse files
chart positioned center, nr of commits showed in panel, small fixes with position absolute
1 parent cb1df1d commit 3707158

3 files changed

Lines changed: 23 additions & 17 deletions

File tree

code/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ <h2 class="user-header">USER</h2>
2222
<h2 class="projects-header">PROJECTS</h2>
2323
<div id="projects-container" class="projects-container"></div>
2424
<h2 class="chart-header">PROGRESS</h2>
25-
<div class="chart">
26-
<canvas id="chart"></canvas>
27-
</div>
25+
<section class="chart-container">
26+
<div class="chart">
27+
<canvas id="chart"></canvas>
28+
</div>
29+
</section>
2830
</main>
2931

3032
<footer>

code/script.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ const getRepos = () => {
4141
const filteredRepos = data.filter((repo) => repo.fork && repo.name.startsWith('project'))
4242
filteredRepos.forEach((repo) => {
4343
projectsContainer.innerHTML += `
44-
<div class="repos" id="${repo.name}">
44+
<div class="repos">
4545
<button class="project-name">${repo.name}</button>
4646
<div class="panel">
4747
<a href="${repo.html_url}">
4848
<p>Link to repo</p></a>
4949
<p>Branch: ${repo.default_branch}</p>
5050
<p>Main language: ${repo.language}</p>
51+
<p id="commit-${repo.name}"> Number of commits: </p>
5152
<p>Latest push: ${new Date(repo.pushed_at).toDateString()}</p>
5253
</div>
5354
</div>
@@ -98,9 +99,10 @@ const getPullRequests = (filteredRepos) => {
9899
const myPullRequests = data.find((pull) => pull.user.login === repo.owner.login)
99100
console.log(myPullRequests)
100101
if (myPullRequests) {
101-
getCommits(myPullRequests.commits_url, repo.name)
102+
getCommits(myPullRequests.commits_url, `${repo.name}`)
102103
} else {
103-
104+
document.getElementById(`${repo.name}`).innerHTML +=
105+
`commits made by group partner`
104106
//conditionals to use for invoking step 4?
105107
// if (myPullRequests) {
106108
// document.getElementById(`${repo.name}`).innerHTML +=
@@ -130,12 +132,9 @@ const getCommits = (URL, repoName) => {
130132
.then(res => res.json())
131133
.then(data => {
132134
// let numberOfCommits = data.length
133-
document.getElementById(`${repo.name}`).innerHTML += `
134-
<p> Number of commits: ${data.length}</p>
135-
`
136-
console.log(data.length)
135+
document.getElementById(`commit-${repo.name}`).innerHTML += data.length
137136
})
138-
}
137+
}
139138
})
140139
}
141140
// const getCommits = (URL, repoName) => {
@@ -248,5 +247,5 @@ const getCommits = (URL, repoName) => {
248247
// }
249248
// })
250249
// }
251-
// getUser() //invoking step 1
250+
252251

code/style.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ a {
138138
margin-left: 2.5em;
139139
}
140140

141+
.chart-container {
142+
display: flex;
143+
justify-content: center;
144+
}
145+
141146
footer {
142147
height: 15vh;
143148
width: 100vw;
@@ -182,14 +187,14 @@ footer {
182187
.github-tracker {
183188
position: absolute;
184189
top: -30%;
185-
left: 25%;
190+
left: 35%;
186191
font-size: 50px;
187192
}
188193

189194
.github-logo {
190195
position: absolute;
191196
top: 11%;
192-
left: 27%;
197+
left: 37%;
193198
border-radius: 1em;
194199
height: 3em;
195200
}
@@ -198,7 +203,7 @@ footer {
198203
display: block;
199204
position: absolute;
200205
top: 29%;
201-
right: 63%;
206+
right: 67%;
202207
font-size: 25px;
203208
letter-spacing: .5em;
204209
font-weight: 100;
@@ -215,15 +220,15 @@ footer {
215220
.user-name {
216221
position: absolute;
217222
top: 80%;
218-
right: 60%;
223+
right: 65%;
219224
font-size: 25px;
220225
}
221226

222227
.chart-header {
223228
font-size: 25px;
224229
position: absolute;
225230
top: 20%;
226-
right: 15%;
231+
right: 18%;
227232
}
228233

229234
.chart {

0 commit comments

Comments
 (0)