4
4
import { TestimonialData } from "../constants/testimonialsdata" ;
5
5
import { Sponsordata } from "../constants/sponsordata" ;
6
6
import Link from "next/link" ;
7
- import { Autoplay } from "swiper" ;
7
+ import SwiperCore , { Autoplay , Navigation } from "swiper" ;
8
8
import { Swiper , SwiperSlide } from "swiper/react" ;
9
9
import "swiper/css" ;
10
+ import "swiper/swiper-bundle.css" ;
10
11
11
- interface sliderProps {
12
+ SwiperCore . use ( [ Autoplay , Navigation ] ) ;
13
+
14
+ interface SliderProps {
12
15
isTestimonial : boolean ;
13
16
}
14
17
15
- export default function Slider ( props : sliderProps ) {
18
+ export default function Slider ( props : SliderProps ) {
16
19
const { isTestimonial } = props ;
17
20
18
21
return (
19
22
< >
20
23
{ isTestimonial ? (
21
- < div id = "testimonials-element" className = "w-[100%]" >
24
+ < div id = "testimonials-element" className = "w-[100%] relative " >
22
25
< div className = "mx-auto max-w-screen-xl py-16 sm:px-6 lg:px-8" >
23
26
< Swiper
24
27
spaceBetween = { 25 }
@@ -40,49 +43,48 @@ export default function Slider(props: sliderProps) {
40
43
delay : 4000 ,
41
44
disableOnInteraction : false ,
42
45
} }
43
- modules = { [ Autoplay ] }
46
+ navigation = { {
47
+ prevEl : ".swiper-button-prev" ,
48
+ nextEl : ".swiper-button-next" ,
49
+ } }
44
50
className = "h-full"
45
51
>
46
- { TestimonialData . map ( ( testimonial , index ) => {
47
- return (
48
- < div key = { index } className = "swiper-slide h-full bg-white" >
49
- < SwiperSlide className = "bg-[#16161D] md:!h-[30rem] lg:!h-[30rem] p-8 xl:p-8 rounded-xl mx-2 border-solid border border-[#39393F]" >
50
- < div className = "h-full w-full flex flex-col justify-between" >
51
- < p className = "relative mt-4 text-gray-500" >
52
- < span className = "text-xl" > “</ span >
53
- { testimonial . review . length <= 300
54
- ? testimonial . review
55
- : testimonial . review . slice ( 0 , 300 ) + "..." }
56
- < span className = "text-xl" > ”</ span >
57
- </ p >
58
- < div className = "flex flex-row gap-4 text-left items-start" >
59
- < figcaption className = "flex justify-center items-center space-x-3" >
60
- < img
61
- className = "w-12 h-12 rounded-full"
62
- src = "/images/favicon.png"
63
- alt = "profile picture"
64
- />
65
- < div className = "space-y-0.5 font-medium dark:text-white text-left" >
66
- < p className = "font-medium font-SpaceGrotesk opacity-90 text-white text-xl" >
67
- { testimonial . name }
68
- </ p >
69
- < p className = "font-medium font-SpaceGrotesk text-white opacity-70 text-md text-left" >
70
- { testimonial . designation }
71
- </ p >
72
- </ div >
73
- </ figcaption >
52
+ { TestimonialData . map ( ( testimonial , index ) => (
53
+ < SwiperSlide key = { index } className = "bg-[#16161D] md:!h-[30rem] lg:!h-[30rem] p-8 xl:p-8 rounded-xl mx-2 border-solid border border-[#39393F]" >
54
+ < div className = "h-full w-full flex flex-col justify-between" >
55
+ < p className = "relative mt-4 text-gray-500" >
56
+ < span className = "text-xl" > “</ span >
57
+ { testimonial . review . length <= 300 ? testimonial . review : testimonial . review . slice ( 0 , 300 ) + "..." }
58
+ < span className = "text-xl" > ”</ span >
59
+ </ p >
60
+ < div className = "flex flex-row gap-4 text-left items-start" >
61
+ < figcaption className = "flex justify-center items-center space-x-3" >
62
+ < img
63
+ className = "w-12 h-12 rounded-full"
64
+ src = "/images/favicon.png"
65
+ alt = "profile picture"
66
+ />
67
+ < div className = "space-y-0.5 font-medium dark:text-white text-left" >
68
+ < p className = "font-medium font-SpaceGrotesk opacity-90 text-white text-xl" >
69
+ { testimonial . name }
70
+ </ p >
71
+ < p className = "font-medium font-SpaceGrotesk text-white opacity-70 text-md text-left" >
72
+ { testimonial . designation }
73
+ </ p >
74
74
</ div >
75
- </ div >
76
- </ SwiperSlide >
75
+ </ figcaption >
76
+ </ div >
77
77
</ div >
78
- ) ;
79
- } ) }
78
+ </ SwiperSlide >
79
+ ) ) }
80
80
</ Swiper >
81
+ < div className = "swiper-button-next" > </ div >
82
+ < div className = "swiper-button-prev" > </ div >
81
83
</ div >
82
84
</ div >
83
85
) : (
84
86
< div id = "sponsor-element" className = "w-[90%]" >
85
- < div className = "mx-auto max-w-screen-xl px-4 py-16 sm:px-6 lg:px-8" >
87
+ < div className = "mx-auto max-w-screen-xl px-4 py-16 sm:px-6 lg:px-8 relative " >
86
88
< Swiper
87
89
spaceBetween = { 25 }
88
90
breakpoints = { {
@@ -103,13 +105,20 @@ export default function Slider(props: sliderProps) {
103
105
delay : 4000 ,
104
106
disableOnInteraction : false ,
105
107
} }
106
- modules = { [ Autoplay ] }
108
+ navigation = { {
109
+ prevEl : ".swiper-button-prev" ,
110
+ nextEl : ".swiper-button-next" ,
111
+ } }
112
+ className = "h-full"
107
113
>
108
114
{ Sponsordata . map ( ( sponsor , index ) => {
109
115
return (
110
116
< div key = { index } className = "swiper-slide" >
117
+
111
118
< SwiperSlide className = "bg-[#16161D] md:!h-[35rem] p-8 xl:p-16 rounded-xl mx-2 border-solid border border-[#39393F]" >
119
+
112
120
< div className = "flex flex-col items-center justify-around space-y-7 " >
121
+
113
122
< p className = "relative mt-4 text-gray-500" >
114
123
{ sponsor . companydesc }
115
124
</ p >
@@ -138,6 +147,8 @@ export default function Slider(props: sliderProps) {
138
147
) ;
139
148
} ) }
140
149
</ Swiper >
150
+ < div className = "swiper-button-next ssn" > </ div >
151
+ < div className = "swiper-button-prev ssp" > </ div >
141
152
</ div >
142
153
</ div >
143
154
) }
0 commit comments