-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cd3d150
Showing
3 changed files
with
144 additions
and
0 deletions.
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,25 @@ | ||
const countryContainer = document.querySelector('.countries-container') | ||
|
||
|
||
fetch('https://restcountries.com/v3.1/all').then((res) => res.json()) | ||
.then((data) => { | ||
data.forEach((country) => { | ||
console.log(country) | ||
const countryCard = document.createElement('div') | ||
countryCard.classList.add('country-card') | ||
const cardHTML = ` | ||
<img src="${country.flags.svg}" alt="flag"> | ||
<div class="card-text"> | ||
<h3>${country.name.common}</h3> | ||
<p><b>Population: </b>${country.population}</p> | ||
<p><b>Region: </b>${country.region}</p> | ||
<p><b>Capital: </b>${country.capital}</p> | ||
<p><b>Language: </b>${country.languages}</p> | ||
</div> | ||
` | ||
countryCard.innerHTML = cardHTML | ||
countryContainer.appendChild(countryCard) | ||
}) | ||
}) | ||
|
||
|
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,46 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Rest Country</title> | ||
<link href="https://fonts.googleapis.com/css?family=Nunito:200,300,regular,500,600,700,800,900,200" | ||
rel="stylesheet" /> | ||
<link rel="stylesheet" href="style.css"> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" | ||
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg==" | ||
crossorigin="anonymous" referrerpolicy="no-referrer" /> | ||
</head> | ||
|
||
<body> | ||
|
||
<header class="header"> | ||
<h2 class="title">Where in the world?</h2> | ||
<p><i class="fa-regular fa-moon darkMode"></i>Dark Mode</p> | ||
</header> | ||
|
||
<main> | ||
<div class="countries-container"> | ||
|
||
<!-- <div class="country-card"> | ||
<img src="https://flagcdn.com/gs.svg" alt="flag"> | ||
<div class="card-text"> | ||
<h3>South Georgia</h3> | ||
<p><b>Population: </b>84.333</p> | ||
<p><b>Region: </b>Europe</p> | ||
<p><b>Capital: </b>Jamaika</p> | ||
<p><b>Borders: </b>UKR SUI GTH </p> | ||
</div> | ||
</div> --> | ||
|
||
|
||
|
||
</div> | ||
</main> | ||
|
||
|
||
<script src="app.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,73 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
font-family: Nunito, sans-serif; | ||
} | ||
|
||
.title { | ||
font-weight: 800; | ||
} | ||
|
||
.header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
max-width: 95%; | ||
margin-inline: auto; | ||
padding-inline: 24px; | ||
height: 60px; | ||
} | ||
|
||
.darkMode { | ||
margin-right: 10px; | ||
} | ||
|
||
main { | ||
padding: 24px; | ||
} | ||
|
||
.countries-container { | ||
max-width: 100%; | ||
margin-inline: auto; | ||
/* border: 1px solid black; */ | ||
display: flex; | ||
gap: 64px; | ||
flex-wrap: wrap; | ||
justify-content: space-evenly; | ||
|
||
|
||
} | ||
|
||
|
||
|
||
.country-card { | ||
width: 250px; | ||
height: 350px; | ||
border-radius: 4px; | ||
box-shadow: 0px 4px 4px 1px rgba(0, 0, 0, 0.1); | ||
/* transition: transform 0.2s ease-in-out; */ | ||
} | ||
|
||
|
||
.country-card :hover { | ||
/* transform: scale(1.05); */ | ||
} | ||
|
||
.country-card img { | ||
width: 100%; | ||
height: 150px; | ||
border-top-left-radius: 4px; | ||
border-top-right-radius: 4px; | ||
|
||
} | ||
|
||
.card-text { | ||
padding-inline: 16px; | ||
height: 200px; | ||
|
||
} | ||
|
||
.card-text h3 { | ||
margin-bottom: 10px; | ||
} |