From 9a3d7412155c141b8c352d6f8e046af6aedbeb70 Mon Sep 17 00:00:00 2001 From: Rosy Basil Date: Fri, 18 Oct 2024 15:53:22 -0400 Subject: [PATCH 1/4] "final edits commit" --- index.html | 14 ++++++++++++++ inxed.html | 11 +++++++++++ main.css | 16 ++++++++++++++++ main.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 index.html create mode 100644 inxed.html create mode 100644 main.css create mode 100644 main.js diff --git a/index.html b/index.html new file mode 100644 index 0000000..e35837b --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Holiday Finder + + +

Holidays Celebrated in your Country

+ + + + \ No newline at end of file diff --git a/inxed.html b/inxed.html new file mode 100644 index 0000000..d01f779 --- /dev/null +++ b/inxed.html @@ -0,0 +1,11 @@ + + + + + + Document + + + + + \ No newline at end of file diff --git a/main.css b/main.css new file mode 100644 index 0000000..0361887 --- /dev/null +++ b/main.css @@ -0,0 +1,16 @@ +ul { + list-style-type: none; + padding: 0; +} + +h1{ + text-align: center; +} + +li{ + text-align: center; + word-spacing: 0.3em; + padding:15px; + border-bottom: 2px dotted grey; + +} \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..cd22025 --- /dev/null +++ b/main.js @@ -0,0 +1,29 @@ +document.addEventListener('DOMContentLoaded', function() { + const url="http://www.geoplugin.net/json.gp" + fetch(url) + .then(response => response.json()) + .then(data1 => { + console.log(data1) + console.log(data1.geoplugin_countryCode) //country code + + fetch(`https://date.nager.at/api/v3/publicholidays/2024/${data1.geoplugin_countryCode}`) + + .then(response => response.json()) + .then(data2 => { + console.log(data2) + + const repeat = new Set(); // Set to store repeating dates + + data2.forEach(element => { + if (!repeat.has(element.date)) { // If date hasn't been seen before + repeat.add(element.date); // Add date to the Set + + console.log(element.date); + console.log(element.name); + + document.querySelector('ul').innerHTML +=`
  • ${element.name} ${element.date}
  • ` + } + }); + }) + }); +}); From 60c9343c373ffe3028e180ac6075cf58b02e33a5 Mon Sep 17 00:00:00 2001 From: Rosy Basil Date: Wed, 13 Nov 2024 10:49:47 -0500 Subject: [PATCH 2/4] deleted inxed --- inxed.html | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 inxed.html diff --git a/inxed.html b/inxed.html deleted file mode 100644 index d01f779..0000000 --- a/inxed.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Document - - - - - \ No newline at end of file From 4a1ebecbc035a69f4b6ffae846c9b1083e25b646 Mon Sep 17 00:00:00 2001 From: Rosy Basil Date: Wed, 13 Nov 2024 10:53:26 -0500 Subject: [PATCH 3/4] Update README.md --- README.md | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 83ce771..41673cc 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,4 @@ -# 📊 Project: Complex API 2 +# 📊 Holiday Finder based on Location -### Goal: Use data returned from one api to make a request to another api and display the data returned +### Goal: Use data returned from Geo-locator api to make a request to Holiday api and display the data returned -### How to submit your code for review: - -- Fork and clone this repo -- Create a new branch called answer -- Checkout answer branch -- Push to your fork -- Issue a pull request -- Your pull request description should contain the following: - - (1 to 5 no 3) I completed the challenge - - (1 to 5 no 3) I feel good about my code - - Anything specific on which you want feedback! - -Example: -``` -I completed the challenge: 5 -I feel good about my code: 4 -I'm not sure if my constructors are setup cleanly... -``` From 7e6f7ceac59878617db702ef3ad0ed306d84030e Mon Sep 17 00:00:00 2001 From: Rosy Basil Date: Wed, 13 Nov 2024 10:54:54 -0500 Subject: [PATCH 4/4] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 41673cc..a23c44a 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@ ### Goal: Use data returned from Geo-locator api to make a request to Holiday api and display the data returned + +![Screenshot 2024-11-13 at 10 53 47 AM](https://github.com/user-attachments/assets/590e507c-cc91-48cd-98c2-fdbc6bb02148)