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

gloria/scissors #71

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

gloria/scissors #71

wants to merge 3 commits into from

Conversation

ggrossvi
Copy link

No description provided.

Copy link

@beccaelenzil beccaelenzil left a comment

Choose a reason for hiding this comment

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

Good work on this project. You've combined javascript, html, and css to create a dynamic website! I've left some inline comments with a few ideas on ways to refactor, make your html more semantic, and move the onclick handling into the javascript file. Please let me know if you have any questions.

const townnameContainer = document.getElementBy("town-name");
};

const setTempClass = (tag, className) => {

Choose a reason for hiding this comment

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

Clever! An alternative to removing all the classes we don't need, and adding the class we do need is using this attribute tag.className = "red-temp"

Comment on lines +99 to +102
const decreaseTempArrow = document.querySelector("#decreaseTempArrow"); //# is id
decreaseTempArrow.addEventListener('click',decreaseTemp);
let select = document.querySelector("#sky-card > select"); //select is tag
select.addEventListener('change',changeSky);

Choose a reason for hiding this comment

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

Consider moving all the Event Listener logic into a function called registerEventHandlers and add this code document.addEventListener("DOMContentLoaded", registerEventHandlers); to increase readability and changeability.

Comment on lines +20 to +21
<div id="up-arrow" onclick="increaseTemperature()">⬆️</div>
<div id="decreaseTempArrow">⬇️</div>

Choose a reason for hiding this comment

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

These arrows are buttons! It is best practice to use semantic HTML and make these button elements.

In addition, rather than putting the onclick event right into the html, we encourage you to use javascript to do this and add the event listener the same way you did for decreaseTemperature

Suggested change
<div id="up-arrow" onclick="increaseTemperature()">⬆️</div>
<div id="decreaseTempArrow">⬇️</div>
<button id="up-arrow" onclick="increaseTemperature()">⬆️</button>
<button id="decreaseTempArrow">⬇️</button>

@@ -0,0 +1,109 @@


const tempToColor = (temp) => {

Choose a reason for hiding this comment

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

Notice that tempToColor and tempToLandscape have similar logic. Consider how you might combine these two functions to DRY up your code.

}
};

const skyToLandscape = (sky) => {

Choose a reason for hiding this comment

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

I like how you encapsulated this logic in a function that returns the value that you need, and then you can invoke the function and use the return value in the event handler.

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