-
Notifications
You must be signed in to change notification settings - Fork 0
Added week 2 homework #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Forgot a critical file!
Created 'displayPage' function and moved event listener into main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.then(response => response.json()) | ||
.then(data => { | ||
repoDiv.innerHTML = ''; | ||
let repository = data.name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use const
instead of let
when the value doesn't change.
|
||
} | ||
|
||
function displayContrib(contributor, contributions, avatar) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice splitting up in functions!
padding: 5px; | ||
} | ||
|
||
.badge { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work well when there are more than 100 contributions, don't forget to test with larger amounts of data!
|
||
function displayContrib(contributor, contributions, avatar) { | ||
let eachPersonUl = createAndAppend('ul', contribDiv) | ||
createAndAppend('IMG', eachPersonUl, { src: avatar, width: "42", id: 'avatar' }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't add img
elements as a direct child inside ul
/ol
. Only li
is allowed, so you should wrap the img
inside of an li
.
function displayContrib(contributor, contributions, avatar) { | ||
let eachPersonUl = createAndAppend('ul', contribDiv) | ||
createAndAppend('IMG', eachPersonUl, { src: avatar, width: "42", id: 'avatar' }) | ||
createAndAppend('li', eachPersonUl, { class: "badge", id: 'contbadge', text: `${contributions}` }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Id-attributes must be unique on the entire page, here and on the line above you add multiple elements with the same id. You should use class
attribute instead (classes can be used on multiple places in the document).
homework/week-2/newStyle.css
Outdated
color: #444; | ||
} | ||
|
||
#contributorsDiv.li { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do anything; you're trying to style an element with the id contributorsDiv
and the class li
. It never exists in your app.
homework/week-2/newStyle.css
Outdated
margin: 20px; | ||
} | ||
|
||
/* #contributionNumber { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't leave commented out code, remove it instead! (Easier to read and change later)
Fixed a bug that was causing the select element to replicate every time the page reloaded. Also upperCased everything so it's actually alphabetical
Still haven't figured out how the classes work
Think all is working but api 403 so can't check for a little while.
Checked to make sure this was actually working and removed some unused css.
No description provided.