-
Notifications
You must be signed in to change notification settings - Fork 34
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
responsive-news-reader - Ralph #3
base: master
Are you sure you want to change the base?
Conversation
let page = 1; | ||
let maxItemPerPage = 5; | ||
|
||
function createRequest( |
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.
good use of defaults
if (localStor === "show") { | ||
checkbox.checked = true; | ||
images.forEach(function(img) { | ||
img.style.display = "block"; |
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 would be better to set a class whoch controls if image is displayed and then toggle the class rather than manipulating style directly. On larger projects this class could be re-used across other components
<li id="next-page">Next</li> | ||
</ul>`; | ||
container.innerHTML = paginationUl; | ||
// document |
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.
avoid committing commented out code
|
||
// Show/hide buttons when needed | ||
page === 1 | ||
? (document.querySelector("#prev-page").style.visibility = "hidden") |
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.
Setting visibility using a class would be better here than manipulating style
if (e.target.className === "article__readlater btn") { | ||
const articleTitle = e.target.getAttribute("data-title"); | ||
liveNewsCollection.forEach(articleObj => { | ||
return Object.keys(articleObj).find(articleKey => { |
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.
return
here is not needed since forEach
does not return a value
toggleImages(); | ||
pagination(page, totalPages); | ||
|
||
window.scroll(0, 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.
nice
No description provided.