@wzyjs/components 0.2.41

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.
@@ -0,0 +1,37 @@
1
+ 'use client'
2
+
3
+ import React, { CSSProperties, useRef } from 'react'
4
+
5
+ interface VideoProps {
6
+ url: string,
7
+ width?: number,
8
+ height?: number,
9
+ style?: CSSProperties
10
+ }
11
+
12
+ export const Video = (props: VideoProps) => {
13
+ const { url, width = 175, height = 310, style } = props
14
+
15
+ const videoRef = useRef<HTMLVideoElement>(null)
16
+
17
+ if (!url) {
18
+ return null
19
+ }
20
+
21
+ return (
22
+ <video
23
+ ref={videoRef}
24
+ width={width}
25
+ height={height}
26
+ style={style}
27
+ onMouseEnter={() => {
28
+ videoRef.current?.play()
29
+ }}
30
+ onMouseLeave={() => {
31
+ videoRef.current?.pause()
32
+ }}
33
+ >
34
+ <source src={url} type='video/mp4' />
35
+ </video>
36
+ )
37
+ }
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from './CodeView'
2
+ export * from './HtmlPro'
3
+ export * from './IframePro'
4
+ export * from './FormPro'
5
+ export * from './TablePro'
6
+ export * from './Com2Canvas'
7
+ export * from './Video'
8
+ export * from './MultiImageDisplay'
9
+ export * from './DownloadLink'
10
+ export * from './Fold'
11
+ export * from './DragSort'
12
+ export * from './DateSwitcher'
13
+
14
+ // export * from './JsonView'
15
+ // export * from './Crud'
16
+
17
+ export { default as ReactEchart } from 'echarts-for-react'