Skip to content

Commit 9fcbd1b

Browse files
authored
Merge pull request #912 from namandude/main
Added the swiper effect in the testimonials
2 parents 8f4dcfe + aa075f9 commit 9fcbd1b

File tree

4 files changed

+69
-92
lines changed

4 files changed

+69
-92
lines changed

package-lock.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"rehype-katex": "^7.0.0",
6060
"remark-math": "^6.0.0",
6161
"styled-components": "^6.1.8",
62+
"swiper": "^11.1.4",
6263
"vanilla-tilt": "^1.8.1"
6364
},
6465
"devDependencies": {

src/pages/index.module.css

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
.section {
3535
padding: 1rem;
3636
}
37+
3738
.tweetContainer {
3839
transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
3940
}

src/pages/index.tsx

+48-92
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import clsx from "clsx";
22
import React from "react";
3+
import style from "./index.module.css";
34
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
45
import Layout from "@theme/Layout";
56
import Heading from "@theme/Heading";
6-
import styles from "./index.module.css";
7-
// import Features from "../components/HomePage/Features";
8-
// import Courses from "../components/HomePage/Courses";
9-
// import { featuresData, coursesData } from "../database/home";
107
import Head from "@docusaurus/Head";
118
import Header from "../components/HomePage/Header";
129
import Tweet from "../components/Tweet";
13-
import Tweets, { type TweetItem } from "../data/tweets";
10+
import Tweets from "../data/tweets";
1411
import { motion } from "framer-motion";
1512
import ResourcesSection from "../components/HomePage/ResourcesSection";
1613
import ScrollTopToButton from "../components/Buttons/bottom/ScrollTopToButton";
1714
import ScrollBottomToTop from "../components/Buttons/top/ScrollBottomToTop";
15+
import 'swiper/css';
16+
import 'swiper/css/navigation';
17+
import 'swiper/css/pagination';
18+
import { Swiper, SwiperSlide } from 'swiper/react';
19+
import { Navigation, Pagination, Autoplay } from 'swiper/modules';
1820

1921
function TweetsSection() {
2022
const tweetColumns = [[], [], []];
@@ -23,7 +25,7 @@ function TweetsSection() {
2325
);
2426

2527
return (
26-
<div className={clsx(styles.section, styles.sectionAlt)}>
28+
<div className={clsx(style.section, style.sectionAlt)}>
2729
<div className="tweets-container">
2830
<motion.div
2931
initial={{ opacity: 0, x: -10 }}
@@ -35,35 +37,47 @@ function TweetsSection() {
3537
stiffness: 100,
3638
delay: 0.3,
3739
}}
38-
className={styles.home__divider}
40+
className={style.home__divider}
3941
>
4042
<Heading as="h2" className={clsx("text--center")}>
4143
Loved by many Users
4244
</Heading>
4345
</motion.div>
44-
<div className={clsx("row", styles.tweetsSection)}>
45-
{tweetColumns.map((tweetItems, i) => (
46-
<motion.div
47-
initial={{ opacity: 0, y: -10 }}
48-
whileInView={{ opacity: 1, y: 0 }}
49-
viewport={{ once: true }}
50-
transition={{
51-
duration: 1,
52-
type: "spring",
53-
stiffness: 100,
54-
delay: 0.3,
55-
}}
56-
className="col col--4"
57-
key={i}
58-
>
59-
{tweetItems.map((tweet) => (
60-
<div className={styles.tweetContainer} key = {tweet.url}>
61-
<Tweet {...tweet} key={tweet.url} />
46+
<Swiper
47+
slidesPerView={1}
48+
spaceBetween={30}
49+
autoplay={{ delay: 2000 }}
50+
loop={true}
51+
pagination={{ clickable: true }}
52+
breakpoints={{
53+
640: {
54+
slidesPerView: 2,
55+
spaceBetween: 20,
56+
},
57+
768: {
58+
slidesPerView: 3,
59+
spaceBetween: 40,
60+
},
61+
1024: {
62+
slidesPerView: 3,
63+
spaceBetween: 50,
64+
},
65+
}}
66+
modules={[Navigation, Pagination, Autoplay]}
67+
className={style.tweetsSwiper}
68+
>
69+
{tweetColumns.map((tweetItems, columnIndex) =>
70+
tweetItems.map((tweet, tweetIndex) => (
71+
<SwiperSlide key={`${columnIndex}-${tweetIndex}`}>
72+
<div className={clsx(style.tweetContainer)}>
73+
<div className={clsx(style.tweetContent)}>
74+
<Tweet {...tweet} />
75+
</div>
6276
</div>
63-
))}
64-
</motion.div>
65-
))}
66-
</div>
77+
</SwiperSlide>
78+
))
79+
)}
80+
</Swiper>
6781
</div>
6882
</div>
6983
);
@@ -81,7 +95,7 @@ export default function Home() {
8195
<script
8296
async
8397
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5832817025080991"
84-
crossorigin="anonymous"
98+
crossOrigin="anonymous"
8599
></script>
86100
<script
87101
async
@@ -90,70 +104,12 @@ export default function Home() {
90104
></script>
91105
<meta name="google-adsense-account" content="ca-pub-5832817025080991" />
92106
</Head>
93-
<main className={styles.main__home}>
94-
<div className={styles.home__header}>
107+
<main className={style.main__home}>
108+
<div className={style.home__header}>
95109
<Header />
96110
</div>
97111

98-
<hr className={styles.home__hr} />
99-
100-
{/* <motion.div
101-
initial={{ opacity: 0, x: -10 }}
102-
whileInView={{ opacity: 1, x: 0 }}
103-
viewport={{ once: true }}
104-
transition={{
105-
duration: 1,
106-
type: "spring",
107-
stiffness: 100,
108-
delay: 0.3,
109-
}}
110-
className={styles.home__divider}
111-
>
112-
<Heading as="h2">Courses Available</Heading>
113-
</motion.div>
114-
115-
<motion.div
116-
initial={{ opacity: 0, y: -10 }}
117-
whileInView={{ opacity: 1, y: 0 }}
118-
viewport={{ once: true }}
119-
transition={{
120-
duration: 1,
121-
type: "spring",
122-
stiffness: 100,
123-
delay: 0.3,
124-
}}
125-
>
126-
<Courses courses={coursesData} />
127-
</motion.div>
128-
129-
<motion.div
130-
initial={{ opacity: 0, x: -10 }}
131-
whileInView={{ opacity: 1, x: 0 }}
132-
viewport={{ once: true }}
133-
transition={{
134-
duration: 1,
135-
type: "spring",
136-
stiffness: 100,
137-
delay: 0.3,
138-
}}
139-
className={styles.home__divider}
140-
>
141-
<Heading as="h2">Features of {siteConfig.title}</Heading>
142-
</motion.div>
143-
144-
<motion.div
145-
initial={{ opacity: 0, y: -10 }}
146-
whileInView={{ opacity: 1, y: 0 }}
147-
viewport={{ once: true }}
148-
transition={{
149-
duration: 1,
150-
type: "spring",
151-
stiffness: 100,
152-
delay: 0.3,
153-
}}
154-
>
155-
<Features features={featuresData} />
156-
</motion.div> */}
112+
<hr className={style.home__hr} />
157113

158114
<div>
159115
<ResourcesSection />
@@ -162,7 +118,7 @@ export default function Home() {
162118
<TweetsSection />
163119

164120
<ScrollTopToButton />
165-
<ScrollBottomToTop />
121+
<ScrollBottomToTop />
166122
</main>
167123
</Layout>
168124
);

0 commit comments

Comments
 (0)