|
|
@@ -18,46 +18,94 @@ import { Carousel } from 'react-responsive-carousel';
|
|
18
|
18
|
|
|
19
|
19
|
const CarouselContainer = () => {
|
|
20
|
20
|
|
|
21
|
|
- const items = [
|
|
22
|
|
- { img_src: mainImage13, alt_name: "Image 13" },
|
|
23
|
|
- { img_src: mainImage11, alt_name: "Image 11" },
|
|
24
|
|
- { img_src: mainImage10, alt_name: "Image 10" },
|
|
25
|
|
- { img_src: mainImage8, alt_name: "Image 8" },
|
|
26
|
|
- { img_src: mainImage6, alt_name: "Image 6" },
|
|
27
|
|
- { img_src: mainImage5, alt_name: "Image 5" },
|
|
28
|
|
- { img_src: mainImage3, alt_name: "Image 3" },
|
|
29
|
|
- { img_src: mainImage4, alt_name: "Image 4" },
|
|
30
|
|
- { img_src: mainImage2, alt_name: "Image 2" },
|
|
31
|
|
- { img_src: mainImage1, alt_name: "Image 1" },
|
|
32
|
|
-
|
|
33
|
|
- { img_src: mainImage13, alt_name: "Image 13" },
|
|
34
|
|
- { img_src: mainImage11, alt_name: "Image 11" },
|
|
35
|
|
- { img_src: mainImage10, alt_name: "Image 10" },
|
|
36
|
|
- { img_src: mainImage8, alt_name: "Image 8" },
|
|
37
|
|
- { img_src: mainImage6, alt_name: "Image 6" },
|
|
38
|
|
- { img_src: mainImage5, alt_name: "Image 5" },
|
|
39
|
|
- { img_src: mainImage3, alt_name: "Image 3" },
|
|
40
|
|
- { img_src: mainImage4, alt_name: "Image 4" },
|
|
41
|
|
- { img_src: mainImage2, alt_name: "Image 2" },
|
|
42
|
|
- { img_src: mainImage1, alt_name: "Image 1" },
|
|
|
21
|
+ const baseItems = [
|
|
|
22
|
+ // Banner click targets. Update productType/title/titles here when changing banner destinations.
|
|
|
23
|
+ { img_src: mainImage13, alt_name: "Eid's Time For Love", productType: "Apparel", title: "Eid's Time For Love", titles: ["EID'S TIME FOR LOVE"] },
|
|
|
24
|
+ { img_src: mainImage11, alt_name: "ND X Marii for Amber", productType: "Apparel", title: "ND X Marii for Amber", titles: ["ND X MARII FOR AMBER"] },
|
|
|
25
|
+ { img_src: mainImage10, alt_name: "Oasis Abaya", productType: "Apparel", title: "Oasis abaya", titles: ["OASIS ABAYA COLLECTION", "MIRAGE COLLECTION"] },
|
|
|
26
|
+ { img_src: mainImage8, alt_name: "Somewhere Somehow Someone", productType: "Apparel", title: "Somewhere Somehow Someone", titles: ["SOMEWHERE SOMEHOW SOMEONE"] },
|
|
|
27
|
+ { img_src: mainImage6, alt_name: "Oasis Abaya Collection", productType: "Apparel", title: "Oasis abaya", titles: ["OASIS ABAYA COLLECTION", "MIRAGE COLLECTION"] },
|
|
|
28
|
+ { img_src: mainImage5, alt_name: "Raya Romantics", productType: "Apparel", title: "Raya Romantics", titles: ["RAYA ROMANTICS COLLECTION 2025"] },
|
|
|
29
|
+ // { img_src: mainImage3, alt_name: "Amber Home", productType: "HOME" },
|
|
|
30
|
+ { img_src: mainImage3, alt_name: "Amber Home", clickable: false },
|
|
|
31
|
+ // { img_src: mainImage4, alt_name: "Amber Beauty Fragrance", productType: "BEAUTY", title: "Fragrances", titles: ["FRAGRANCES"] },
|
|
|
32
|
+ { img_src: mainImage4, alt_name: "Amber Beauty Fragrance", clickable: false },
|
|
|
33
|
+ { img_src: mainImage2, alt_name: "Amber Beauty Cosmetics", productType: "BEAUTY", title: "Cosmetics", titles: ["COSMETICS"] },
|
|
|
34
|
+ { img_src: mainImage1, alt_name: "Amber Apparel", clickable: false },
|
|
43
|
35
|
];
|
|
44
|
36
|
|
|
|
37
|
+ const items = [...baseItems, ...baseItems];
|
|
|
38
|
+
|
|
|
39
|
+ const navigateToBanner = ({ productType, title, titles, img_src }) => {
|
|
|
40
|
+ if (!productType) return;
|
|
|
41
|
+
|
|
|
42
|
+ sessionStorage.setItem("amber-select-product-type", productType);
|
|
|
43
|
+ sessionStorage.removeItem("amber-select-collection");
|
|
|
44
|
+ sessionStorage.removeItem("amber-select-collections");
|
|
|
45
|
+
|
|
|
46
|
+ if (titles?.length > 0) {
|
|
|
47
|
+ sessionStorage.setItem("amber-select-collection", JSON.stringify({
|
|
|
48
|
+ title,
|
|
|
49
|
+ image: {
|
|
|
50
|
+ url: img_src
|
|
|
51
|
+ }
|
|
|
52
|
+ }));
|
|
|
53
|
+ sessionStorage.setItem("amber-select-collections", JSON.stringify(titles));
|
|
|
54
|
+ }
|
|
|
55
|
+
|
|
|
56
|
+ window.location.href = "/products";
|
|
|
57
|
+ };
|
|
|
58
|
+
|
|
45
|
59
|
return (
|
|
46
|
60
|
|
|
47
|
61
|
<Carousel showStatus={false} autoPlay={true} infiniteLoop={true} interval={5000} showIndicators={false} stopOnHover={false}>
|
|
48
|
|
- {items?.map(({ img_src, alt_name }, index) => (
|
|
|
62
|
+ {items?.map((item, index) => (
|
|
49
|
63
|
<Box
|
|
50
|
64
|
key={index}
|
|
51
|
|
- component="img"
|
|
52
|
|
- src={img_src}
|
|
53
|
|
- alt={alt_name}
|
|
|
65
|
+ onClick={() => {
|
|
|
66
|
+ if (item.clickable !== false) navigateToBanner(item);
|
|
|
67
|
+ }}
|
|
|
68
|
+ onKeyDown={(event) => {
|
|
|
69
|
+ if (item.clickable !== false && event.key === "Enter") navigateToBanner(item);
|
|
|
70
|
+ }}
|
|
|
71
|
+ role={item.clickable === false ? undefined : "button"}
|
|
|
72
|
+ tabIndex={item.clickable === false ? undefined : 0}
|
|
54
|
73
|
sx={{
|
|
55
|
74
|
width: "100%",
|
|
56
|
75
|
height: "100%",
|
|
57
|
|
- zIndex: 0,
|
|
58
|
|
- filter:"brightness(0.9)"
|
|
|
76
|
+ cursor: item.clickable === false ? "default" : "pointer",
|
|
|
77
|
+ outline: "none"
|
|
59
|
78
|
}}
|
|
60
|
|
- />
|
|
|
79
|
+ >
|
|
|
80
|
+ {/*
|
|
|
81
|
+ Old image-click code:
|
|
|
82
|
+ <Box
|
|
|
83
|
+ component="img"
|
|
|
84
|
+ src={item.img_src}
|
|
|
85
|
+ alt={item.alt_name}
|
|
|
86
|
+ onClick={() => navigateToBanner(item)}
|
|
|
87
|
+ sx={{
|
|
|
88
|
+ width: "100%",
|
|
|
89
|
+ height: "100%",
|
|
|
90
|
+ zIndex: 0,
|
|
|
91
|
+ filter: "brightness(0.9)",
|
|
|
92
|
+ cursor: item.clickable === false ? "default" : "pointer"
|
|
|
93
|
+ }}
|
|
|
94
|
+ />
|
|
|
95
|
+ */}
|
|
|
96
|
+ <Box
|
|
|
97
|
+ component="img"
|
|
|
98
|
+ src={item.img_src}
|
|
|
99
|
+ alt={item.alt_name}
|
|
|
100
|
+ sx={{
|
|
|
101
|
+ width: "100%",
|
|
|
102
|
+ height: "100%",
|
|
|
103
|
+ zIndex: 0,
|
|
|
104
|
+ filter: "brightness(0.9)",
|
|
|
105
|
+ pointerEvents: "none"
|
|
|
106
|
+ }}
|
|
|
107
|
+ />
|
|
|
108
|
+ </Box>
|
|
61
|
109
|
))}
|
|
62
|
110
|
</Carousel>
|
|
63
|
111
|
|