From e9d149c39454f5fab3830922c5dda086a55f8943 Mon Sep 17 00:00:00 2001 From: LiadLati Date: Sun, 15 Dec 2024 16:02:55 +0200 Subject: [PATCH 1/2] final countries pages without bonus --- CountriesData.json | 4 +- css/common.css | 30 ++------ css/details.css | 43 +++++++++-- css/main.css | 27 +++++-- details.html | 138 ++++++++++++++++------------------ details.js | 18 +++++ index.html | 182 ++++++++++++++------------------------------- index.js | 115 ++++++++++++++++++++++++++++ 8 files changed, 319 insertions(+), 238 deletions(-) create mode 100644 details.js create mode 100644 index.js diff --git a/CountriesData.json b/CountriesData.json index 3db67ea..ca575fd 100644 --- a/CountriesData.json +++ b/CountriesData.json @@ -202,4 +202,6 @@ "region": "Europe", "capital": "Luxembourg" } -] \ No newline at end of file +] + + \ No newline at end of file diff --git a/css/common.css b/css/common.css index 7d63db5..c842fe0 100644 --- a/css/common.css +++ b/css/common.css @@ -112,30 +112,6 @@ button { font-size: 16px; } -.loader { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: #fafafa; - display: flex; - justify-content: center; - align-items: center; - z-index: 9; - transition: 0.2s linear, opacity 0.2s linear, visibility 0.3s linear; -} - -.loader.close { - opacity: 0; - visibility: hidden; -} - -.loader .spinner .icon { - font-size: 80px; - color: #111517; -} - .scroll-top { position: fixed; bottom: 20px; @@ -192,7 +168,6 @@ button { .header .logo h1 { font-size: 20px; } - @media (max-width: 400px) { .header .logo h1 { font-size: 16px; @@ -307,3 +282,8 @@ body.dark-theme .country-info li { body.dark-theme .country-info strong { color: white; } + +.body { + background-color: white; +} + diff --git a/css/details.css b/css/details.css index 6108d5b..15d1ada 100644 --- a/css/details.css +++ b/css/details.css @@ -1,3 +1,8 @@ +html { + width: 100%; + height: 100%; + margin: 0; +} body { font-size: 16px; } @@ -43,8 +48,9 @@ body { .country-flag { flex-shrink: 0; - width: 450px; + width: 600px; max-width: 450px; + height: 300px; max-height: 350px; box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08); overflow: hidden; @@ -65,10 +71,6 @@ body { object-fit: cover; } -.country-info { - padding: 40px 0; -} - .country-info h1 { color: #111517; margin-bottom: 30px; @@ -133,3 +135,34 @@ body { gap: 8px; flex-wrap: wrap; } + +.mainCountryFlag { + width: 50%; + height: 70%; +} + + +.country-container , .main{ + display: flex; + justify-content: center; + align-items: center; + height: 80%; +} +.country-info { + padding: 40px 0; + padding-left: 10%; + width: 300px; +} +.country-name { + font-weight: bold; + font-size: 5vh; +} +.country-name, .country-region, .country-capital, .country-population { + padding-top: 20px; +} + +.dark-country-info { + padding: 40px 0; + padding-left: 10%; + width: 300px; +} \ No newline at end of file diff --git a/css/main.css b/css/main.css index f51ac8b..5384e27 100644 --- a/css/main.css +++ b/css/main.css @@ -1,10 +1,10 @@ .filters { - margin: 40px 0 50px 0; + padding: 40px 0 50px 0; } @media (min-width: 40em) { .filters { - margin: 50px 0 60px 0; + padding: 50px 0 60px 0; } } @@ -109,7 +109,6 @@ cursor: pointer; z-index: 2; } - .filters .dropdown-header .icon { font-size: 13px; transition: transform 0.2s linear; @@ -212,14 +211,32 @@ .countries-grid .country-info { position: relative; padding: 30px 25px; + background-color: white; + box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08); +} +.dark-country-info { + background-color: #2b3945; + color: white; + padding: 30px 25px; +} + + +.countries-grid { + margin-bottom: 20px; } -.countries-grid .country-title { +.country-title { margin-bottom: 20px; + background-color: white; +} +.dark-country-title { + margin-bottom: 20px; + background-color: #2b3945; } -.countries-grid .country-brief li { +.countries-grid .country-brief li{ font-size: 16px; text-transform: capitalize; margin-bottom: 15px; } + diff --git a/details.html b/details.html index b584581..bc16bfb 100644 --- a/details.html +++ b/details.html @@ -1,80 +1,70 @@ - - - - - - - - - - - - - - - - - Details Page - - - -
-
- + + + + + + + + + + + + + + + + + + Details Page + + + + + + +
+
+ + +
+
+ +
+ - - - -
-
- +
+
+
+
+
+
+
+
+
- -
-
- -
- +
-
-
-
-
-
- - - - + + + + + + + \ No newline at end of file diff --git a/details.js b/details.js new file mode 100644 index 0000000..7939568 --- /dev/null +++ b/details.js @@ -0,0 +1,18 @@ +const getDetailsOfCountry = () => { + document.addEventListener("DOMContentLoaded", () => { + const countryDetails = JSON.parse(localStorage.getItem("countryDetails")); + + if (countryDetails) { + console.log("Country Details on details.html:", countryDetails); + document.querySelector(".main-country-flag").innerHTML = `${countryDetails.name} flag`; + document.querySelector(".country-name").innerHTML = `${countryDetails.name}`; + document.querySelector(".country-population").innerHTML = `Population: ${countryDetails.population}`; + document.querySelector(".country-region").innerHTML = `Region: ${countryDetails.region}`; + document.querySelector(".country-capital").innerHTML = `Capital: ${countryDetails.capital}`; + } else { + console.error("No country details found in localStorage."); + } + }); + +} +getDetailsOfCountry() diff --git a/index.html b/index.html index f4afbf5..01083fd 100644 --- a/index.html +++ b/index.html @@ -1,70 +1,55 @@ - - - - - - - - - - - - - - - - - Countries Info - - - - - -
-
- - -
-
- + + + + + + + + + + + + + + + + + Countries Info + + + + + + +
+
+ + +
+
+ +
- +