-
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
Zoisite - Liz Trejo & Muniba Kimes #55
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 looking site Muniba & Liz! I've left a few comments, once you take a look please let me know if there's anything I can clarify =]
</div> | ||
<button id="cityNameReset" class="city-name__reset-btn">Reset</button> | ||
</section> | ||
<section class="footer__content"> |
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.
To follow best practices for semantic HTML, if this represents a footer
, we should use the <footer>
tag and style as needed.
<h2 id="headerCityName" class="header__city-name">Las Vegas</h2> | ||
</div> | ||
<span>Weather Last Updated: <span id="lastUpdatedValue">N/A</span></span> | ||
<div class="temperature__content"> |
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.
I would strongly suggest swapping out some of the divs
across the page for more semantic elements like nested section
s or article
s, and consider using a main
tag to make it clear what is the central content of the page for folks using assistive technologies.
city: 'las vegas', //default city | ||
weather: {}, | ||
} | ||
const temperatureMappings = [ |
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.
I love this for making it easy to see what the temperature settings are all in one place.
const elementsWithId = document.querySelectorAll('[id') | ||
elementsWithId.forEach(element => state[element.id] = element); |
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.
If you know you want every element with an ID loaded up at the start, this is such a handy way to do it!
state.weather.sunset = convertTimestampToTime(sunset); | ||
state.lastUpdated = convertTimestampToTime(weatherResponse.data['dt']); | ||
|
||
// update UI |
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 use of short comments to help organize the code and give readers context
} | ||
|
||
const handleCityNameUpdate = () => { | ||
state.city = state.cityNameInput.value || 'Las Vegas'; |
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.
I love this to handle when the user might clear the input field.
const handleIncrease = () => handleTempChange(1); | ||
const handleDecrease = () => handleTempChange(-1); |
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.
These are declared pretty far from where they're used, I'd consider moving them closer to the function that registers these as callbacks. Since they are only used in one location, another option could be writing them as anonymous functions where they are registered:
state.increaseTempControl.addEventListener('click', () => {
handleTempChange(1)
});
document.documentElement.style. | ||
setProperty('--bgImage', `var(--${state.timePeriod}BgImage)`); | ||
document.documentElement.style. | ||
setProperty('--bgColor', `var(--${state.timePeriod}BgColor)`); | ||
state.sky.src = `./src/icons/01${state.timePeriod}.svg`; |
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.
So good how the background updates with the real environment ^_^
setTimePeriod(); | ||
}; | ||
|
||
document.addEventListener('DOMContentLoaded', onLoaded); |
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.
Really nice organization of code across the file!
We completed the base project in the digital-template branch. We then added additional styling and functionality in the styling branch, which is the branch this pull request was made from.