-
Notifications
You must be signed in to change notification settings - Fork 34
Responsive News Reader #18
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
| }) | ||
| .then(body => { | ||
| // pullNewsObject(body); | ||
| createNewsContent(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.
Nice
| //Create .innerHTML of each news article div. | ||
|
|
||
| function articleTemplate (article) { | ||
| let authorVar = ""; |
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.
Code would be slightly cleaner if declaration and assignment was combined into single step. That would also allow you to use const instead of let
| function createSideBarContent(news) { | ||
| news.articles.forEach(item => { | ||
| if (item.content !== null && item.source.name !== "Bloomberg") { | ||
| const sideBar = document.querySelector(".news_sidebar"); |
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.
featureBox and sideBar lookup can be taken outside the forEach. Will save you having to run querySelector up on each loop iteration.
|
|
||
|
|
||
| //Adds more items to the sidebar as the page number for main article increases | ||
| function updateSideBarUrl(number) { |
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 is good, but I would suggest not putting the fetch call in this function. Use this function just to generate the URL and return it. Then the returned value can be used to call generateSideBar. This will reduce the amount of responsibility this function has and make it easier to test later as we will discuss later this week.
|
It would be great to see a README that explains what the project does |
No description provided.