-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTestCar.tsx
237 lines (223 loc) · 7.07 KB
/
TestCar.tsx
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
"use client";
import { Pagination } from "swiper/modules";
import Image from "next/image";
import {
ArrowBackIos,
ArrowForwardIos,
NavigateNext,
} from "@mui/icons-material";
import { secondSectionBubble } from "../assets";
import { Swiper, SwiperSlide, useSwiper } from "swiper/react";
import ContentCards from "../hoc/ContentCards";
import "swiper/css";
import "swiper/css/pagination";
import "swiper/css/free-mode";
import { useMediaQuery } from "@mui/material";
import { ServiceData } from "../constants";
import { styles } from "../style";
import { Button } from "@material-tailwind/react";
import { motion, useInView, useAnimation } from "framer-motion";
import { useEffect, useRef } from "react";
const SwiperNavButtons = () => {
const swiper = useSwiper();
return (
<div className="text-center mt-14">
<div className="flex justify-center">
<Button
className=" rounded-full w-14 h-14 flex items-center justify-center m-3 z-30"
onClick={() => swiper.slidePrev()}
>
<ArrowBackIos className="text-white text-[1.8rem] z-30" />
</Button>
<Button
className=" rounded-full w-14 h-14 flex items-center justify-center m-3 z-30"
onClick={() => {
console.log(swiper);
swiper.slideNext();
}}
>
<ArrowForwardIos className="text-white text-[1.8rem] z-30" />
</Button>
</div>
</div>
);
};
const TestCar = () => {
const smallScreenSize = useMediaQuery("(min-width:1260px)");
const swiperSlidesPerView = smallScreenSize ? 2 : "auto";
const headerScrollRef = useRef(null);
const cardsSwiperScrollRef = useRef(null);
const bottomScrollRef = useRef(null);
const isHeaderInView = useInView(headerScrollRef);
const isCardsSwiperInView = useInView(cardsSwiperScrollRef);
const isBottomInView = useInView(bottomScrollRef);
const mainControls = useAnimation();
const secondaryControls = useAnimation();
const tertiaryControls = useAnimation();
useEffect(() => {
isHeaderInView
? mainControls.start("visible")
: mainControls.start("hidden");
isCardsSwiperInView
? secondaryControls.start("visible")
: secondaryControls.start("hidden");
isBottomInView
? tertiaryControls.start("visible")
: tertiaryControls.start("hidden");
}, [
isHeaderInView,
isCardsSwiperInView,
isBottomInView,
mainControls,
secondaryControls,
tertiaryControls,
]);
return (
<section
className={`${styles.paddingX} px-4 py-16 mx-auto sm:max-w-xl md:max-w-full lg:w-full md:px-24 lg:px-8 lg:py-20 space-y-16 bg-black`}
>
<motion.div
ref={headerScrollRef}
viewport={{ root: headerScrollRef }}
variants={{
hidden: {
opacity: 0,
y: 75,
transition: {
type: "spring",
duration: 1.25,
},
},
visible: {
opacity: 1,
y: 0,
transition: {
type: "spring",
duration: 1.25,
},
},
}}
initial="hidden"
animate={mainControls}
className="flex flex-wrap items-center justify-between"
>
<div className="w-full py-20 md:mx-auto sm:mx-auto max-w-4xl">
<h2
className={`${styles.sectionHeadText} lg:text-[64px] md:text-[60px] sm:text-[50px] xs:text-[40px] tracking-tight text-[#f5f5f7] sm:text-6xl ml-0`}
>
The fastest way to develop effective software.
</h2>
<p
className={`${styles.sectionSubText} mt-6 text-xl leading-8 text-[#86868b] lg:w-[44%] sm:w-full`}
>
ReacType is an innovative prototyping tool that empowers users to
dynamically visualize their application architecture. With its
intuitive drag-and-drop canvas interface and interactive, real-time
component code preview, ReacType facilitates seamless collaboration
and connection with peers.
</p>
</div>
{smallScreenSize ? (
<Image
src={secondSectionBubble}
alt="cube"
className="w-[25rem] mr-auto sm:display-none"
/>
) : null}
</motion.div>
<div
ref={cardsSwiperScrollRef}
className="flex items-center justify-center flex-col h-[700px] bg-black [mask-image:linear-gradient(to_right,transparent,white_20%,white_80%,transparent)]"
>
<motion.div
viewport={{ root: cardsSwiperScrollRef }}
variants={{
hidden: {
opacity: 0,
y: 75,
transition: {
type: "spring",
duration: 4.75,
},
},
visible: {
opacity: 1,
y: 0,
transition: {
type: "spring",
duration: 1.75,
},
},
}}
initial="hidden"
animate={secondaryControls}
className="swiper-section-container"
>
<div>
<Swiper
slidesPerView={swiperSlidesPerView}
spaceBetween={30}
centeredSlides={true}
modules={[Pagination]}
>
{ServiceData.map((data, index) => (
<SwiperSlide key={index} className="res-slide">
<ContentCards
index={index}
header={data.header}
content={data.content}
key={index}
/>
</SwiperSlide>
))}
<SwiperNavButtons />
</Swiper>
</div>
</motion.div>
</div>
<div ref={bottomScrollRef}>
<motion.div
viewport={{ root: bottomScrollRef }}
variants={{
hidden: {
opacity: 0,
y: 75,
transition: {
type: "spring",
duration: 1.75,
},
},
visible: {
opacity: 1,
y: 0,
transition: {
type: "spring",
duration: 1.75,
},
},
}}
initial="hidden"
animate={tertiaryControls}
>
<div className="flex flex-wrap items-center justify-between">
<div className="w-full lg:w-2/5 py-20 md:mx-auto sm:mx-auto max-w-3xl">
<h2 className="lg:text-[44px] tracking-tight text-[#86868b] sm:text-6xl">
Take a closer look.
</h2>
</div>
<div className="mr-auto">
<a
href="http://reactype.us-east-1.elasticbeanstalk.com/#/login"
className="text-[#2997ff] text-[19px] hover:underline"
>
Try Here{" "}
<NavigateNext sx={{ color: "#2997ff", fontSize: "25px" }} />
</a>
</div>
</div>
</motion.div>
</div>
</section>
);
};
export default TestCar;