forked from AdaGold/weather-report
-
Notifications
You must be signed in to change notification settings - Fork 78
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-Manu Ponce #67
Open
kmanuponce
wants to merge
1
commit into
Ada-C15:main
Choose a base branch
from
kmanuponce:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Paper-Manu Ponce #67
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>Weather Report</title> | ||
<link rel="stylesheet" href="styles/index.css" /> | ||
</head> | ||
|
||
<body> | ||
<header class="header_header"> | ||
<h1>Weather Report</h1> | ||
<span> </span> | ||
</header> | ||
|
||
<section class="temperature_section"> | ||
<h2>Temperature</h2> | ||
<div class="temperature_content"> | ||
<div class="temperature_controls"> | ||
<span id="increaseTempControl">⬆️</span> | ||
<span id="decreaseTempControl">⬇️</span> | ||
</div> | ||
<span id="tempValue" class="yellow">63</span> | ||
</div> | ||
</section> | ||
|
||
|
||
<section class="sky_section"> | ||
<h2>Sky</h2> | ||
<select id="skySelect"> | ||
<option value="sunny">Sunny</option> | ||
<option value="cloudy">Cloudy</option> | ||
<option value="rainy">Rainy</option> | ||
<option value="snowy">Snowy</option> | ||
</select> | ||
</section> | ||
|
||
<section class="garden_section"> | ||
<h2>Weather Garden</h2> | ||
<div id="gardenContent" class="garden_content snowy"> | ||
<div id="sky">☁️ ☁️ ☁️ ☀️ ☁️ ☁️</div> | ||
<div id="landscape">🌾🌾_🍃_🪨__🛤_🌾🌾🌾_🍃</div> | ||
</div> | ||
</section> | ||
|
||
<!-- <section class="city-name_section"></section> --> | ||
|
||
<script src="scripts/index.js"></script> | ||
</body> | ||
</html> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
let tempValue = document.getElementById("tempValue"); | ||
let temperature = 63; | ||
let landscape = document.getElementById("landscape") | ||
let skySelect = document.getElementById("skySelect") | ||
let skyElement = document.getElementById("sky") | ||
|
||
let increaseTempControl = document.getElementById("increaseTempControl"); | ||
increaseTempControl.addEventListener("click", function () { | ||
temperature += 1; | ||
tempValue.innerHTML = temperature; | ||
if (temperature >= 80) { | ||
tempValue.className = "red"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should avoid class names like yellow and instead use something like warm or hot. A class name should describe what the thing means, not its effect. The example will be updated to reflect this for next cohort. |
||
landscape.innerHTML = "🌵__🐍_🦂_🌵🌵__🐍_🏜_🦂"; | ||
} else if (temperature >= 70) { | ||
tempValue.className = "orange"; | ||
landscape.innerHTML = "🌸🌿🌼__🌷🌻🌿_☘️🌱_🌻🌷" | ||
} else if (temperature >= 60) { | ||
tempValue.className = "yellow"; | ||
landscape.innerHTML = "🌾🌾_🍃_🪨__🛤_🌾🌾🌾_🍃" | ||
} else if (temperature >= 50) { | ||
tempValue.className = "green"; | ||
landscape.innerHTML = "🌲🌲⛄️🌲⛄️🍂🌲🍁🌲🌲⛄️🍂🌲" | ||
} else { | ||
tempValue.className = "teal" | ||
landscape.innerHTML = "🥶🥶🥶🥶🥶🥶🥶🥶🥶🥶🥶🥶" | ||
} | ||
}); | ||
|
||
let decreaseTempControl = document.getElementById("decreaseTempControl"); | ||
decreaseTempControl.addEventListener("click", function () { | ||
temperature -= 1; | ||
tempValue.innerHTML = temperature; | ||
if (temperature >= 80) { | ||
tempValue.className = "red"; | ||
landscape.innerHTML = "🌵__🐍_🦂_🌵🌵__🐍_🏜_🦂"; | ||
} else if (temperature >= 70) { | ||
tempValue.className = "orange"; | ||
landscape.innerHTML = "🌸🌿🌼__🌷🌻🌿_☘️🌱_🌻🌷" | ||
} else if (temperature >= 60) { | ||
tempValue.className = "yellow"; | ||
landscape.innerHTML = "🌾🌾_🍃_🪨__🛤_🌾🌾🌾_🍃" | ||
} else if (temperature >= 50) { | ||
tempValue.className = "green"; | ||
landscape.innerHTML = "🌲🌲⛄️🌲⛄️🍂🌲🍁🌲🌲⛄️🍂🌲" | ||
} else { | ||
tempValue.className = "teal" | ||
landscape.innerHTML = "🥶🥶🥶🥶🥶🥶🥶🥶🥶🥶🥶🥶" | ||
} | ||
}); | ||
|
||
skySelect.addEventListener("change", function (event) { | ||
if (event.target.value === "sunny") { | ||
skyElement.innerHTML = "☁️ ☁️ ☁️ ☀️ ☁️ ☁️" | ||
} else if (event.target.value === "cloudy") { | ||
skyElement.innerHTML = "☁️☁️ ☁️ ☁️☁️ ☁️ 🌤 ☁️ ☁️☁️" | ||
} else if (event.target.value === "rainy") { | ||
skyElement.innerHTML = "🌧🌈⛈🌧🌧💧⛈🌧🌦🌧💧🌧🌧" | ||
} else { | ||
skyElement.innerHTML = "🌨❄️🌨🌨❄️❄️🌨❄️🌨❄️❄️🌨🌨" | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
|
||
.header_header { | ||
color: white; | ||
grid-column: span3; | ||
grid-column-start: span 3; | ||
grid-column-end: auto; | ||
display: flex; | ||
margin: 2rem auto 3rem 0; | ||
margin-top: 2rem; | ||
margin-right: auto; | ||
margin-bottom: 3rem; | ||
margin-left: 0px; | ||
align-content: center; | ||
} | ||
|
||
body { | ||
display: grid; | ||
grid-template-columns: 1fr 2fr; | ||
grid-template-rows: auto auto auto auto; | ||
grid-gap: 1rem; | ||
font-family: "Rubik", sans-serif; | ||
font-size: 18px; | ||
/* background-color: #1b69f9; */ | ||
background-image: url(https://c4.wallpaperflare.com/wallpaper/134/37/127/seasons-spring-summer-winter-wallpaper-preview.jpg); | ||
background-size: 100%; | ||
margin: 2rem; | ||
} | ||
|
||
.temperature_section { | ||
grid-row: 2; | ||
} | ||
|
||
.temperature_content { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.temperature_section, .sky_section, .city-name_section { | ||
border-radius: 8px; | ||
padding: 2rem; | ||
background-color: white; | ||
} | ||
|
||
section { | ||
display: block; | ||
} | ||
|
||
.temperature_controls { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
div { | ||
display: block; | ||
} | ||
|
||
#tempValue { | ||
font-size: 3rem; | ||
margin-left: 1.5rem; | ||
/* padding-right: 1rem; */ | ||
/* margin-right: 1.5rem; */ | ||
} | ||
|
||
.red { | ||
color: rgb(255, 4, 4); | ||
} | ||
|
||
.orange { | ||
color: rgb(255, 114, 6); | ||
} | ||
|
||
.yellow { | ||
color: gold; | ||
} | ||
|
||
.green { | ||
color: rgb(48, 255, 7); | ||
} | ||
|
||
.teal{ | ||
color: rgb(4, 255, 217); | ||
} | ||
|
||
.sky__section { | ||
grid-row: 3 | ||
|
||
} | ||
|
||
.snowy { | ||
background-color: lightsteelblue; | ||
} | ||
|
||
.garden_content { | ||
min-height: 200px; | ||
max-width: fit-content; | ||
margin: auto; | ||
padding: 2rem; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
border-radius: 8px; | ||
font-size: 2em; | ||
} | ||
.garden_section { | ||
grid-row: span 3; | ||
grid-column: 2; | ||
text-align: center; | ||
align-self: center; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You repeat a lot of logic between
increaseTempControl
anddecreaseTempControl
a helper function could DRY up your code.