Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Week3 done
  • Loading branch information
chichiglacierz committed Sep 2, 2019
commit b0de06797e025ee63eccc96c7bae6f91a9615da0
40 changes: 38 additions & 2 deletions homework/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,44 @@ class Repository {
* @param {HTMLElement} container The container element in which to render the repository.
*/
render(container) {
// TODO: replace the next line with your code.
Util.createAndAppend('pre', container, JSON.stringify(this.repository, null, 2));
/* TODO: replace the next line with your code.
Util.createAndAppend('pre', container, JSON.stringify(this.repository, null, 2));*/
const repo = Object.assign({}, this.repository, {
updated_at: new Date(this.repository.updated_at).toLocaleString(),
});

const repoTitles = { description: 'Description: ', forks: 'Forks: ', updated_at: 'Updated: ' };

const table = Util.createAndAppend('table', container, { class: 'table' });
const tbody = Util.createAndAppend('tBody', table);

const firstRow = Util.createAndAppend('tr', tbody);
let leftCell = Util.createAndAppend('td', firstRow);
let rightCell = Util.createAndAppend('td', firstRow);

Util.createAndAppend('span', leftCell, { text: 'Repository: ', class: 'repo-child left-cell' });
Util.createAndAppend('a', rightCell, {
text: this.repository.name,
href: this.repository.html_url,
target: '_blank',
class: 'repo-child right-cell',
});

Object.keys(repoTitles).forEach(key => {
const tr = Util.createAndAppend('tr', tbody);
leftCell = Util.createAndAppend('td', tr);
rightCell = Util.createAndAppend('td', tr);

Util.createAndAppend('span', leftCell, {
text: repoTitles[key],
class: 'repo-child left-cell',
});

Util.createAndAppend('span', rightCell, {
text: repo[key],
class: 'repo-child right-cell',
});
});
}

/**
Expand Down
80 changes: 79 additions & 1 deletion homework/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@
align-items: flex-start;
justify-content: center;
}
#main {
display: flex;
flex-direction: row;
align-items: flex-start;
}
@media (max-width: 767px) {
body {
width: 100%;
width: 768px;
}
#main {
flex-direction: column;
align-items: stretch;
/* margin-left: auto;
margin-right: auto;
margin-top: 0px;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;*/
}
.right-div {
width: 100%;
Expand All @@ -17,6 +30,9 @@
}
.alert-error {
color: red;
text-align: center;
font-weight: bold;
font-size: 30px;
}
.h1 {
text-align: center;
Expand Down Expand Up @@ -62,3 +78,65 @@ header {
width: 40;
height: 30;
}
table {
table-layout: fixed;
color: rgb(0, 0, 0, 81%);
}

table td {
vertical-align: top;
}
.repo-container,
.contributor-container {
background: white;
flex: 1;
margin-top: 15px;
}

.repo-container {
margin-right: 5px;
padding: 16px;
}

.left-cell {
font-weight: bold;
margin-right: 15px;
}
.repo-child {
font-size: 16px;
}

.contributor-header {
font-size: 1rem;
padding: 8px 16px 4px 5px;
color: rgb(0, 0, 0, 54%);
margin-left: 15px;
}
.contributor-list {
list-style-type: none;
padding: 0;
margin: 0;
}
.image {
width: 50px;
height: 50px;
border-radius: 3px;
margin-right: 18px;
margin-bottom: 20px;
}
.contributor-badge {
font-size: 12px;
background-color: gray;
font-size: 12px;
padding: 2px 8px;
line-height: 1rem;
color: white;
border-radius: 4px;
}
.contributor-data {
flex: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
align-content: center;
}