-
Notifications
You must be signed in to change notification settings - Fork 350
/
paris.html
352 lines (319 loc) · 10.9 KB
/
paris.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Paris Travel - Hotels</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="./styles/popup.css">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Pattaya&family=Poppins:wght@400;500&display=swap"
rel="stylesheet"
/>
<script src="https://kit.fontawesome.com/c4254e24a8.js" crossorigin="anonymous"></script>
<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"
/>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
overflow-x: hidden;
}
.main-image {
width: 100%;
height: 300px;
object-fit: cover;
background-image: url('https://images.pexels.com/photos/1308940/pexels-photo-1308940.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2');
background-position: bottom;
}
.main-heading {
font-size: 48px;
color: white;
text-align: center;
height: 500px;
padding-top: 120px;
}
.top-container {
width: 100vw;
display: flex;
flex-direction: row;
justify-content: center;
}
.container {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
margin: auto;
width: 100vw;
}
.seach-container {
margin-right: 40px;
}
.sort-container {
margin-left: 40px;
}
.card-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 100vw;
height: 590px;
align-items: center;
margin: auto;
/*removing the Left-margin
margin-left: 100px;
*/
margin-bottom: 50px;
}
h1 {
color: #2c3e50;
margin-bottom: 30px;
font-size: 5em;
}
.hotel-card {
background-color: #ffffff;
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
margin: 15px 40px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
width: 450px;
height: 100%;
}
.hotel-image {
width: 100%;
max-height: 400px;
border-radius: 8px;
object-fit: cover;
height: 100%;
}
.hotel-card h2 {
color: #2980b9;
margin: 10px 0 10px;
font-size: 3rem;
}
.hotel-card p {
color: #7f8c8d;
font-size: 18px;
}
.book-button {
background-color: #2980b9;
color: white;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s;
}
.book-button:hover {
background-color: #1a6d99;
}
</style>
</head>
<body>
<div class="main-image">
<h1 class="main-heading">Paris</h1>
</div>
<br>
<br>
<h1>Top Hotels in Paris</h1>
<!-- Search Bar -->
<div class="top-container">
<div class="search-container">
<label for="search">Search for hotels:</label>
<input type="search" id="search" placeholder="Search for a hotel..." />
</div>
<div class="sort-container">
<label for="sort">Sort by Price:</label>
<select id="sort" name="sort">
<option value="featured">Featured</option>
<option value="low-to-high">Low to High</option>
<option value="high-to-low">High to Low</option>
</select>
</div>
</div>
<!-- Hotels -->
<div class="container">
<div class="card-container">
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/14430742/pexels-photo-14430742.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Hôtel Plaza Athénée"
class="hotel-image"
/>
<h2>Hôtel Plaza Athénée</h2>
<p>Price per night: ₹52,990</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/3225531/pexels-photo-3225531.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="La Réserve Hotel and Spa"
class="hotel-image"
/>
<h2>La Réserve Hotel and Spa</h2>
<p>Price per night: ₹48,990</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/13291092/pexels-photo-13291092.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Hôtel Le Bristol Paris"
class="hotel-image"
/>
<h2>Hôtel Le Bristol Paris</h2>
<p>Price per night: ₹55,990</p>
<button class="book-button">Book Now</button>
</div>
</div>
<div class="card-container">
<div class="hotel-card">
<img
src="https://static.prod.r53.tablethotels.com/media/hotels/slideshow_images_staged/large/1098698.jpg"
alt="Shangri-La Hotel Paris"
class="hotel-image"
/>
<h2>Shangri-La Hotel Paris</h2>
<p>Price per night: ₹43,990</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/5101781/pexels-photo-5101781.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Four Seasons Hotel"
class="hotel-image"
/>
<h2>Four Seasons Hotel</h2>
<p>Price per night: ₹66,990</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://ritz-paris.parishotelsweb.com/data/Photos/OriginalPhoto/7899/789986/789986976/ritz-hotel-paris-photo-48.JPEG"
alt="The Ritz Paris"
class="hotel-image"
/>
<h2>The Ritz Paris</h2>
<p>Price per night: ₹59,990</p>
<button class="book-button">Book Now</button>
</div>
</div>
<div class="card-container">
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/24238420/pexels-photo-24238420/free-photo-of-le-negresco-in-nice.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Barrière Le Fouquet's"
class="hotel-image"
/>
<h2>Barrière Le Fouquet's</h2>
<p>Price per night: ₹50,990</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://images.pexels.com/photos/9190645/pexels-photo-9190645.png?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2"
alt="Hôtel Scribe Paris"
class="hotel-image"
/>
<h2>Hôtel Scribe Paris</h2>
<p>Price per night: ₹45,990</p>
<button class="book-button">Book Now</button>
</div>
<div class="hotel-card">
<img
src="https://dq5r178u4t83b.cloudfront.net/wp-content/uploads/sites/62/2020/03/26092616/Le-Royal-Monceau-Raffles-Paris-Façade-%40Vincent-Leroux-Web-81-500x500.jpg"
alt="Hôtel Le Royal Monceau Raffles Paris"
class="hotel-image"
/>
<h2>Le Royal Monceau Raffles</h2>
<p>Price per night: ₹62,990</p>
<button class="book-button">Book Now</button>
</div>
</div>
</div>
<!-- Sorting Script -->
<script>
const hotelCards = document.querySelectorAll(".hotel-card");
const sortSelect = document.getElementById("sort");
const searchInput = document.getElementById("search");
// Function to filter hotel cards based on search input
function filterHotels() {
const searchTerm = searchInput.value.toLowerCase();
const matchedHotels = []; // Array to store matched hotel cards
hotelCards.forEach((hotelCard) => {
const hotelName = hotelCard
.querySelector("h2")
.textContent.toLowerCase();
if (hotelName.includes(searchTerm)) {
matchedHotels.push(hotelCard); // Add matching hotel card to the array
}
});
// Clear the card container
const cardContainer = document.querySelector(".card-container");
cardContainer.innerHTML = "";
// Append matched hotels to the card container in rows of three
matchedHotels.forEach((hotelCard) => {
cardContainer.appendChild(hotelCard);
});
}
// Add event listener to search input
searchInput.addEventListener("input", filterHotels);
sortSelect.addEventListener("change", () => {
const sortBy = sortSelect.value;
let sortedHotels;
if (sortBy === "featured") {
window.location.reload(true);
return false;
}
if (sortBy === "low-to-high") {
sortedHotels = [...hotelCards].sort((a, b) => {
const priceA = parseInt(
a
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
const priceB = parseInt(
b
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
return priceA - priceB;
});
} else if (sortBy === "high-to-low") {
sortedHotels = [...hotelCards].sort((a, b) => {
const priceA = parseInt(
a
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
const priceB = parseInt(
b
.querySelector("p")
.textContent.replace("Price per night: ₹", "")
);
return priceB - priceA;
});
}
const cardContainer = document.querySelector(".card-container");
cardContainer.innerHTML = "";
sortedHotels.forEach((hotelCard) => {
cardContainer.appendChild(hotelCard);
});
});
</script>
</body>
</html>