-
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-Glenda Chicas #54
base: main
Are you sure you want to change the base?
Changes from all commits
6139b25
3fa177a
cb001e5
faaa83c
8eb6fc5
45e4964
654d946
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,69 @@ | ||||
<!DOCTYPE html> | ||||
<html lang="en"> | ||||
<head> | ||||
<meta charset="utf-8" /> | ||||
<title>Weater Report</title> | ||||
<link rel="stylesheet" href="./styles/index.css" /> | ||||
<script src="scripts/index.js"></script> | ||||
<!-- <script src="https://kit.fontawesome.com/yourcode.js" crossorigin="anonymous"></script> --> | ||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/> | ||||
|
||||
</head> | ||||
<body> | ||||
<h1 id="h1t">Weater Report</h1> | ||||
<h2 id="city_name_display">For the city of:</h2> | ||||
<br> | ||||
<div class="container"> | ||||
<div class="box"> | ||||
<div class="content"> | ||||
<h3>Temperature</h3> | ||||
<section id="add-temp"> | ||||
<i style="font-size:24px" class="fa"></i> | ||||
</section> | ||||
<section id="temp-Container"> | ||||
<h2 id="tempCount">0</h2> | ||||
</section> | ||||
<section id="dec-temp"> | ||||
<i style="font-size:24px" class="fa"></i> | ||||
</section> | ||||
</div> | ||||
</div> | ||||
<!-- <section id="garden-title"><h2>Weather Garden</h2></section> --> | ||||
<div class="box"> | ||||
<div class="content"> | ||||
<h3>Sky</h3> | ||||
<select name="types-of-weather" id="weather-select"> | ||||
<option value="sunny">Sunny</option> | ||||
<option value="cloudy">Cloudy</option> | ||||
<option value="rainy">Rainy</option> | ||||
<option value="snowy">Snowy</option> | ||||
</select> | ||||
|
||||
</div> | ||||
</div> | ||||
|
||||
<div class="box"> | ||||
<div class="content"> | ||||
<h3>City name</h3> | ||||
|
||||
<input type="text" id="city_input_name"> | ||||
<div id="reset_button"> | ||||
<button>Reset</button> | ||||
</div> | ||||
|
||||
</div> | ||||
</div> | ||||
<div class="box-container"> | ||||
<div class="box" id="garden-box"> | ||||
</div> | ||||
<div class="box" id="garden"> | ||||
</div> | ||||
</div> | ||||
|
||||
</div> | ||||
</body> | ||||
|
||||
|
||||
|
||||
|
||||
Comment on lines
+65
to
+68
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.
Suggested change
|
||||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
let tempTrack = 0 | ||
const resetDefaultCityName = "Seattle" | ||
const incrementTemp = () => { | ||
const tempCountContainer = document.querySelector("#tempCount"); | ||
const gardenContainer = document.querySelector("#garden-box"); | ||
tempTrack += 1; | ||
if (tempTrack<= 40){ | ||
gardenContainer.textContent = "❄️☃️🏔🌌🥶🎄🌲🥶🎄🌲❄️☃️🏔🌌🌲❄️🥶🎄"; | ||
} else if (tempTrack <= 60){ | ||
gardenContainer.textContent = "🐰🐣🦋🍀💐🌼🌞🐣🦋🍀💐🌼🌞🐰🦋🍀"; | ||
}else if (tempTrack > 65) { | ||
gardenContainer.textContent = "🌴🏞🍦🌊🌅🏝🌳🌹☀️🥭🍍🍸🌴🏞🍦🍍"; | ||
} | ||
Comment on lines
+7
to
+13
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. Just a note this section is repetitive. I suggest:
If you want to go further you could combine this function and const changeTemp = (increment) => {
tempTrack += increment;
changeTemp(tempTrack);
} Then you can register the event handler with: upArrow.addEventListener("click", () => changeTemp( +1 ) ); |
||
tempCountContainer.textContent = `${tempTrack}`; | ||
tempNumbersChangeColor() | ||
}; | ||
const registerEventHandlers = () => { | ||
const upArrow = document.querySelector("#add-temp"); | ||
upArrow.addEventListener("click", incrementTemp); | ||
}; | ||
document.addEventListener("DOMContentLoaded", registerEventHandlers); | ||
|
||
|
||
const decreasedTemp = () => { | ||
// const tempContainor = document.querySelector("#dec-temp"); | ||
const tempCountCont= document.querySelector("#tempCount"); | ||
const gardenContainer= document.querySelector("#garden-box"); | ||
tempTrack -= 1; | ||
if (tempTrack<= 50){ | ||
gardenContainer.textContent = "❄️☃️⛷--🏔🌌🌧☕️--🥶🎄🌲"; | ||
} else if (tempTrack <= 65){ | ||
gardenContainer.textContent = "🌤🐰--🌈🐣🦋--🍀💐--🌼🌞"; | ||
}else if (tempTrack > 65) { | ||
gardenContainer.textContent = "🌴🏞--🍦🌊--🌅🏝--🌳🌹--☀️🥭🍍🍸"; | ||
} | ||
tempCountCont.textContent = `${tempTrack}`; | ||
tempNumbersChangeColor() | ||
}; | ||
const decreasedEventHandlers = () => { | ||
const downArrow = document.querySelector("#dec-temp"); | ||
downArrow.addEventListener("click", decreasedTemp); | ||
}; | ||
document.addEventListener("DOMContentLoaded", decreasedEventHandlers); | ||
|
||
|
||
const tempNumbersChangeColor = () => { | ||
console.log("we got here") | ||
const tempContainor = document.querySelector("#temp-Container"); | ||
if (tempTrack >= 80 ){ | ||
tempContainor.classList = ("too-hot"); | ||
} else if (tempTrack >= 70){ | ||
tempContainor.classList =("just-right"); | ||
}else if (tempTrack >= 60) { | ||
tempContainor.classList =("fresh"); | ||
}else if (tempTrack >= 50) { | ||
tempContainor.classList =("getting-cold"); | ||
}else if (tempTrack <= 49) { | ||
tempContainor.classList = ("too-cold"); | ||
} | ||
|
||
}; | ||
|
||
const changeColorNumberEventHandlers = () => { | ||
const downArrow = document.querySelector("#tempCount"); | ||
downArrow.addEventListener("click", tempNumbersChangeColor); | ||
}; | ||
document.addEventListener("DOMContentLoaded", changeColorNumberEventHandlers); | ||
|
||
|
||
|
||
const skyChanger = () => { | ||
const skyContainer= document.querySelector("#weather-select"); | ||
const gardenBox= document.querySelector("#garden"); | ||
|
||
const sky = skyContainer.value | ||
console.log(sky) | ||
if (sky === "sunny") { | ||
gardenBox.textContent = "☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️"; | ||
} else if (sky === "cloudy") { | ||
gardenBox.textContent = "☁️☁️ ⛅️☁️ ⛅️☁️☁️ ⛅️☁️☁️ ⛅️☁️☁️ ⛅️☁️☁️"; | ||
} else if (sky === "rainy" ) { | ||
gardenBox.textContent = "🌧🌧🌧🌧🌧🌧🌧🌧🌧🌧🌧🌧🌧🌧"; | ||
} else if (sky === "snowy"){ | ||
gardenBox.textContent = "🌨❄️🌨❄️🌨❄️🌨❄️🌨❄️🌨❄️🌨❄️🌨❄️🌨"; | ||
} | ||
}; | ||
|
||
const skyEventHandlers = () => { | ||
const selectSky = document.querySelector("#weather-select"); | ||
selectSky.addEventListener("change", skyChanger); | ||
}; | ||
|
||
document.addEventListener("DOMContentLoaded", skyEventHandlers); | ||
|
||
|
||
const upDatesCity = (cityName) => { | ||
const outPutBox = document.querySelector("#city_name_display"); | ||
outPutBox.textContent = "For the city of: " + cityName | ||
|
||
}; | ||
|
||
const displayCityName = () => { | ||
const inputBox = document.querySelector("#city_input_name"); | ||
upDatesCity(inputBox.value) | ||
}; | ||
|
||
const nameEventHandlers = () => { | ||
const selectCity = document.querySelector("#city_input_name"); | ||
selectCity.addEventListener("input", displayCityName ); | ||
}; | ||
|
||
document.addEventListener("DOMContentLoaded", nameEventHandlers); | ||
|
||
|
||
const resetCityName = () => { | ||
upDatesCity(resetDefaultCityName) | ||
const inputBox = document.querySelector("#city_input_name"); | ||
inputBox.value = resetDefaultCityName | ||
} | ||
|
||
const resetEventHandlers = () => { | ||
const selectCity = document.querySelector("#reset_button"); | ||
selectCity.addEventListener("click", resetCityName ); | ||
}; | ||
|
||
document.addEventListener("DOMContentLoaded", resetEventHandlers); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
font-family: helvetica neue light italic ; | ||
background-color: rgb(239, 255, 255); | ||
/* display: flex; */ | ||
} | ||
|
||
nav { | ||
position: flex; | ||
top: 200px; | ||
left: 50%; | ||
margin-top: 100px; | ||
margin-left: 70px; | ||
transform: translate(-50%, -50%); | ||
background: #D8D8D8; | ||
width: 100px; | ||
line-height: 15px; | ||
padding: 8px 25px; | ||
} | ||
|
||
nav label { | ||
color: white; | ||
font-size: 15px ; | ||
/* display: block; */ | ||
cursor: pointer; | ||
|
||
} | ||
|
||
select { | ||
margin-top: 50px; | ||
} | ||
|
||
|
||
.botton span { | ||
float: right; | ||
line-height: 35px; | ||
} | ||
.container { | ||
position: relative; | ||
width: 100px; | ||
height: 300px; | ||
margin: 240px, auto; | ||
|
||
} | ||
|
||
.container .box { | ||
position: relative; | ||
width: calc(400px - 30px); | ||
height: calc(250px - 30px); | ||
background: rgb(248, 246, 246); | ||
/* float: left; */ | ||
bottom: -100px; | ||
margin: 30px; | ||
box-sizing: border-box; | ||
border-radius: 10px; | ||
|
||
} | ||
|
||
.box-container { | ||
background: rgba(138, 241, 216, 0.432); | ||
position: absolute; | ||
top: 100%; | ||
left: 500%; | ||
box-sizing: border-box; | ||
border-radius: 10px; | ||
height: 400px; | ||
text-align: center; | ||
|
||
} | ||
|
||
.container .box .icon{ | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
/* background: rgb(0, 183, 255); */ | ||
transition: 0.5s; | ||
z-index: 1; | ||
} | ||
|
||
.container .box .icon { | ||
top: 20px; | ||
left: calc(50% - 40px ); | ||
width: 80px; | ||
height: 80px; | ||
border-radius: 50%; | ||
|
||
} | ||
|
||
|
||
.container .box .icon .fa { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
font-size: 80px; | ||
transition: 0.5s; | ||
color: aquamarine; | ||
} | ||
#garden-box { | ||
background: transparent; | ||
width: 600px; | ||
height: 45%; | ||
text-align: center; | ||
} | ||
|
||
#garden { | ||
background: transparent; | ||
height: 45%; | ||
text-align: center; | ||
} | ||
|
||
#reset_button { | ||
margin-top: -21px; | ||
margin-left: 150px; | ||
} | ||
|
||
#tempCount { | ||
font-size: 40px; | ||
} | ||
|
||
|
||
|
||
|
||
.container .box .content { | ||
position: absolute; | ||
height: 100; | ||
text-align: left; | ||
padding: 20px; | ||
box-sizing: border-box; | ||
transition: 0.5s; | ||
} | ||
|
||
.container .box .content h3 { | ||
margin: 0; | ||
padding: 0; | ||
color: rgba(223, 252, 252, 0.144); | ||
font-size: 24px; | ||
|
||
} | ||
|
||
.container .box .content h3 { | ||
margin: 0; | ||
padding: 0; | ||
color: black; | ||
|
||
} | ||
|
||
.container .box:nth-child(1) .icon{ | ||
background: #319635; | ||
} | ||
|
||
.too-hot { | ||
color: red; | ||
} | ||
|
||
.just-right { | ||
color: rgb(255, 226, 131) | ||
} | ||
|
||
.fresh { | ||
color: #a0d366cc; | ||
} | ||
|
||
.getting-cold { | ||
color:rgb(139, 233, 250) | ||
} | ||
|
||
.too-cold { | ||
color:rgba(0, 0, 255, 0.445); | ||
} |
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 should probably give this a default until the user enters a value in the input.