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

weather-report #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cervantesnathalia
Copy link

No description provided.

<h1>Weather Report</h1>
<h5>
For the lovely city of
<span class="header_city"></span>
Copy link

Choose a reason for hiding this comment

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

You could put a default city name here so that it won't be blank when the page loads.

Comment on lines +19 to +39
<section class="weather_garden">
<h2><em>Weather Garden</em></h2>
<div id="sky" class="sky_content"></div>
<div id="landscape" class="landscape_content"></div>
</section>

<section class="temp">
<h2>Temperature: <span class="yellow" id="temp_num"> 60</span></h2>
<button id="temp_increase">^</button>
<button id="temp_decrease">v</button>
</section>

<section id="skyContainer">
<h2>Sky</h2>
<select id="sky_select">
<option>Sunny</option>
<option>Cloudy</option>
<option>Rainy</option>
<option>Snowy</option>
</select>
</section>
Copy link

Choose a reason for hiding this comment

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

clean, clear, and concise. Great job.

Comment on lines +3 to +17
const change_landscape = (if_temp) => {
const earthContainer = document.getElementById("landscape");

let landscape = "";
if (if_temp >= 80) {
landscape = "🌵__🐍_🦂_🌵🌵__🐍_🏜_🦂";
} else if (if_temp >= 70 && if_temp <= 79) {
landscape = "🌸🌿🌼__🌷🌻🌿_☘️🌱_🌻🌷";
} else if (if_temp >= 60 && if_temp <= 69) {
landscape = "🌾🌾_🍃_🪨__🛤_🌾🌾🌾_🍃";
} else if (if_temp <= 59) {
landscape = "🌲🌲⛄️🌲⛄️🍂🌲🍁🌲🌲⛄️🍂🌲";
}
earthContainer.textContent = landscape;
};
Copy link

Choose a reason for hiding this comment

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

💃🏽

background.className = skySelected;
};

const state = { location: "" };
Copy link

Choose a reason for hiding this comment

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

best practice to have state at the top of your file.

const state = { location: "" };

const reset = (typed_city) => {
// state.location = "";
Copy link

Choose a reason for hiding this comment

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

remove unused code.


const reset = (typed_city) => {
// state.location = "";
typed_city = document.querySelector("#typed_city").value;
Copy link

Choose a reason for hiding this comment

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

in html you need to add a value attribute so you can access it here.

<section class="reset_location">
<h2>City</h2>
<div><button id="reset">Reset</button></div>
<input id="typed_city" type="text" />
Copy link

Choose a reason for hiding this comment

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

add a value attribute

typed_city = document.querySelector("#typed_city").value;
const resetClick = document.querySelector("#typed_city");
resetClick.textContent = typed_city;
};
Copy link

Choose a reason for hiding this comment

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

you also need to update the city name. I would add a function that gets the header city name and change the input to whatever the user input value is.

Comment on lines +62 to +67
const handleReset = () => {
const resetClick = document.querySelector("#reset");
resetClick.addEventListener("click", reset);
};

document.addEventListener("DOMContentLoaded", handleReset);
Copy link

Choose a reason for hiding this comment

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

this can be moved into the registerEventHandlers you have below

@@ -0,0 +1,77 @@
body {
color: hsl(309, 42%, 32%);
Copy link

Choose a reason for hiding this comment

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

your page was responsive and clean. I like that you also changed the text color with the change of the sky.

@tgoslee
Copy link

tgoslee commented Jul 12, 2021

Great job! I loved the look of your page and that it was responsive. I added some comments to get your reset button to work and some syntax suggestions.

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