-
Notifications
You must be signed in to change notification settings - Fork 85
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
Cedar: Khandice Schuhmann #64
base: main
Are you sure you want to change the base?
Conversation
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.
Great work on your first javascript on the web project! You've met the learning goals around dynamically applying styles and event handling. I've left a few in-line comments on small ways you may consider refactoring. Nice work!
</head> | ||
<body> | ||
|
||
<header id="city_name_header"> |
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 work writing semantic html
src/index.js
Outdated
change_widgets; | ||
const createGroundListener = () => { | ||
document.getElementById('temp_display').addEventListener('DOMSubtreeModified', function () { | ||
if (document.getElementById('temp_display').innerHTML <= 44) { |
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 work dynamically implementing these styles. It looks great!
Notice that there is quite a bit of repeated code here. Here are a couple ways you might consider refactoring. 1) Rather than applying the style directly to the element, you could assign a class to each element here, and then use that class to apply to styles. Assign each element that you are dynamically styling to a constant, and then you can use that constant to either directly change the style or assign a class name.
src/index.js
Outdated
|
||
const createResetListener = () => { | ||
const resetButton = document.getElementById('reset'); | ||
resetButton.addEventListener('click', function(){ |
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.
For the callback functions in each of the addEventListener
functions, consider encapsulating that functionality in a named function rather than an anonymous function to enhance readability.
src/index.js
Outdated
city_name_header; | ||
change_widgets; |
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 looks like these lines can be removed
No description provided.