-
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
Pine-Roslyn M. #74
base: main
Are you sure you want to change the base?
Pine-Roslyn M. #74
Changes from all commits
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,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Weather Report</title> | ||
<link href="styles/index.css" rel="stylesheet" type="text/css" /> | ||
</head> | ||
<body id="all"> | ||
<main> | ||
<h1>Weather Report</h1> | ||
<h3>For the lovely town of ✨<span id="city">Leavenworth</span>✨</h3> | ||
<section class="main-container"> | ||
<section class="controls"> | ||
<div class="subcontrols">Temperature | ||
<div><span id="down">🧊</span><span class="tempcol" id="temp"> 70 </span><span id="up">🔥</span></div></div> | ||
<div class="subcontrols">Sky: | ||
<select id="sky" name="sky"> | ||
<option value="none">None</option> | ||
<option value="cloudy">Cloudy</option> | ||
<option value="snowy">Snowy</option> | ||
<option value="sunny">Sunny</option> | ||
<option value="rainy">Rainy</option> | ||
</select> | ||
</div> | ||
<div class="subcontrols"> | ||
<form id="filltown"> | ||
<label>Where are you???</label><br> | ||
<input type="text" id="filltownval" name="filltownval"><br> | ||
<input type="submit" value="Reset"> | ||
</form> | ||
</div> | ||
</section> | ||
<section class="garden-container">Whats going on in Leavyyy?? | ||
<section class="garden" id="gardenchange"> | ||
<div id="gardenactivity">☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️</div> | ||
<div id="landscape">🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲</div> | ||
</section> | ||
<div id="landscapetext"> </div> | ||
</section> | ||
</section> | ||
</main> | ||
<script src="scripts/index.js"> | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
const up = document.getElementById("up") | ||
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. This setup works, but if the script tag was moved from the bottom of the web page to the top, they would stop working, because they would attempt to run before the html loads. I would recommend grabbing these elements in the functions that need them, rather than doing it all at the same time here. |
||
const down = document.getElementById("down") | ||
const temp = document.getElementById("temp") | ||
const landscape = document.getElementById("landscape") | ||
const landscapetext = document.getElementById("landscapetext") | ||
const city = document.getElementById("city") | ||
const form = document.getElementById('filltown'); | ||
const sky = document.getElementById("sky") | ||
const state = {tempCount: 70}; | ||
const skyscene = document.getElementById('gardenactivity') | ||
const garden = document.getElementsByClassName('garden') | ||
|
||
const changeTempColor = () => { | ||
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. Great helper function! |
||
if (state.tempCount<=32){ | ||
temp.setAttribute('class', 'winter'); | ||
landscape.textContent="⛄️⛄️🗻⛷🏂⛄️⛄️🗻⛷🏂⛄️⛄️"; | ||
landscapetext.textContent="Its a bit chilly! Time to ski?!?"; | ||
document.getElementById('gardenchange').style.background="center / cover no-repeat url(../assets/leavenworth/winter.jpeg)" | ||
} else if (state.tempCount>32 && state.tempCount<=60){ | ||
temp.setAttribute('class', 'fall'); | ||
landscape.textContent="🍁🚵🏾♂️⛰🍁🚵🏽♀️🍁🚵🏾♂️⛰🍁🚵🏽♀️🍁🚵🏾♂️"; | ||
landscapetext.textContent="Shoulder season whats up! Time for some more mountain biking???"; | ||
document.getElementById('gardenchange').style.background="center / cover no-repeat url(../assets/leavenworth/fall.jpeg)" | ||
} else if (state.tempCount>60 && state.tempCount<=80){ | ||
temp.setAttribute('class', 'spring') | ||
landscape.textContent="🌲🧗🏾♀️🏔🌲🌲🧗🏾♀️🏔🌲🌲🧗🏾♀️🏔🌲"; | ||
landscapetext.textContent="PRIME CLIMBING TEMPS!!!"; | ||
document.getElementById('gardenchange').style.background="center / cover no-repeat url(../assets/leavenworth/spring.jpeg)" | ||
} else if (state.tempCount>80 && state.tempCount<=100){ | ||
temp.setAttribute('class', 'summer') | ||
landscape.textContent="🌻🏄🏾♀️🏝🛶🌻🏄🏾♀️🌻🏝🛶🌻🏄🏾♀️🌻"; | ||
landscapetext.textContent="Its getting hotttttt, maybe time for a plunge???"; | ||
document.getElementById('gardenchange').style.background="center / cover no-repeat url(../assets/leavenworth/summer.jpeg)" | ||
} else { | ||
temp.setAttribute('class', 'tooextreme') | ||
landscape.textContent="🍻📚🛋📺🍻📚🛋📺🍻📚🛋📺"; | ||
landscapetext.textContent="WAY TOO HOT TO LEAVE THE HOUSE! Time for beer or a book (or both?)!"; | ||
document.getElementById('gardenchange').style.background="center / cover no-repeat url(../assets/leavenworth/toohot.jpeg)" | ||
} | ||
} | ||
|
||
const changeCity = (event) => { | ||
const inputCity = document.getElementById("filltownval").value; | ||
city.textContent = inputCity; | ||
event.preventDefault(); | ||
} | ||
|
||
const changeSky = (event) =>{ | ||
if (sky.value == "cloudy"){ | ||
skyscene.textContent="☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️☁️" | ||
}else if (sky.value == "sunny"){ | ||
skyscene.textContent="☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️☀️"; | ||
}else if (sky.value == "rainy"){ | ||
skyscene.textContent="🌦🌦🌦🌦🌦🌦🌦🌦🌦🌦🌦🌦" | ||
}else if (sky.value == "snowy"){ | ||
skyscene.textContent="❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️" | ||
}else{ | ||
skyscene.textContent="🛸🛸🛸🛸🛸🛸🛸🛸🛸🛸🛸🛸" | ||
} | ||
event.preventDefault(); | ||
} | ||
|
||
sky.addEventListener('change', changeSky) | ||
|
||
form.addEventListener('input', changeCity) | ||
|
||
up.addEventListener('click', ()=>{ | ||
state.tempCount += 1; | ||
temp.textContent = `${state.tempCount}`; | ||
changeTempColor(); | ||
}) | ||
|
||
down.addEventListener('click', () => { | ||
Comment on lines
+63
to
+73
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. I recommend wrapping all of the |
||
state.tempCount -= 1; | ||
temp.textContent = `${state.tempCount}`; | ||
changeTempColor(); | ||
}) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
body { | ||
color: #D4B5B0; | ||
font-family: American Typewriter, serif; | ||
background: #383E56; | ||
justify-content: center; | ||
text-align: center; | ||
} | ||
|
||
.main-container { | ||
display: grid; | ||
grid-template-columns: 40% 60%; | ||
width: 100vw; | ||
height: 100vh; | ||
} | ||
|
||
.controls{ | ||
display: grid; | ||
grid-template-rows: 30% 30% 30%; | ||
} | ||
|
||
.subcontrols { | ||
display: flex; | ||
justify-content: space-evenly; | ||
flex-direction: column; | ||
margin: 15%; | ||
border: #EEDAD1; | ||
border-width: 20%; | ||
border-style: solid; | ||
background: #F69E7B; | ||
padding: 10px; | ||
border-radius: 10px; | ||
color: #383E56; | ||
font-weight: bold; | ||
text-align: center; | ||
} | ||
|
||
select{ | ||
text-align-last:center; | ||
} | ||
.garden-container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
text-align: center; | ||
} | ||
.garden { | ||
display: flex; | ||
flex-direction: column; | ||
margin-left: 20%; | ||
margin-right: 20%; | ||
border: #EEDAD1; | ||
border-width: 20%; | ||
padding: 10px; | ||
border-radius: 10px; | ||
border-style: solid; | ||
background: #EEDAD1; | ||
justify-content: space-between; | ||
gap: 200px; | ||
} | ||
|
||
.winter { | ||
color:white; | ||
} | ||
.fall { | ||
color:green | ||
} | ||
.spring{ | ||
color:yellow | ||
} | ||
.summer { | ||
color:red | ||
} | ||
.tooextreme { | ||
color:black | ||
} | ||
|
||
.temp { | ||
color: yellow; | ||
} | ||
|
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 add spacing between the span tags, look at padding-left and padding-right.