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: Saejin #65
Open
saebaebae
wants to merge
6
commits into
Ada-C15:main
Choose a base branch
from
saebaebae: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: Saejin #65
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dc50b9d
basic outline, raise/lower/reset temperature buttons, city name submi…
saebaebae 9d1b280
added some images, comment box, landscape box, and dropdown menus
saebaebae c84446b
added sky/land options
saebaebae d7ad03a
finishing touches for dropdown menus, added js functions to change ba…
saebaebae c6359ca
all functionality, just missing the reset button for city name
saebaebae ddeaf12
finishing touches, reset city button added, Mina approved.
saebaebae 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,69 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Weather Report</title> | ||
<link rel="stylesheet" href="styles/index.css"/> | ||
</head> | ||
<body class="none"> | ||
<header > | ||
<h1> The Weathahhh</h1> | ||
</header> | ||
|
||
<section id="city"> | ||
<span id="cityName">Worcestah, kid</span> | ||
<span id="cityInputBox"> | ||
<input id="cityInput" placeholder="where you from kid"></input> | ||
<button class = cityBtn id="submitBtn">Submit</button><button class = cityBtn id="resetCityBtn">Reset</button> | ||
</section> | ||
|
||
<div> </div> | ||
|
||
<section id="boxRow"> | ||
|
||
|
||
<section id="tempContainer"> | ||
<span id="temperature">70F</span> | ||
<span class="horizontalSpace"></span> | ||
<span id="btn-group"> <ul> | ||
<li><span id="raiseTemp">⬆️</span></li> | ||
<li><span id ="lowerTemp">⬇️</span></li> | ||
<li><span id="reset"> 🔁 </span></li> | ||
</ul></span> | ||
</section> | ||
|
||
<span class = "tropical" id="landscapeContainer"> | ||
Landscape | ||
</span> | ||
|
||
|
||
<span class="blue" id="skyview"> | ||
It's wicked nice. | ||
</span> | ||
|
||
|
||
</section> | ||
|
||
<span> </span> | ||
|
||
<section id="inputs"> | ||
<span></span> | ||
<span></span> | ||
|
||
<section id="sky" class="dropdown"> | ||
<select id="skyChoices"> | ||
<option value ="blue">Select a sky</option> | ||
<option value="hot">Hot and Sunny</option> | ||
<option value="rainy">Rainy</option> | ||
<option value="cloudy">Cloudy</option> | ||
<option value="night">Night</option> | ||
</select> | ||
</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,148 @@ | ||
const tempState = { | ||
temp: 70 | ||
}; | ||
|
||
const temperature = document.querySelector("#temperature"); | ||
const landscape = document.querySelector("#landscapeContainer"); | ||
|
||
const hotter = (event) => { | ||
tempState.temp +=1; | ||
temperature.textContent = `${tempState.temp}F`; | ||
temperature.style.color = tempColor(); | ||
checkLand(); | ||
landText(); | ||
}; | ||
|
||
const colder = (event) => { | ||
tempState.temp -=1; | ||
// const landscape = document.querySelector("#landscapeContainer"); | ||
temperature.textContent = `${tempState.temp}F`; | ||
temperature.style.color = tempColor(); | ||
checkLand(); | ||
landText(); | ||
}; | ||
|
||
const reset = (event) => { | ||
tempState.temp = 70; | ||
// const landscape = document.querySelector("#landscapeContainer"); | ||
temperature.textContent = `${tempState.temp}F` | ||
temperature.style.color = tempColor(); | ||
checkLand(); | ||
landscape.textContent = "Landscape" | ||
}; | ||
|
||
const tempColor = () => { | ||
if (tempState.temp >= 80) { | ||
return "red"; | ||
} else if (tempState.temp >= 70) { | ||
return "orange"; | ||
} else if (tempState.temp >= 60) { | ||
return "yellow"; | ||
} else if (tempState.temp >= 50) { | ||
return "green"; | ||
} else if (tempState.temp <= 49) { | ||
return "rgb(0, 251, 255)"; | ||
} | ||
}; | ||
|
||
const checkLand = () => { | ||
if (tempState.temp >= 80) { | ||
return landscape.className = "desert"; | ||
} else if (tempState.temp >= 70) { | ||
return landscape.className = "tropical"; | ||
} else if (tempState.temp >= 60) { | ||
return landscape.className = "green"; | ||
} else if (tempState.temp >= 50) { | ||
return landscape.className = "cool"; | ||
} else if (tempState.temp <= 49) { | ||
return landscape.className = "icy"; | ||
} | ||
}; | ||
|
||
const landText = () => { | ||
if (tempState.temp >= 80) { | ||
return landscape.textContent = "It's a scorcha!"; | ||
} else if (tempState.temp >= 70) { | ||
return landscape.textContent = "Feels like summah"; | ||
} else if (tempState.temp >= 60) { | ||
return landscape.textContent = "Throw a yahd pahty!"; | ||
} else if (tempState.temp >= 50) { | ||
return landscape.textContent = "Grab yah coat"; | ||
} else if (tempState.temp <= 49) { | ||
return landscape.textContent = "Betta warm up the cah"; | ||
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. Very.... Boston of you |
||
} | ||
}; | ||
|
||
const cityState = { | ||
city: 0 | ||
}; | ||
|
||
const cityName = (event) => { | ||
cityState.city = document.querySelector('#cityInput').value; | ||
if (cityState.city) { | ||
const cityName = document.querySelector("#cityName") | ||
cityName.textContent = `✨ ✨ Beautiful ${cityState.city}!! ✨ ✨ ` | ||
}; | ||
}; | ||
|
||
const resetCity = (event) => { | ||
cityState.city = 0 | ||
const cityName = document.querySelector("#cityName") | ||
cityName.textContent = `Worcestah, kid` | ||
}; | ||
|
||
const skyState = { | ||
sky: "blue" | ||
} | ||
const selectSky = (event) => { | ||
skyState.sky = document.querySelector("#skyChoices").value; | ||
const selectedSky = document.querySelector("#skyview"); | ||
|
||
if (skyState.sky === "blue") { | ||
selectedSky.className = "blue"; | ||
selectedSky.textContent = "It's wicked blue" | ||
} | ||
|
||
else if (skyState.sky === "hot") { | ||
selectedSky.className = "hotSky"; | ||
selectedSky.textContent = "It's wicked sunny" | ||
} | ||
|
||
else if (skyState.sky === "rainy") { | ||
selectedSky.className = "rainy"; | ||
selectedSky.textContent = "It's wicked rainy" | ||
} | ||
|
||
if (skyState.sky === "cloudy") { | ||
selectedSky.className = "cloudy"; | ||
selectedSky.textContent = "It's wicked cloudy" | ||
} | ||
|
||
else if (skyState.sky === "night") { | ||
selectedSky.className = "night"; | ||
selectedSky.textContent = "It's wicked dahk" | ||
} | ||
|
||
}; | ||
|
||
const registerEventHandlers = (event) => { | ||
const hotterButton = document.querySelector('#raiseTemp'); | ||
hotterButton.addEventListener("click", hotter); | ||
|
||
const colderButton = document.querySelector('#lowerTemp'); | ||
colderButton.addEventListener("click", colder); | ||
|
||
const resetButton = document.querySelector('#reset'); | ||
resetButton.addEventListener("click", reset); | ||
|
||
const cityButton = document.querySelector('#submitBtn'); | ||
cityButton.addEventListener("click", cityName); | ||
|
||
const resetCityBtn = document.querySelector('#resetCityBtn'); | ||
resetCityBtn.addEventListener("click", resetCity); | ||
|
||
const skyPic = document.querySelector("#skyChoices"); | ||
skyPic.addEventListener("change", selectSky); | ||
}; | ||
|
||
document.addEventListener("DOMContentLoaded", registerEventHandlers); |
Oops, something went wrong.
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.
A couple of notes:
event
parameter so you can drop it.Then you can use an anonymous function to call it when you register the event handlers.