Skip to content
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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

responsive-news-reader - Ralph #3

wants to merge 14 commits into from

Conversation

r41ph
Copy link

@r41ph r41ph commented Jun 17, 2018

No description provided.

let page = 1;
let maxItemPerPage = 5;

function createRequest(
Copy link
Contributor

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";
Copy link
Contributor

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
Copy link
Contributor

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")
Copy link
Contributor

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 => {
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants