-
Notifications
You must be signed in to change notification settings - Fork 0
Week1-Assignment #1
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
Conversation
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.
Great job!
homework/index.js
Outdated
function main(url) { | ||
fetchJSON(url, (err, data) => { | ||
const root = document.getElementById('root'); | ||
const myParent = document.body; |
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.
Who is my? I'd call it something like BodyEl
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.
changed myParent to BodyEl.
homework/index.js
Outdated
createAndAppend('pre', root, { text: JSON.stringify(data, null, 2) }); | ||
// Create div element 'select' in document body to hold the label element and list box. | ||
|
||
createAndAppend('div', myParent, { id: 'select' }); |
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.
The id name is a bit confusing here. Would call is something like select-container
or something.
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.
Corrected the container name for select as - selectcontainer.
homework/index.js
Outdated
// section1 - Repository Information. | ||
// section2 - Contributions. | ||
|
||
createAndAppend('div', root, { id: 'section1' }); |
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.
Would name these divs closer to what content they will hold. More like contributors
and repo-details
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.
corrected the name div name as repodetails,contributorinfomation
homework/index.js
Outdated
// Insert Select div first in the body before root div. | ||
myParent.insertBefore(select, document.getElementById('root')); | ||
|
||
loadSelectionValues(JSON.stringify(data, null, 2)); |
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.
Does it need to be stringified? Kinda confused what the other two parameters do.
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.
It was there in existing code, but i corrected ans used the data as such.
homework/index.js
Outdated
const sortRepoName = []; | ||
|
||
const userRepo = JSON.parse(userInfo); | ||
const mySelect = document.getElementById('myselect'); |
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.
Not sure what the word my
helps signify. Think a better name could be used?
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.
corrected with name selectrepo.
} | ||
|
||
// sort the repo name using sort function and localeComapare for uppercase and lowercase sorting. | ||
sortRepoName.sort((a, b) => a.localeCompare(b)); |
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, I've never heard of localCompare
before
homework/index.js
Outdated
const selectedValue = selectBox.options[selectBox.selectedIndex].value; | ||
|
||
// Load Repository information for the choose repository name in the select box. | ||
loadDiv(userRepo, selectedValue); |
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.
Great job creating separate functions. But can we rename this to something more clear on what it does?
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.
Renamed the function name as loadRepoDetails.
|
||
`${'<p id="updated">'} Updated : ${formatedUpdate}</p>`, | ||
'</div>', | ||
); |
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.
Interesting technique here. Yes, this will work.
if (err) { | ||
createAndAppend('div', root, { text: err.message, class: 'alert-error' }); | ||
} else { | ||
addContributors(data); |
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 making a new function here 👍
@@ -9,7 +9,7 @@ | |||
"author": "Jim Cramer", | |||
"license": "CC-BY-4.0", | |||
"devDependencies": { | |||
"eslint": "^5.9.0", | |||
"eslint": "^5.16.0", |
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.
Necessary?
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.
Going to approve the week 1 stuff and request changes for week 2
No description provided.