-
Notifications
You must be signed in to change notification settings - Fork 39
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
Final edit #16
Open
Shani4-1
wants to merge
6
commits into
joinpursuit:main
Choose a base branch
from
Shani4-1: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
Final edit #16
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d45eded
Added header,title, and css file.
Shani4-1 62cf25a
Created search form, aside, and main elements.
Shani4-1 c0e5b73
Modified index.html/style.css & created weather.js
Shani4-1 1089daf
Fetched API finally got it working!!
Shani4-1 786355b
Got all info on page, css messed up, lost my links
Shani4-1 d2c23c7
Idk how to get my link back or fix styling issues.
Shani4-1 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
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,3 @@ | ||
{ | ||
"liveServer.settings.port": 5502 | ||
} |
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,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width"> | ||
<title>Weather App</title> | ||
<link rel="stylesheet" href="./style.css"/> | ||
<script defer src="weather.js"></script> | ||
</head> | ||
<body> | ||
<header> | ||
<h1>Weather App</h1> | ||
<!-- <a href="https://wttr.in/">wttr.in</a> --> | ||
<form> | ||
<label>Pick a location</label> | ||
<input id="location" name="-search-bar" type="text" required/> | ||
<button type="submit">Get Weather</button> | ||
</form> | ||
</header> | ||
<aside></aside> | ||
<main id="current" class="current"> | ||
<article id="location-info"> | ||
|
||
</article> | ||
<aside class="forecast"> | ||
<article id="one"> | ||
<h4 id="today"></h3> | ||
<br> | ||
</article> | ||
<article id="two"> | ||
<h4 id="tomorrow"></h4> | ||
<br> | ||
</article> | ||
<article id="three"> | ||
<h4 id="day-after-tomorrow"></h4> | ||
<br> | ||
</article> | ||
</aside> | ||
</main> | ||
<aside class="side-bar"> | ||
<section></section> | ||
<h4>Previous Searches</h4> | ||
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 needs to be inside Also it is missing the "No previous searches" text |
||
<ul class="previous-searches"> </ul> | ||
</aside> | ||
|
||
|
||
|
||
</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,79 @@ | ||
header { | ||
background-color: rgb(104, 241, 216); | ||
text-align: center; | ||
box-sizing: border-box; | ||
border-style: solid; | ||
border-color: black; | ||
height: 200px; | ||
width: 75%; | ||
margin: 10px auto; | ||
|
||
|
||
|
||
} | ||
h1 { | ||
/* padding-top: 20px; */ | ||
font-size: 60px; | ||
} | ||
|
||
form { | ||
font-size: 25px; | ||
} | ||
form input { | ||
height: 25px; | ||
width: 180px; | ||
} | ||
form button { | ||
height:30px; | ||
width: 125px; | ||
font-size: 15px; | ||
|
||
} | ||
main { | ||
display: grid; | ||
block-size: fit-content; | ||
position: fixed; | ||
background-color: rgb(244, 245, 237); | ||
box-sizing: border-box; | ||
margin-left: 15%; | ||
min-height: 100px; | ||
max-height: 50%; | ||
width: 50%; | ||
font-size: 25px; | ||
text-align: center; | ||
border: 1px solid rgb(104, 241, 216); | ||
|
||
} | ||
.previous-searches link { | ||
list-style-type: circle; | ||
} | ||
/* main article { | ||
padding-top: 15px; | ||
} */ | ||
|
||
.side-bar { | ||
|
||
box-sizing: border-box; | ||
font-size: 25px; | ||
text-align: right; | ||
margin: 10px 200px; | ||
|
||
|
||
} | ||
.heading { | ||
font-size: 50px; | ||
font-weight: bold; | ||
} | ||
.forecast { | ||
display: grid; | ||
position: fixed; | ||
bottom: 0px; | ||
width: auto; | ||
grid-template-columns: repeat(3, 250px); | ||
grid-auto-rows: minmax(100px, auto); | ||
margin: 100px 100px; | ||
} | ||
|
||
|
||
|
||
|
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,119 @@ | ||
const BASE_URL = "https://wttr.in" | ||
const form = document.querySelector("form"); | ||
const sidebar = document.querySelector(".side-bar") | ||
const userInput = document.querySelector("input") | ||
const main = document.querySelector("main"); | ||
const todayArticle = document.querySelector("#one"); | ||
const tomorrowArticle = document.querySelector("#two"); | ||
const dayAfterArticle = document.querySelector("#three") | ||
const current = document.querySelector("#current #location-info") | ||
const heading = document.createElement("h2"); | ||
current.innerHTML = "Choose a location to view the weather." | ||
const previousSearches = document.querySelector(".previous-searches") | ||
const ul = document.querySelector(".previous-searches") | ||
const getToday = document.querySelector("#today"); | ||
const getTomorrow = document.querySelector("#tomorrow"); | ||
const getDayAfter = document.querySelector("#day-after-tomorrow") | ||
|
||
form.addEventListener("submit", (event)=> { | ||
event.preventDefault(); | ||
const location = userInput.value | ||
|
||
|
||
// heading.textContent = label | ||
|
||
getWeatherByLocation(location); | ||
|
||
|
||
|
||
|
||
form.reset(); | ||
}) | ||
|
||
|
||
|
||
function getWeatherByLocation(location) { | ||
|
||
fetch(`${BASE_URL}/${location}?format=j1`) | ||
.then((response) => | ||
|
||
response.json() | ||
|
||
) | ||
.then((location) => { | ||
// const heading = document.querySelector(h2); | ||
const p = document.createElement("p"); | ||
p.setAttribute("class", "heading") | ||
const p1 = document.createElement("p"); | ||
const p2 = document.createElement("p"); | ||
const p3 = document.createElement("p"); | ||
const p4 = document.createElement("p"); | ||
|
||
const areaName = location.nearest_area[0].areaName; | ||
const region = location.nearest_area[0].region; | ||
const country = location.nearest_area[0].country[0].value; | ||
const feelsLike = location.current_condition[0].FeelsLikeF; | ||
|
||
const today = location.weather[0]; | ||
const todayAverageTemp = today.avgtempF | ||
const todayMaxTemp = today.maxtempF | ||
const todayMinTemp = today.mintempF | ||
const tomorrow = location.weather[1]; | ||
const tomorrowAverageTemp = tomorrow.avgtempF; | ||
const tomorrowMaxTemp = tomorrow.maxtempF; | ||
const tomorrowMinTemp = tomorrow.mintempF; | ||
const dayAfter = location.weather[2]; | ||
const dayAfterAverageTemp = dayAfter.avgtempF; | ||
const dayAfterMaxTemp = dayAfter.maxtempF; | ||
const dayAfterMinTemp = dayAfter.mintempF; | ||
todayArticle.append(`Average Temperature: ${todayAverageTemp}\u2109`); | ||
todayArticle.append(`Max Temperature: ${todayMaxTemp}\u2109`); | ||
todayArticle.append(`Min Temperature: ${todayMinTemp}\u2109`); | ||
tomorrowArticle.append(`Average Temperature: ${tomorrowAverageTemp}\u2109`); | ||
tomorrowArticle.append(`Max Temperature: ${tomorrowMaxTemp}\u2109`); | ||
tomorrowArticle.append(`Min Temperature: ${tomorrowMinTemp}\u2109`); | ||
dayAfterArticle.append(`Average Temperature: ${dayAfterAverageTemp}\u2109`); | ||
dayAfterArticle.append(`Max Temperature: ${dayAfterMaxTemp}\u2109`); | ||
dayAfterArticle.append(`Min Temperature: ${dayAfterMinTemp}\u2109`); | ||
getToday.innerText = "Today"; | ||
getTomorrow.innerText = "Tomorrow" | ||
getDayAfter.innerText = "Day After Tomorrow" | ||
|
||
|
||
|
||
|
||
|
||
|
||
main.append(p); | ||
p.append(`${areaName[0].value}`) | ||
main.append(p1); | ||
main.append(p2); | ||
main.append(p3); | ||
main.append(p4); | ||
p1.append(`Area: ${areaName[0].value}`); | ||
p2.append(`Region: ${region[0].value}`); | ||
p3.append(`Country: ${country}`); | ||
p4.append(`Currently: Feels Like ${feelsLike}\u2109`)/n; | ||
const li = document.createElement('li') | ||
ul.append(li) | ||
const link = document.createElement("a"); | ||
link.setAttribute("href", `${BASE_URL}/${areaName[0].value}.htm`); | ||
link.innerText = `${areaName[0].value} `; | ||
|
||
li.innerText = feelsLike + "\u2109"; | ||
|
||
li.prepend(link); | ||
|
||
|
||
console.log(location.current_condition[0].FeelsLikeF) | ||
|
||
}) | ||
|
||
|
||
.catch((error) => | ||
console.log(error)) | ||
} | ||
|
||
|
||
|
||
|
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.
this needs to be of input type=submit in order to pass the tests