@yeeyoon/library 3.6.4 → 3.6.7
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/lib/components/CommonModal/FixedVideo/index.jsx +71 -0
- package/lib/components/CommonModal/FixedVideo/styles.less +1933 -0
- package/lib/components/CommonModal/index.js +48 -0
- package/lib/components/CommonModal/styles.less +17 -0
- package/lib/components/Header/components/NewVersion/config.json +240 -0
- package/lib/components/Header/components/NewVersion/index.jsx +63 -0
- package/lib/components/Header/components/NewVersion/styles.less +76 -0
- package/lib/components/Header/index.jsx +48 -14
- package/lib/components/Header/index.less +15 -3
- package/lib/components/Header/utils.js +91 -0
- package/lib/components/Icons/index.jsx +22 -1
- package/lib/components/TenantSelector/index.jsx +1 -1
- package/lib/config/env.js +1 -1
- package/package.json +4 -2
@@ -0,0 +1,71 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: Erlin
|
3
|
+
* @Date: 2022-06-10 11:26:40
|
4
|
+
* @LastEditors: Erlin
|
5
|
+
* @LastEditTime: 2022-06-10 12:09:01
|
6
|
+
* @Description:
|
7
|
+
*/
|
8
|
+
import React from 'react';
|
9
|
+
import PropTypes from 'prop-types';
|
10
|
+
import videojs from 'video.js';
|
11
|
+
import 'videojs-flash';
|
12
|
+
// import 'video.js/dist/video-js.css';
|
13
|
+
// import './video-js.min.css';
|
14
|
+
import styles from './styles.less';
|
15
|
+
// import 'videojs-font';
|
16
|
+
|
17
|
+
const videoOption = {
|
18
|
+
autoplay: true,
|
19
|
+
controls: true,
|
20
|
+
responsive: true,
|
21
|
+
fluid: true,
|
22
|
+
sources: [],
|
23
|
+
};
|
24
|
+
export const FixedVideo = (props) => {
|
25
|
+
const videoRef = React.useRef(null);
|
26
|
+
const playerRef = React.useRef(null);
|
27
|
+
const { src, poster, type, onReady } = props;
|
28
|
+
|
29
|
+
React.useEffect(() => {
|
30
|
+
// make sure Video.js player is only initialized once
|
31
|
+
if (!playerRef.current) {
|
32
|
+
const videoElement = videoRef.current;
|
33
|
+
if (!videoElement) return;
|
34
|
+
videoOption['sources'] = [{ src, poster, type }];
|
35
|
+
const player = (playerRef.current = videojs(
|
36
|
+
videoElement,
|
37
|
+
videoOption,
|
38
|
+
() => {
|
39
|
+
onReady && onReady(player);
|
40
|
+
}
|
41
|
+
));
|
42
|
+
}
|
43
|
+
}, [src]);
|
44
|
+
|
45
|
+
// Dispose the Video.js player when the functional component unmounts
|
46
|
+
React.useEffect(() => {
|
47
|
+
return () => {
|
48
|
+
if (playerRef.current) {
|
49
|
+
playerRef.current.dispose();
|
50
|
+
playerRef.current = null;
|
51
|
+
}
|
52
|
+
};
|
53
|
+
}, []);
|
54
|
+
|
55
|
+
return (
|
56
|
+
<div className={styles.container}>
|
57
|
+
<div data-vjs-player>
|
58
|
+
<video ref={videoRef} className="video-js vjs-big-play-centered" />
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
);
|
62
|
+
};
|
63
|
+
|
64
|
+
FixedVideo.propTypes = {
|
65
|
+
src: PropTypes.string,
|
66
|
+
poster: PropTypes.string,
|
67
|
+
type: PropTypes.string,
|
68
|
+
onReady: PropTypes.string,
|
69
|
+
};
|
70
|
+
|
71
|
+
export default FixedVideo;
|