1
1
import React from "react" ;
2
2
import styles from "../styles/InitiativePartners.module.css" ;
3
- var $ = require ( "jquery" ) ;
4
- if ( typeof window !== "undefined" ) {
5
- // Client-side-only code
6
- window . $ = window . jQuery = require ( "jquery" ) ;
7
- }
8
- import "owl.carousel/dist/assets/owl.carousel.css" ;
9
- import "owl.carousel/dist/assets/owl.theme.default.css" ;
10
- import dynamic from "next/dynamic" ;
11
3
import { useRouter } from "next/router" ;
12
- import Link from "next/link" ;
4
+ import { Swiper , SwiperSlide } from "swiper/react" ;
5
+ import { Navigation , Scrollbar , Pagination , A11y , Autoplay , Controller } from "swiper" ;
6
+ import "swiper/css" ;
7
+ import "swiper/css/navigation" ;
8
+ import "swiper/css/autoplay" ;
13
9
14
- const OwlCarousel = dynamic ( ( ) => import ( "react-owl-carousel" ) , {
15
- ssr : false ,
16
- } ) ;
17
10
export default function InitiativePartners ( props ) {
18
11
const { locale, pathname } = useRouter ( ) ;
19
12
20
13
const { HomeContent, partners, status } = props ;
21
14
22
- const Responsive = {
23
- 0 : {
24
- items : 2 ,
25
- margin : 5 ,
26
- } ,
27
-
28
- 580 : {
29
- items : 2 ,
30
- margin : 10 ,
31
- } ,
32
-
33
- 900 : {
34
- items : 3 ,
35
- margin : 20 ,
36
- } ,
37
-
38
- 1200 : {
39
- items : 4 ,
40
- margin : 20 ,
41
- } ,
42
15
43
- 1400 : {
44
- items : 4 ,
45
- margin : 10 ,
46
- } ,
47
- } ;
16
+
48
17
return (
49
18
< div className = { styles . initpartners } >
50
19
{ HomeContent . partner
@@ -66,22 +35,47 @@ export default function InitiativePartners(props) {
66
35
) ;
67
36
} ) }
68
37
69
- < div className = { styles . sliders + " sliders" } >
70
- < OwlCarousel
71
- className = { styles . slider }
72
- loop
73
- margin = { 10 }
74
- dots = { false }
75
- // nav={true}
76
- responsive = { Responsive }
77
- autoplay
78
- autoplayTimeout = { 1500000 }
79
- >
38
+ < div className = { styles . sliders } >
39
+ < Swiper
40
+ modules = { [ Navigation , Scrollbar , Autoplay , A11y , Pagination , Controller ] }
41
+ spaceBetween = { 10 }
42
+ slidesPerView = { 3 }
43
+ loop = { true }
44
+ navigation
45
+ autoplay = { true }
46
+ speed = { 300 }
47
+ breakpoints = { {
48
+ 0 : {
49
+ slidesPerView : 1 ,
50
+ spaceBetween : 5 ,
51
+ } ,
52
+ 580 : {
53
+ slidesPerView : 2 ,
54
+ spaceBetween : 10 ,
55
+ } ,
56
+ 900 : {
57
+ slidesPerView : 3 ,
58
+ spaceBetween : 10 ,
59
+ } ,
60
+ 1200 : {
61
+ slidesPerView : 4 ,
62
+ spaceBetween : 20 ,
63
+ } ,
64
+ 1400 : {
65
+ slidesPerView : 4 ,
66
+ spaceBetween : 10 ,
67
+ } ,
68
+ } }
69
+ scrollbar = { { draggable : true } }
70
+ >
71
+
80
72
{ partners . map (
81
73
( { id, partner_link, partner_image, partner_title } ) => (
82
- < a
74
+ < SwiperSlide key = { id } >
75
+ < div className = { styles . item } >
76
+ < a
83
77
href = { partner_link }
84
- key = { id }
78
+
85
79
target = "_blank"
86
80
className = { styles . item }
87
81
>
@@ -90,9 +84,13 @@ export default function InitiativePartners(props) {
90
84
/>
91
85
< span > { partner_title } </ span >
92
86
</ a >
87
+ </ div >
88
+
89
+ </ SwiperSlide >
93
90
)
94
91
) }
95
- </ OwlCarousel >
92
+
93
+ </ Swiper >
96
94
</ div >
97
95
</ div >
98
96
) ;
0 commit comments