From 63aa381b930896a25d8b7159eeb22e11691ed4aa Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Tue, 22 Mar 2022 16:09:23 +0530 Subject: [PATCH 1/7] 19BCE10041 --- style.css | 104 ++++++++++++++++++++------------------------------- weather.html | 60 ++++++++++++++++------------- weather.js | 53 ++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 90 deletions(-) diff --git a/style.css b/style.css index dc1968f..4fe4092 100644 --- a/style.css +++ b/style.css @@ -1,63 +1,41 @@ -.grid-container { - - display: grid; - grid-template-columns: 50% 50%; - background-color: white; - padding: 5px; - height: 100%; - } - .grid-item1{ - - background-color: royalblue; - display: grid; - } - .grid-item{ - - background-color: lightgrey; - display: grid; - } - h1, h3{ - color: white; - font-weight: bolder; - margin-top: 25%; - } - span{ - color: black; - font-weight: bolder; - } - p{ - color: white; - - } - li{ - color: white; - - } - .bdy{ - margin-left: 20%; - } - .dd{ - margin-left: 25%; - margin-top: 10%; - } - #pp{ - color: black; - } - #show{ - color: black; - font-size: xx-large; - } - #show1,#show3{ - color: black; - font-size: medium; - } - #show2{ - color: black; - font-size: xx-large; - } - #tt{ - margin-left: 20%; - margin-top: 20%; - } - - \ No newline at end of file +body { + background-color: #6b029c; + text-align: center; + color: white; + font-size: 3rem; +} +input { + font-size: 3rem; + margin-top: 10%; + border-width: 0px; + border-top-left-radius: 2rem; + border-bottom-right-radius: 2rem; + padding: 10px; + background-color: #9e4ec2; + border-bottom: 3px solid #dc8a04; +} +.city { + margin-top: 2%; +} + +.date { + font-size: 1.5rem; +} +.temp { + margin-top: 1%; + font-size: 8rem; + margin-bottom: 1%; + text-shadow: 0px 5px black; + font-weight: 900; +} +.weather { + font-size: 2rem; + font-style: italic; + font-weight: 900; + text-shadow: 0px 3px black; +} +.hi-low { + font-size: 1.5rem; + font-weight: 900; + text-shadow: 0px 3px black; +} diff --git a/weather.html b/weather.html index bb2d461..4714419 100644 --- a/weather.html +++ b/weather.html @@ -1,30 +1,36 @@ - - - - - Weather app - - - -
-
- -
-
-
-
-
-
-
-
°c
-
-
°c / °c
-
-
-
- - + + + + + Weather app + + + +
+
+ +
+
+
+
+
+
+
+
°c
+
+
°c / °c
+
+
+
+ + diff --git a/weather.js b/weather.js index c5e0068..9180222 100644 --- a/weather.js +++ b/weather.js @@ -1 +1,54 @@ //Complete the Weather API Backend part using openweathermap api +function apidata() { + var weekDays = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ]; + var month = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ]; + var today = new Date(); + var key = "6a2547232fc58c844e7d59f7243fcd94"; + var input = document.querySelector("#input").value; + const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid=${key}`; + fetch(url) + .then((response) => response.json()) + .then((data) => { + var temp = data.main.temp; + var temp_min = data.main.temp_min; + var temp_max = data.main.temp_max; + var country = data.sys.country; + var weather_status = data.weather[0].main; + var city = data.name; + console.log(temp, temp_min, temp_max, city, country, weather_status); + document.querySelector(".city").innerHTML = city + ", " + country; + document.querySelector(".date").innerHTML = + weekDays[today.getDay()] + + " " + + today.getDate() + + " " + + month[today.getMonth()] + + " " + + today.getFullYear(); + document.querySelector(".temp").innerHTML = temp + "°c"; + document.querySelector(".weather").innerHTML = weather_status + document.querySelector(".hi-low").innerHTML = + temp_min + "°c /" + temp_max + "°c"; + }); +} From 3aa3f9687e6d13338b23e305b694350838e350f0 Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Thu, 24 Mar 2022 19:20:38 +0530 Subject: [PATCH 2/7] 19BCE10041 --- .gitignore | 1 + weather.html | 1 + weather.js | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2d72a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.js \ No newline at end of file diff --git a/weather.html b/weather.html index 4714419..fbc5864 100644 --- a/weather.html +++ b/weather.html @@ -32,5 +32,6 @@ + diff --git a/weather.js b/weather.js index 9180222..3e79b14 100644 --- a/weather.js +++ b/weather.js @@ -1,4 +1,5 @@ //Complete the Weather API Backend part using openweathermap api + function apidata() { var weekDays = [ "Sunday", @@ -24,7 +25,7 @@ function apidata() { "December", ]; var today = new Date(); - var key = "6a2547232fc58c844e7d59f7243fcd94"; + var key = config.SECRET_API_KEY;; var input = document.querySelector("#input").value; const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid=${key}`; fetch(url) From a47b2fd05c3d4e8c262b9e3cd4230581ae6f1f63 Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Thu, 24 Mar 2022 19:29:06 +0530 Subject: [PATCH 3/7] 19BCE10041 --- weather.html => index.html | 74 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) rename weather.html => index.html (96%) diff --git a/weather.html b/index.html similarity index 96% rename from weather.html rename to index.html index fbc5864..1890815 100644 --- a/weather.html +++ b/index.html @@ -1,37 +1,37 @@ - - - - - - - Weather app - - - -
-
- -
-
-
-
-
-
-
-
°c
-
-
°c / °c
-
-
-
- - - - + + + + + + + Weather app + + + +
+
+ +
+
+
+
+
+
+
+
°c
+
+
°c / °c
+
+
+
+ + + + From f032d3007c372881c8cb51d930f24416f6be0ef2 Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Thu, 24 Mar 2022 19:32:54 +0530 Subject: [PATCH 4/7] 19BCE10041 --- weather.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weather.js b/weather.js index 3e79b14..031e1d0 100644 --- a/weather.js +++ b/weather.js @@ -25,7 +25,7 @@ function apidata() { "December", ]; var today = new Date(); - var key = config.SECRET_API_KEY;; + var key = "6a2547232fc58c844e7d59f7243fcd94"; var input = document.querySelector("#input").value; const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid=${key}`; fetch(url) From 620db2c753bb79ff58538452728adb0723ffebc3 Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Thu, 24 Mar 2022 19:35:28 +0530 Subject: [PATCH 5/7] 19BCE10041 --- .gitignore | 1 - config.js | 0 index.html | 1 - 3 files changed, 2 deletions(-) create mode 100644 config.js diff --git a/.gitignore b/.gitignore index a2d72a2..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -config.js \ No newline at end of file diff --git a/config.js b/config.js new file mode 100644 index 0000000..e69de29 diff --git a/index.html b/index.html index 1890815..38508e7 100644 --- a/index.html +++ b/index.html @@ -32,6 +32,5 @@ - From 37f390f155e8d423e58c1f63785990766a4a8ae2 Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Thu, 24 Mar 2022 19:38:33 +0530 Subject: [PATCH 6/7] 19BCE10041 --- weather.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/weather.js b/weather.js index 031e1d0..e687737 100644 --- a/weather.js +++ b/weather.js @@ -25,9 +25,8 @@ function apidata() { "December", ]; var today = new Date(); - var key = "6a2547232fc58c844e7d59f7243fcd94"; var input = document.querySelector("#input").value; - const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid=${key}`; + const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid="6a2547232fc58c844e7d59f7243fcd94"`; fetch(url) .then((response) => response.json()) .then((data) => { From 035876cfa6ee845dc349db30a55bd6524aaad8e1 Mon Sep 17 00:00:00 2001 From: Gurshaan7869 Date: Thu, 24 Mar 2022 19:42:50 +0530 Subject: [PATCH 7/7] 19BCE10041 --- weather.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weather.js b/weather.js index e687737..913e0d8 100644 --- a/weather.js +++ b/weather.js @@ -26,7 +26,7 @@ function apidata() { ]; var today = new Date(); var input = document.querySelector("#input").value; - const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid="6a2547232fc58c844e7d59f7243fcd94"`; + const url = `https://api.openweathermap.org/data/2.5/weather?q=${input}&units=metric&appid=6a2547232fc58c844e7d59f7243fcd94`; fetch(url) .then((response) => response.json()) .then((data) => {