-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
96 lines (67 loc) · 2.88 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>REST Countries API</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.min.css"/>
<link rel="stylesheet" href="/styles/style.css"/>
<link rel="stylesheet" href="/styles/responsive.css">
</head>
<body>
<div id="app">
<div :class="[ darkMode ? 'dark-mode' : 'light-mode' ]">
<header>
<div class="container">
<h1>Where in the world?</h1>
<button class="btn-toggle-mode" id="toggle" @click="darkMode=!darkMode">
<i :class="[darkMode ? 'fas fa-moon' : 'far fa-moon']"></i>
Dark Mode
</button>
</div>
</header>
<section id="user-input">
<div class="container">
<div class="input-element input-element--search">
<i class="fas fa-search"></i>
<input id="search" class="input-element__text" type="text" placeholder="Search for a country..." v-model="nameFilter"/>
</div>
<div id="filter" @click="showFilter=!showFilter" class="input-element input-element--filter input-element__text">
Filter by Region
<i v-if="!showFilter" class="fas fa-chevron-right"></i>
<i v-else class="fas fa-chevron-down"></i>
<ul v-show="showFilter">
<li><a data-filter="all" @click="aplicateFilter('')">All</a></li>
<li><a data-filter="Africa" @click="aplicateFilter('Africa')">Africa</a></li>
<li><a data-filter="Americas" @click="aplicateFilter('Americas')">Americas</a></li>
<li><a data-filter="Asia" @click="aplicateFilter('Asia')">Asia</a></li>
<li><a data-filter="Europe" @click="aplicateFilter('Europe')">Europe</a></li>
<li><a data-filter="Oceania" @click="aplicateFilter('Oceania')">Oceania</a></li>
</ul>
</div>
</div>
</section>
<section id="countries">
<div class="countries-grid">
<div v-for="country in countries" v-show="showCountry(country)" class="card" :data-item='country.region' @click="newTab(country)">
<div class="card__photo">
<img :src="country.flag" :alt="country.name"/>
</div>
<div class="card__body">
<h3 class="card__title">{{ country.name }}</h3>
<div class="card__description">
<p><strong>Population:</strong> {{ new Intl.NumberFormat("en-US").format(country.population) }}</p>
<p><strong>Region:</strong> {{ country.region }}</p>
<p><strong>Capital:</strong> {{ country.capital }}</p>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script type="module" src="/scripts/app.js"></script>
</body>
</html>