foundry-component-library 0.2.42 → 0.2.43
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import ReactPlayer from "react-player/lazy";
|
|
2
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
3
|
import styles from "./styles.module.scss";
|
|
5
4
|
import Mute from "../../assets/svg/mute.svg";
|
|
6
5
|
import Muted from "../../assets/svg/muted.svg";
|
|
@@ -10,18 +9,21 @@ import Logo from "../../assets/svg/footer-logo.svg";
|
|
|
10
9
|
function VideoTeaser({ url }: { url: string }) {
|
|
11
10
|
const [playing, setPlaying] = useState(true);
|
|
12
11
|
const [isMuted, setIsMuted] = useState(true);
|
|
13
|
-
const
|
|
12
|
+
const videoRef = useRef<HTMLVideoElement>(null);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
videoRef.current?.setAttribute("fetchpriority", "high");
|
|
16
|
+
}, []);
|
|
14
17
|
|
|
15
18
|
const handleClick = () => {
|
|
19
|
+
if (playing) {
|
|
20
|
+
videoRef.current?.pause();
|
|
21
|
+
} else {
|
|
22
|
+
videoRef.current?.play();
|
|
23
|
+
}
|
|
16
24
|
setPlaying(!playing);
|
|
17
25
|
};
|
|
18
26
|
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (typeof window !== "undefined") {
|
|
21
|
-
setHasWindow(true);
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
27
|
if (!url) return;
|
|
26
28
|
|
|
27
29
|
return (
|
|
@@ -33,7 +35,10 @@ function VideoTeaser({ url }: { url: string }) {
|
|
|
33
35
|
className={`${styles.wrapper} ${url ? styles.playCursor : ""} ${
|
|
34
36
|
playing ? styles.playing : ""
|
|
35
37
|
}`}>
|
|
36
|
-
<button
|
|
38
|
+
<button
|
|
39
|
+
className={styles.btnMute}
|
|
40
|
+
onClick={() => setIsMuted(!isMuted)}
|
|
41
|
+
aria-label={isMuted ? "Unmute video" : "Mute video"}>
|
|
37
42
|
{isMuted ? <Muted /> : <Mute />}
|
|
38
43
|
</button>
|
|
39
44
|
<div className={styles.video} onClick={handleClick}>
|
|
@@ -41,27 +46,15 @@ function VideoTeaser({ url }: { url: string }) {
|
|
|
41
46
|
className={`${styles.playButton} ${playing ? styles.playing : ""}`}>
|
|
42
47
|
<PlayButton />
|
|
43
48
|
</div>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
file: {
|
|
54
|
-
attributes: {
|
|
55
|
-
playsInline: true,
|
|
56
|
-
webkitPlaysInline: true,
|
|
57
|
-
muted: true,
|
|
58
|
-
poster: "/video-poster.jpg",
|
|
59
|
-
fetchpriority: "high",
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
)}
|
|
49
|
+
<video
|
|
50
|
+
ref={videoRef}
|
|
51
|
+
src={url}
|
|
52
|
+
autoPlay
|
|
53
|
+
loop
|
|
54
|
+
muted={isMuted}
|
|
55
|
+
playsInline
|
|
56
|
+
preload="auto"
|
|
57
|
+
/>
|
|
65
58
|
</div>
|
|
66
59
|
</div>
|
|
67
60
|
</>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foundry-component-library",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.43",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"preview": "vite preview"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
+
"lottie-web": "^5.13.0",
|
|
32
33
|
"motion": "^12.6.3",
|
|
33
34
|
"next": "15.2.8",
|
|
34
35
|
"react": "^19.0.0",
|
|
35
36
|
"react-dom": "^19.0.0",
|
|
36
|
-
"react-player": "^2.16.0"
|
|
37
|
-
"lottie-web": "^5.13.0"
|
|
37
|
+
"react-player": "^2.16.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@eslint/js": "^9.22.0",
|