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

Paper - Nandita G. #56

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Paper - Nandita G. #56

wants to merge 9 commits into from

Conversation

pancakes4lyfe
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Nice work Nandita, the site looks great and it all functions. I made one minor suggestion.

Another suggestion is that the images are quite large. You might want to consider preloading the images, so the browser doesn't need to load the images AFTER you change the CSS/HTML with JavaScript.

Comment on lines +9 to +21
const tempUp = (event) => {
state.temp += 1;
const count = document.querySelector("#tempDisplay");
count.textContent = `${state.temp}`;
checkTemp();
};

const tempDown = (event) => {
state.temp -= 1;
const count = document.querySelector("#tempDisplay");
count.textContent = `${state.temp}`;
checkTemp();
};

Choose a reason for hiding this comment

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

A couple of things:

  1. You're not using the event parameter so you can leave it off.
  2. You can combine these functions
Suggested change
const tempUp = (event) => {
state.temp += 1;
const count = document.querySelector("#tempDisplay");
count.textContent = `${state.temp}`;
checkTemp();
};
const tempDown = (event) => {
state.temp -= 1;
const count = document.querySelector("#tempDisplay");
count.textContent = `${state.temp}`;
checkTemp();
};
const changeTemp = (increment) => {
state.temp += increment;
const count = document.querySelector("#tempDisplay");
count.textContent = `${state.temp}`;
checkTemp();
};

You can then use an anonymous function in the event registration like this:

tempDownButton.addEventListener("click", () => changeTemp( -1 ) );

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.

2 participants