Skip to content

Commit 5d9af02

Browse files
authored
Merge pull request #4 from AaaaT/homework-week1
Homework week1
2 parents df16ee4 + c0b5165 commit 5d9af02

4 files changed

Lines changed: 59 additions & 13 deletions

File tree

homework/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The visual result----->
2+
https://aaaat.github.io/JavaScript3/homework/

homework/index.html

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet" />
1717
<link rel="stylesheet" href="./style.css" />
1818
</head>
19+
1920
<header>
20-
<div id="root"><label>HYF Repositories </label></div>
21+
<div id="root">
22+
<label>HYF Repositories </label>
23+
</div>
2124
<!--<select>
2225
<option value="0">alumni</option>
2326
<option value="1">angular</option>
@@ -26,11 +29,17 @@
2629
</header>
2730

2831
<body>
29-
<script src="./index.js"></script>
30-
3132
<!--<p>The repositories will be displayed here</p> testing the body contents-->
32-
<div id="forRepoBlock"></div>
33-
<div id="forContributorsBlock"></div>
33+
<div id="container">
34+
<div id="forRepoBlock"><p>Repositories</p></div>
35+
36+
<div id="forContributorsBlock"><p>Contributors</p></div>
37+
<div id="picture"></div>
38+
<div id="contributorName"></div>
39+
40+
</div>
41+
42+
<script src="./index.js"></script>
3443
</body>
3544
</html>
3645

homework/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
function main(url) {
3434
fetchJSON(url, (err, data) => {
35-
const root = document.getElementById('root','forRepoBlock', 'forContributorsBlock');
35+
const root = document.getElementById('root');
3636
if (err) {
3737
createAndAppend('div', root, { text: err.message, class: 'alert-error' });
3838
} else {
@@ -66,8 +66,12 @@
6666
const contribsUrl = repo.contributors_url;
6767
fetchJSON(contribsUrl, (err, contribData) => {
6868
contribData.forEach(contributor => {
69-
createAndAppend('div', contribs, { text: contributor.login });
69+
createAndAppend('p', contribs, { text: ':' });
70+
createAndAppend('img', contribs, { src: contributor.avatar_url, height: 30, class: 'picture' });
71+
createAndAppend('div', contribs, { text: contributor.login, class: 'contributorName' });
72+
createAndAppend('div', contribs, { text: contributor.contributions, class: 'numberContributions' });
7073
});
74+
7175
});
7276
});
7377
}

homework/style.css

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,48 @@ select {
2424
border-radius: 20px;
2525
}
2626

27+
#container {
28+
display: flex;
29+
flex-direction: row;
30+
align-items: flex-start;
31+
margin: 1 rem;
32+
}
33+
2734
#forRepoBlock {
2835
color: purple;
2936
font-size: .9rem;
30-
padding: 1px 25px;
37+
padding: 4px 4px;
3138
margin-left: 2px;
32-
border-radius: 20px;
39+
40+
float: center;
41+
margin-top: 1rem;
42+
width: 60%;
43+
44+
border-style: bold;
45+
border-radius: 0%;
46+
padding: 10px;
47+
background:rgb(216, 142, 188);
48+
opacity: 0.8;
49+
50+
box-shadow: 10px 5px 5px grey;
3351
}
3452
#forContributorsBlock {
35-
color: brown;
53+
color: rgb(112, 13, 13);
3654
font-size: .9rem;
37-
padding: 4px 25px;
38-
margin-left: 25px;
39-
border-radius: 20px;
55+
padding: 4px 4px;
56+
margin-left: 2px;
57+
58+
display: flex;
59+
flex-direction: row;
60+
61+
margin: 1rem;
62+
width: 40%;
63+
64+
border-style: bold;
65+
border-radius: 0%;
66+
padding: 10px;
67+
background:rgb(155, 118, 92);
68+
opacity: 0.8;
69+
70+
box-shadow: 10px 5px 5px grey;
4071
}

0 commit comments

Comments
 (0)