1
1
import { useTranslation } from "next-i18next"
2
2
import { EffectCards , Keyboard , Navigation , Pagination } from "swiper/modules"
3
- import { Swiper as SwiperParent , SwiperSlide } from "swiper/react"
4
- import type { SwiperOptions } from "swiper/types"
3
+ import {
4
+ Swiper as SwiperParent ,
5
+ type SwiperProps as SwiperParentProps ,
6
+ SwiperSlide ,
7
+ } from "swiper/react"
5
8
6
9
import { ChevronNext , ChevronPrev } from "@/components/Chevron"
7
10
@@ -12,23 +15,27 @@ import "swiper/css/navigation"
12
15
import "swiper/css/pagination"
13
16
import "swiper/css/effect-cards"
14
17
15
- type SwiperProps = {
18
+ type SwiperProps = SwiperParentProps & {
16
19
children : React . ReactNode [ ]
17
- options ?: SwiperOptions
18
- className ?: string
19
- swiperClass ?: string
20
+ /**
21
+ * Additional class names for the container element.
22
+ */
23
+ containerClassName ?: string
24
+ /**
25
+ * Additional class names for the slider element.
26
+ */
20
27
sliderClass ?: string
21
28
}
29
+
22
30
const Swiper = ( {
23
31
children,
24
- className,
25
- swiperClass,
32
+ containerClassName,
26
33
sliderClass,
27
- options ,
34
+ ... props
28
35
} : SwiperProps ) => {
29
36
const { t } = useTranslation ( "common" )
30
37
return (
31
- < div className = { cn ( "h-fit" , className ) } >
38
+ < div className = { cn ( "h-fit" , containerClassName ) } >
32
39
< SwiperParent
33
40
navigation = { {
34
41
nextEl : ".swiper-button-next" ,
@@ -43,8 +50,7 @@ const Swiper = ({
43
50
modules = { [ Navigation , Pagination , Keyboard , EffectCards ] }
44
51
slidesPerView = { 1 }
45
52
slidesPerGroup = { 1 }
46
- className = { swiperClass }
47
- { ...options }
53
+ { ...props }
48
54
>
49
55
{ children . map ( ( child , index ) => (
50
56
< SwiperSlide className = { sliderClass } key = { index } >
0 commit comments