-
Notifications
You must be signed in to change notification settings - Fork 0
/
grocery.html
500 lines (449 loc) · 18.8 KB
/
grocery.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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"
/>
<link rel="stylesheet" href="css/main.css">
</head>
<body class="theme--green retailer">
<custom-navbar
logo-src="https://object-storage.shipt.com/web/assets/headerLogo-new.svg?fio=true&auto=webp&format=pjpg&quality=75%2C75&width=256"
logo-alt="Shipt"
location="201 3rd St 94132"
store-logo-src="https://object-storage.shipt.com/stores/27-061819185725_4aa474376b672e5e20d95db190d54ca5.png?fio=true&auto=webp&format=pjpg&quality=75%2C75&width=64"
store-logo-alt="Target"
store-text="Target"
cart-count="21"
></custom-navbar>
<!-- HEADER IMAGE -->
<div class="container">
<img src="assets/grocery-header.png" alt="" class="slim-header" />
</div>
<!-- TITLE -->
<div class="container greetings">
<h1 class="typography headline xl">Grocery</h1>
</div>
<!-- PLACEHOLDER -->
<custom-carousel
headline="Produce"
subheadline="Description"
data-source="data/produce.json"
component-type="product-card"
>
</custom-carousel>
<!-- CPG -->
<section>
<div class="container">
<div class="swiper wb-swiper-4">
<section-header alt="Target">
<span slot="headline">Deals</span>
<button class="icon-button wb-prev-4 pagination" slot="prev-button">
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12.2852 4.38128C12.6269 4.72299 12.6269 5.27701 12.2852 5.61872L7.90394 10L12.2852 14.3813C12.6269 14.723 12.6269 15.277 12.2852 15.6187C11.9435 15.9604 11.3895 15.9604 11.0478 15.6187L6.04779 10.6187C5.70608 10.277 5.70608 9.72299 6.04779 9.38128L11.0478 4.38128C11.3895 4.03957 11.9435 4.03957 12.2852 4.38128Z"
fill="#302638"
/>
</svg>
</button>
<button class="icon-button wb-next-4 pagination" slot="next-button">
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M7.71478 4.38128C7.37307 4.72299 7.37307 5.27701 7.71478 5.61872L12.0961 10L7.71478 14.3813C7.37307 14.723 7.37307 15.277 7.71478 15.6187C8.05649 15.9604 8.61051 15.9604 8.95221 15.6187L13.9522 10.6187C14.2939 10.277 14.2939 9.72299 13.9522 9.38128L8.95221 4.38128C8.61051 4.03957 8.05649 4.03957 7.71478 4.38128Z"
fill="#302638"
/>
</svg>
</button>
</section-header>
<div class="swiper-wrapper">
<div class="swiper-slide">
<cpg-card image="assets/dogfood.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
<!-- Repeat browse-tile elements for more slides -->
<div class="swiper-slide">
<cpg-card image="assets/method.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
<div class="swiper-slide">
<cpg-card image="assets/dogfood.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
<div class="swiper-slide">
<cpg-card image="assets/method.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
<div class="swiper-slide">
<cpg-card image="assets/dogfood.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
<div class="swiper-slide">
<cpg-card image="assets/dogfood.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
<div class="swiper-slide">
<cpg-card image="assets/dogfood.png">
<span slot="headline"
>Quality ingredients your dog deserves</span
>
<span slot="description">Shop Blue Buffalo dog food</span>
<span slot="cta">Shop now</span>
</cpg-card>
</div>
</div>
</div>
</div>
</section>
<!-- PLACEHOLDER -->
<custom-carousel
headline="Pantry"
subheadline="Description"
data-source="data/pantry.json"
component-type="product-card"
>
</custom-carousel>
<!-- Image header and color bg -->
<section class="colorize-green has-background">
<div class="container">
<div class="swiper wb-swiper-5">
<section-header alt="Target" ">
<!-- <span slot="subheadline"
>All the ingredients to create a soothing smoothie on this hot,
hot, hot day.</span
> -->
<button class="icon-button wb-prev-5 pagination" slot="prev-button">
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12.2852 4.38128C12.6269 4.72299 12.6269 5.27701 12.2852 5.61872L7.90394 10L12.2852 14.3813C12.6269 14.723 12.6269 15.277 12.2852 15.6187C11.9435 15.9604 11.3895 15.9604 11.0478 15.6187L6.04779 10.6187C5.70608 10.277 5.70608 9.72299 6.04779 9.38128L11.0478 4.38128C11.3895 4.03957 11.9435 4.03957 12.2852 4.38128Z"
fill="#302638"
/>
</svg>
</button>
<button class="icon-button wb-next-5 pagination" slot="next-button">
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M7.71478 4.38128C7.37307 4.72299 7.37307 5.27701 7.71478 5.61872L12.0961 10L7.71478 14.3813C7.37307 14.723 7.37307 15.277 7.71478 15.6187C8.05649 15.9604 8.61051 15.9604 8.95221 15.6187L13.9522 10.6187C14.2939 10.277 14.2939 9.72299 13.9522 9.38128L8.95221 4.38128C8.61051 4.03957 8.05649 4.03957 7.71478 4.38128Z"
fill="#302638"
/>
</svg>
</button>
</section-header>
<div class="swiper-wrapper multiwidth">
<!-- Repeat browse-tile elements for more slides -->
<!-- <div class="swiper-slide span-two-columns">
<div
class="box merch-card"
style="
height: 100%;
background-color: transparent;
background-image: url(assets/kitty-merch-card.png);
"
>
</div>
</div> -->
<div class="swiper-slide">
<product-card
image="https://target.scene7.com/is/image/Target/GUEST_880b1aeb-6e9f-42b4-8e37-348e54813aca?wid=1200&hei=1200&qlt=80&fmt=webp"
>
<span slot="productMessaging">Buy again</span>
<span slot="productName">Quirky Jiggling Jellyfish Wand</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.79</span>
<span slot="priceOriginal">$6.99</span>
<span slot="productPricePercentOff">20% off</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card
image="https://target.scene7.com/is/image/Target/GUEST_fc448a19-5168-49de-831b-ad9525d7872f?qlt=65&fmt=webp&hei=350&wid=350"
>
<span slot="productName"
>Quirky Kitty hard Seltzpurr Cat Toy - 2pk</span
>
<span slot="line2">1 ct</span>
<span slot="price">$3.81</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card
image="https://target.scene7.com/is/image/Target/GUEST_d9734ee3-3f14-4a3e-8597-ff80584f432d?wid=1200&hei=1200&qlt=80&fmt=webp"
>
<span slot="productName"
>Unique Bargains Square Paper Bag with Handle Bouquet
Packaging Gift Bag for Party Favor Brown 8''x8''x8'' 10
Pcs</span
>
<span slot="line2">10 ct</span>
<span slot="price">$33.69</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card
image="https://target.scene7.com/is/image/Target/GUEST_e158be89-857e-40c2-a160-51a269d2223b?qlt=65&fmt=webp&hei=350&wid=350"
>
<span slot="productName"
>Checkered Sofa Cat Scratcher - 17.7" - Boots & Barkley™</span
>
<span slot="line2">1 ct</span>
<span slot="price">$8.99</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card image="assets/placeholder-product.png">
<span slot="productName">Product Name</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.99</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card image="assets/placeholder-product.png">
<span slot="productName">Product Name</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.99</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card image="assets/placeholder-product.png">
<span slot="productName">Product Name</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.99</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card image="assets/placeholder-product.png">
<span slot="productName">Product Name</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.99</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card image="assets/placeholder-product.png">
<span slot="productName">Product Name</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.99</span>
</product-card>
</div>
<div class="swiper-slide">
<product-card image="assets/placeholder-product.png">
<span slot="productName">Product Name</span>
<span slot="line2">1 ct</span>
<span slot="price">$5.99</span>
</product-card>
</div>
</div>
</div>
</div>
</section>
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2/webcomponents-bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script src="Components/browseTile.js"></script>
<script src="Components/productCard.js"></script>
<script src="Components/sectionHeader.js"></script>
<script src="Components/navbar.js"></script>
<script src="Components/cpgCard.js"></script>
<script src="Components/carousel.js"></script>
<script>
// browse tiles
document.addEventListener("DOMContentLoaded", function () {
var swiper = new Swiper(".wb-swiper-1", {
slidesPerView: 2.1,
freeMode: true,
spaceBetween: 8,
breakpoints: {
480: { slidesPerView: 3.25, slidesPerGroup: 3.25 },
768: { slidesPerView: 5.25, slidesPerGroup: 5.25 },
1280: { slidesPerView: 6, slidesPerGroup: 6 },
1440: { slidesPerView: 6, slidesPerGroup: 6 },
1880: { slidesPerView: 6, slidesPerGroup: 6 },
},
navigation: { nextEl: ".wb-next-1", prevEl: ".wb-prev-1" },
});
});
</script>
<script>
// Function to generate product card HTML
function generateProductCard(product) {
let productCardHTML = `<div class="swiper-slide"><product-card`;
// Check and add the image attribute if it exists
if (product.productImage) {
productCardHTML += ` image="${product.productImage}"`;
}
productCardHTML += `>`;
if (product.productMessaging) {
productCardHTML += `<span slot="productMessaging">${product.productMessaging}</span>`;
}
if (product.productName) {
productCardHTML += `<span slot="productName">${product.productName}</span>`;
}
if (product.productSize) {
productCardHTML += `<span slot="line2">${product.productSize}</span>`;
}
if (product.productPrice) {
productCardHTML += `<span slot="price">${product.productPrice}</span>`;
}
if (product.productPriceOriginal) {
productCardHTML += `<span slot="priceOriginal">${product.productPriceOriginal}</span>`;
}
if (product.productPricePercentOff) {
productCardHTML += `<span slot="productPricePercentOff">${product.productPricePercentOff}</span>`;
}
productCardHTML += `</product-card></div>`;
return productCardHTML;
}
// Fetch the JSON file and generate the carousel
fetch("data/pets.json")
.then((response) => response.json())
.then((products) => {
const productCarousel = document.getElementById("Pets");
products.forEach((product) => {
productCarousel.innerHTML += generateProductCard(product);
});
// Initialize Swiper after loading products
const swiper = new Swiper(".wb-swiper-2", {
slidesPerView: 2.1,
spaceBetween: 8,
navigation: {
nextEl: ".wb-next-2",
prevEl: ".wb-prev-2",
},
breakpoints: {
480: { slidesPerView: 3.25, slidesPerGroup: 3 },
768: { slidesPerView: 4, slidesPerGroup: 5 },
1280: { slidesPerView: 6, slidesPerGroup: 6 },
1440: { slidesPerView: 7, slidesPerGroup: 7 },
1880: { slidesPerView: 8, slidesPerGroup: 8 },
},
});
})
.catch((error) => console.error("Error fetching product data:", error));
</script>
<script>
// CPG Card
document.addEventListener("DOMContentLoaded", function () {
var swiper = new Swiper(".wb-swiper-4", {
slidesPerView: 1.1,
freeMode: true,
spaceBetween: 8,
breakpoints: {
480: { slidesPerView: 1.1, slidesPerGroup: 1.5 },
768: { slidesPerView: 2.25, slidesPerGroup: 2.25 },
1280: { slidesPerView: 3, slidesPerGroup: 3 },
1440: { slidesPerView: 4, slidesPerGroup: 4 },
1880: { slidesPerView: 4, slidesPerGroup: 4 },
},
navigation: { nextEl: ".wb-next-4", prevEl: ".wb-prev-4" },
});
});
// COL SPAN
document.addEventListener("DOMContentLoaded", function () {
var swiper = new Swiper(".wb-swiper-5", {
slidesPerView: 2.01,
spaceBetween: 8,
freeMode: true,
breakpoints: {
480: { slidesPerView: 3, slidesPerGroup: 3 },
768: { slidesPerView: 4, slidesPerGroup: 5 },
1280: { slidesPerView: 5, slidesPerGroup: 6 },
1440: { slidesPerView: 7, slidesPerGroup: 7 },
1880: { slidesPerView: 8, slidesPerGroup: 8 },
},
navigation: { nextEl: ".wb-next-5", prevEl: ".wb-prev-5" },
// Enables a slide to span columns
on: {
init: function () {
applyCustomWidths(this);
},
resize: function () {
applyCustomWidths(this);
},
},
});
// Enables a slide to span columns
function applyCustomWidths(swiperInstance) {
const breakpoint =
swiperInstance.activeBreakpoint || swiperInstance.currentBreakpoint;
const settings = swiperInstance.params.breakpoints[breakpoint];
swiperInstance.slides.forEach((slide) => {
if (slide.classList.contains("span-two-columns")) {
slide.style.width = `calc((100% / ${settings.slidesPerView}) * 2 - ${swiperInstance.params.spaceBetween}px)`;
}
});
}
});
</script>
<script>
// Parallax for retailer banner
window.addEventListener("scroll", function () {
const scrollPosition = window.pageYOffset;
const parallaxImage = document.querySelector(".parallax-image");
parallaxImage.style.transform = `translate(-50%, calc(-50% + ${
scrollPosition * 0.5
}px))`;
});
</script>
</body>
</html>