@stackshift-ui/header 6.1.0 → 6.1.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/package.json +5 -5
- package/src/header.tsx +2 -1
- package/src/header_g.tsx +6 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/header",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "6.1.
|
|
4
|
+
"version": "6.1.1",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"@stackshift-ui/button": "6.0.11",
|
|
37
37
|
"@stackshift-ui/container": "6.0.11",
|
|
38
38
|
"@stackshift-ui/flex": "6.0.11",
|
|
39
|
+
"@stackshift-ui/heading": "6.0.11",
|
|
40
|
+
"@stackshift-ui/image": "6.0.11",
|
|
39
41
|
"@stackshift-ui/scripts": "6.0.10",
|
|
40
42
|
"@stackshift-ui/section": "6.0.11",
|
|
41
43
|
"@stackshift-ui/link": "6.0.11",
|
|
42
44
|
"@stackshift-ui/signin-signup": "6.0.14",
|
|
43
|
-
"@stackshift-ui/
|
|
44
|
-
"@stackshift-ui/heading": "6.0.11",
|
|
45
|
-
"@stackshift-ui/system": "6.0.11",
|
|
45
|
+
"@stackshift-ui/text": "6.0.11",
|
|
46
46
|
"@stackshift-ui/swiper-pagination": "6.0.11",
|
|
47
|
-
"@stackshift-ui/
|
|
47
|
+
"@stackshift-ui/system": "6.0.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@stackshift-ui/system": ">=6.0.11",
|
package/src/header.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export interface ButtonProps {
|
|
|
33
33
|
export interface HeaderProps {
|
|
34
34
|
template?: Template;
|
|
35
35
|
mainImage?: MainImage;
|
|
36
|
-
|
|
36
|
+
mediaItems?: Images[];
|
|
37
37
|
title?: string;
|
|
38
38
|
subtitle?: string;
|
|
39
39
|
description?: string;
|
|
@@ -60,6 +60,7 @@ export const Header: React.FC<SectionsProps> = ({ data }) => {
|
|
|
60
60
|
const props = {
|
|
61
61
|
mainImage: data?.variants?.mainImage ?? undefined,
|
|
62
62
|
images: data?.variants?.images ?? undefined,
|
|
63
|
+
mediaItems: data?.variants?.images ?? undefined,
|
|
63
64
|
title: data?.variants?.title ?? undefined,
|
|
64
65
|
subtitle: data?.variants?.subtitle ?? undefined,
|
|
65
66
|
description: data?.variants?.description ?? undefined,
|
package/src/header_g.tsx
CHANGED
|
@@ -8,25 +8,25 @@ import { useEffect, useState } from "react";
|
|
|
8
8
|
import { HeaderProps } from ".";
|
|
9
9
|
|
|
10
10
|
export default function Header_G({
|
|
11
|
-
|
|
11
|
+
mediaItems,
|
|
12
12
|
title,
|
|
13
13
|
description,
|
|
14
14
|
primaryButton,
|
|
15
15
|
secondaryButton,
|
|
16
16
|
position = "center",
|
|
17
17
|
}: HeaderProps) {
|
|
18
|
-
if (!
|
|
18
|
+
if (!mediaItems?.length) return null;
|
|
19
19
|
|
|
20
20
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
21
|
-
const currentItem =
|
|
21
|
+
const currentItem = mediaItems[currentIndex];
|
|
22
22
|
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
const timer = setInterval(() => {
|
|
25
|
-
setCurrentIndex(prevIndex => (prevIndex + 1) %
|
|
25
|
+
setCurrentIndex(prevIndex => (prevIndex + 1) % mediaItems.length);
|
|
26
26
|
}, 5000);
|
|
27
27
|
|
|
28
28
|
return () => clearInterval(timer);
|
|
29
|
-
}, [
|
|
29
|
+
}, [mediaItems.length]);
|
|
30
30
|
|
|
31
31
|
const handleSlideChange = (index: number) => {
|
|
32
32
|
setCurrentIndex(index);
|
|
@@ -113,7 +113,7 @@ export default function Header_G({
|
|
|
113
113
|
</div>
|
|
114
114
|
|
|
115
115
|
<div className="absolute bottom-8 left-1/2 transform -translate-x-1/2 z-20 flex gap-2">
|
|
116
|
-
{
|
|
116
|
+
{mediaItems.map((_, index) => (
|
|
117
117
|
<SwiperPagination
|
|
118
118
|
key={index}
|
|
119
119
|
colorScheme="white"
|