@growth-angels/ds-core 1.20.0 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/hydrate-carousel.js +1 -0
- package/dist/organisms/Carousel/Carousel.types.d.ts +5 -0
- package/dist/organisms/Carousel/CarouselSwiper.js +5 -1
- package/package.json +1 -1
- package/src/lib/hydrate-carousel.tsx +1 -0
- package/src/organisms/Carousel/Carousel.types.ts +5 -0
- package/src/organisms/Carousel/CarouselSwiper.tsx +6 -0
|
@@ -18,6 +18,11 @@ export type CarouselAttributes = {
|
|
|
18
18
|
navigation?: {
|
|
19
19
|
positionY: 'bottom' | 'top';
|
|
20
20
|
};
|
|
21
|
+
autoplay?: {
|
|
22
|
+
delay: number;
|
|
23
|
+
disableOnInteraction?: boolean;
|
|
24
|
+
};
|
|
25
|
+
speed?: number;
|
|
21
26
|
};
|
|
22
27
|
export interface CarouselProps extends CarouselAttributes, WordpressDefault {
|
|
23
28
|
children: React.ReactNode | React.ReactNode[];
|
|
@@ -4,7 +4,7 @@ import { Button } from "../../atoms/atoms";
|
|
|
4
4
|
import Swiper from "swiper";
|
|
5
5
|
import { Autoplay, Navigation, Pagination } from "swiper/modules";
|
|
6
6
|
export const CarouselSwiper = (props) => {
|
|
7
|
-
const { children, slidesPerView: slidesPerViewDefault, spaceBetween = 48, navigation, pagination, hasPagination, hasNavigation, loop = false, } = props;
|
|
7
|
+
const { children, slidesPerView: slidesPerViewDefault, spaceBetween = 48, navigation, pagination, hasPagination, hasNavigation, loop = false, autoplay, speed, } = props;
|
|
8
8
|
const classes = ["ga-ds-carousel"];
|
|
9
9
|
if (props.extraClassNames) {
|
|
10
10
|
if (typeof props.extraClassNames === "string") {
|
|
@@ -61,6 +61,10 @@ export const CarouselSwiper = (props) => {
|
|
|
61
61
|
bulletActiveClass: "ga-ds-carousel__dot--active",
|
|
62
62
|
}
|
|
63
63
|
: false,
|
|
64
|
+
autoplay: autoplay
|
|
65
|
+
? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
|
|
66
|
+
: false,
|
|
67
|
+
speed: speed || 300,
|
|
64
68
|
});
|
|
65
69
|
setSwiperInstance(swiper);
|
|
66
70
|
}
|
package/package.json
CHANGED
|
@@ -19,6 +19,11 @@ export type CarouselAttributes = {
|
|
|
19
19
|
navigation?: {
|
|
20
20
|
positionY: 'bottom' | 'top';
|
|
21
21
|
}
|
|
22
|
+
autoplay?: {
|
|
23
|
+
delay: number;
|
|
24
|
+
disableOnInteraction?: boolean;
|
|
25
|
+
}
|
|
26
|
+
speed?: number;
|
|
22
27
|
}
|
|
23
28
|
export interface CarouselProps extends CarouselAttributes, WordpressDefault {
|
|
24
29
|
children: React.ReactNode | React.ReactNode[]
|
|
@@ -14,6 +14,8 @@ export const CarouselSwiper = (props: CarouselProps) => {
|
|
|
14
14
|
hasPagination,
|
|
15
15
|
hasNavigation,
|
|
16
16
|
loop = false,
|
|
17
|
+
autoplay,
|
|
18
|
+
speed,
|
|
17
19
|
} = props
|
|
18
20
|
|
|
19
21
|
const classes = ["ga-ds-carousel"]
|
|
@@ -74,6 +76,10 @@ export const CarouselSwiper = (props: CarouselProps) => {
|
|
|
74
76
|
bulletActiveClass: "ga-ds-carousel__dot--active",
|
|
75
77
|
}
|
|
76
78
|
: false,
|
|
79
|
+
autoplay: autoplay
|
|
80
|
+
? { delay: autoplay.delay || 5000, disableOnInteraction: autoplay.disableOnInteraction ?? false }
|
|
81
|
+
: false,
|
|
82
|
+
speed: speed || 300,
|
|
77
83
|
})
|
|
78
84
|
|
|
79
85
|
setSwiperInstance(swiper)
|