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

Paper-Manu Ponce #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/wave1_wireframe.pdf
Binary file not shown.
53 changes: 53 additions & 0 deletions index.html
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>


61 changes: 61 additions & 0 deletions scripts/index.js
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 () {

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 and decreaseTempControl a helper function could DRY up your code.

temperature += 1;
tempValue.innerHTML = temperature;
if (temperature >= 80) {
tempValue.className = "red";

Choose a reason for hiding this comment

The 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 = "🌨❄️🌨🌨❄️❄️🌨❄️🌨❄️❄️🌨🌨"
}
})
110 changes: 110 additions & 0 deletions styles/index.css
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;
}