-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeWomensSection.js
113 lines (104 loc) · 2.83 KB
/
HomeWomensSection.js
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
import React from "react"
import { StaticImage } from "gatsby-plugin-image"
import useWindowDimensions from "./hooks/useWindowDimensions"
import VerticalCarousel from "./VerticalCarousel"
const HomeWomensSection = () => {
const windowDimensions = useWindowDimensions()
const mobileImage = "../departments/images/home-womens-mobile.jpg"
const mobileLandscapeImage =
"../departments/images/home-womens-mobile-landscape-image.png"
const desktopImageA = "../departments/images/home-womens-slide01.png"
const desktopImageB = "../departments/images/home-womens-slide02.png"
const desktopImageC = "../departments/images/home-womens-slide03.png"
const slides = [
{
slideNumber: "Slide #1",
content: () => (
<StaticImage
className="desktopStaticImage"
src={desktopImageA}
alt="Collage of woman posing"
placeholder="blurred"
objectFit="contain"
objectPosition={"50% 50%"}
/>
),
},
{
slideNumber: "Slide #2",
content: () => (
<StaticImage
className="desktopStaticImage"
src={desktopImageB}
alt="Collage of woman posing"
placeholder="blurred"
objectFit="contain"
objectPosition={"50% 50%"}
/>
),
},
{
slideNumber: "Slide #3",
content: () => (
<StaticImage
className="desktopStaticImage"
src={desktopImageC}
alt="Collage of woman posing"
placeholder="blurred"
objectFit="contain"
objectPosition={"50% 50%"}
/>
),
},
]
const renderedDesktopContent = (
<>
<VerticalCarousel allSlides={slides} />
</>
)
const renderedMobileImage = (
<>
<StaticImage
className="mobileStaticImage"
src={mobileImage}
alt="woman posing"
placeholder="blurred"
objectFit="cover"
objectPosition={"top"}
/>
</>
)
const renderedMobileLandscapeImage = (
<StaticImage
className="mobileStaticImage"
src={mobileLandscapeImage}
alt="woman posing"
placeholder="blurred"
layout="fullWidth"
/>
)
const showMobileImage = () => {
return windowDimensions.width < windowDimensions.height
? renderedMobileImage
: renderedMobileLandscapeImage
}
return (
<div className="homeWomensSection">
{windowDimensions.width < 800 ? (
<>{showMobileImage()}</>
) : (
<div className="desktopStaticImageWrapper">
<StaticImage
className="desktopStaticImage"
src={desktopImageA}
alt="Collage of woman posing"
placeholder="blurred"
objectFit="contain"
objectPosition={"50% 50%"}
/>
</div>
)}
</div>
)
}
export default HomeWomensSection