@rxdrag/website-lib-core 0.0.70 → 0.0.74
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"typescript": "^5",
|
|
27
27
|
"@rxdrag/eslint-config-custom": "0.2.12",
|
|
28
28
|
"@rxdrag/tsconfig": "0.2.0",
|
|
29
|
-
"@rxdrag/slate-preview": "1.2.
|
|
29
|
+
"@rxdrag/slate-preview": "1.2.60"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"clsx": "^2.1.0",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"lodash-es": "^4.17.21",
|
|
36
36
|
"react": "^19.1.0",
|
|
37
37
|
"react-dom": "^19.1.0",
|
|
38
|
-
"@rxdrag/entify-lib": "0.0.
|
|
39
|
-
"@rxdrag/rxcms-models": "0.3.
|
|
38
|
+
"@rxdrag/entify-lib": "0.0.22",
|
|
39
|
+
"@rxdrag/rxcms-models": "0.3.93"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"astro": "^4.0.0 || ^5.0.0"
|
package/src/astro/media.ts
CHANGED
|
@@ -179,7 +179,7 @@ export const ContactForm = forwardRef<HTMLDivElement, ContactFormProps>(
|
|
|
179
179
|
<div
|
|
180
180
|
ref={ref}
|
|
181
181
|
className={clsx(
|
|
182
|
-
"py-4 grid max-w-2xl grid-cols-1 gap-x-6 sm:grid-cols-2",
|
|
182
|
+
"py-4 grid max-w-2xl grid-cols-1 gap-x-6 sm:grid-cols-2 w-full",
|
|
183
183
|
className || "gap-y-6"
|
|
184
184
|
)}
|
|
185
185
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState, forwardRef } from "react";
|
|
2
2
|
import Hls from "hls.js";
|
|
3
3
|
import type { Media } from "@rxdrag/rxcms-models";
|
|
4
4
|
import { ReactModalTrigger } from "./ReactModalTrigger";
|
|
@@ -19,14 +19,15 @@ export type VideoPlayerClassNames = {
|
|
|
19
19
|
overlayReplayButton?: string;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export const ReactVideoPlayer = forwardRef<HTMLDivElement, {
|
|
23
23
|
endTitle?: string;
|
|
24
24
|
media: Media;
|
|
25
25
|
posterUrl?: string;
|
|
26
26
|
classNames?: VideoPlayerClassNames;
|
|
27
27
|
callToAction?: string;
|
|
28
28
|
onToggleSelect?: (id: ID) => void;
|
|
29
|
-
|
|
29
|
+
designMode?: boolean;
|
|
30
|
+
}>((props, ref) => {
|
|
30
31
|
const {
|
|
31
32
|
endTitle,
|
|
32
33
|
media,
|
|
@@ -34,6 +35,7 @@ export function ReactVideoPlayer(props: {
|
|
|
34
35
|
posterUrl,
|
|
35
36
|
classNames,
|
|
36
37
|
callToAction,
|
|
38
|
+
designMode,
|
|
37
39
|
} = props;
|
|
38
40
|
const videoRef = useRef<HTMLVideoElement>(null);
|
|
39
41
|
const hlsRef = useRef<Hls | null>(null);
|
|
@@ -42,6 +44,7 @@ export function ReactVideoPlayer(props: {
|
|
|
42
44
|
|
|
43
45
|
const handleContainerClick = useCallback(
|
|
44
46
|
(e: React.MouseEvent) => {
|
|
47
|
+
if (designMode) return;
|
|
45
48
|
if (isPlaying && videoRef.current) {
|
|
46
49
|
e.stopPropagation();
|
|
47
50
|
videoRef.current.pause();
|
|
@@ -51,18 +54,19 @@ export function ReactVideoPlayer(props: {
|
|
|
51
54
|
onToggleSelect?.(media.id);
|
|
52
55
|
}
|
|
53
56
|
},
|
|
54
|
-
[isPlaying, media.id, onToggleSelect]
|
|
57
|
+
[isPlaying, media.id, onToggleSelect, designMode]
|
|
55
58
|
);
|
|
56
59
|
|
|
57
60
|
const handlePlayClick = useCallback(
|
|
58
61
|
(e: React.MouseEvent) => {
|
|
62
|
+
if (designMode) return;
|
|
59
63
|
e.stopPropagation();
|
|
60
64
|
const v = videoRef.current;
|
|
61
65
|
if (!v) return;
|
|
62
66
|
if (isPlaying) v.pause();
|
|
63
67
|
else v.play();
|
|
64
68
|
},
|
|
65
|
-
[isPlaying]
|
|
69
|
+
[isPlaying, designMode]
|
|
66
70
|
);
|
|
67
71
|
|
|
68
72
|
useEffect(() => {
|
|
@@ -136,22 +140,17 @@ export function ReactVideoPlayer(props: {
|
|
|
136
140
|
|
|
137
141
|
return (
|
|
138
142
|
<div
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
classNames?.container,
|
|
142
|
-
]
|
|
143
|
-
.filter(Boolean)
|
|
144
|
-
.join(" ")}
|
|
143
|
+
ref={ref}
|
|
144
|
+
className={clsx("relative w-full aspect-video rounded-2xl", classNames?.container)}
|
|
145
145
|
onClick={handleContainerClick}
|
|
146
146
|
>
|
|
147
147
|
<video
|
|
148
148
|
ref={videoRef}
|
|
149
|
+
onClick={(e) => !designMode && e.stopPropagation()}
|
|
149
150
|
preload="metadata"
|
|
150
151
|
poster={posterUrl ?? media.file?.thumbnail}
|
|
151
|
-
className={
|
|
152
|
-
|
|
153
|
-
.join(" ")}
|
|
154
|
-
controls
|
|
152
|
+
className={clsx("w-full h-full rounded-lg object-cover", classNames?.video)}
|
|
153
|
+
controls={!designMode}
|
|
155
154
|
>
|
|
156
155
|
{!media.storageType && media.file?.original ? (
|
|
157
156
|
<source src={media.file.original} />
|
|
@@ -163,35 +162,27 @@ export function ReactVideoPlayer(props: {
|
|
|
163
162
|
<button
|
|
164
163
|
type="button"
|
|
165
164
|
onClick={handlePlayClick}
|
|
166
|
-
className={
|
|
165
|
+
className={clsx(
|
|
167
166
|
"absolute inset-0 flex items-center justify-center w-full h-full transition rounded-lg z-10",
|
|
168
|
-
classNames?.playButton
|
|
169
|
-
|
|
170
|
-
.filter(Boolean)
|
|
171
|
-
.join(" ")}
|
|
167
|
+
classNames?.playButton
|
|
168
|
+
)}
|
|
172
169
|
>
|
|
173
170
|
<div
|
|
174
|
-
className={
|
|
171
|
+
className={clsx(
|
|
175
172
|
"flex items-center justify-center size-[130px] bg-white/15 rounded-full backdrop-blur-sm hover:shadow-md transition-all duration-300 hover:scale-110 group",
|
|
176
|
-
classNames?.playButtonOuter
|
|
177
|
-
|
|
178
|
-
.filter(Boolean)
|
|
179
|
-
.join(" ")}
|
|
173
|
+
classNames?.playButtonOuter
|
|
174
|
+
)}
|
|
180
175
|
>
|
|
181
176
|
<div
|
|
182
|
-
className={
|
|
177
|
+
className={clsx(
|
|
183
178
|
"size-[90px] bg-white relative overflow-hidden rounded-full",
|
|
184
|
-
classNames?.playButtonInner
|
|
185
|
-
|
|
186
|
-
.filter(Boolean)
|
|
187
|
-
.join(" ")}
|
|
179
|
+
classNames?.playButtonInner
|
|
180
|
+
)}
|
|
188
181
|
>
|
|
189
182
|
<div className="absolute inset-0 cross-gradient box-shadow-1">
|
|
190
183
|
<div className="w-full h-full flex items-center justify-center">
|
|
191
184
|
<svg
|
|
192
|
-
className={
|
|
193
|
-
.filter(Boolean)
|
|
194
|
-
.join(" ")}
|
|
185
|
+
className={clsx("size-8 text-gray-700", classNames?.playIcon)}
|
|
195
186
|
viewBox="0 0 30 32"
|
|
196
187
|
fill="currentColor"
|
|
197
188
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -206,12 +197,10 @@ export function ReactVideoPlayer(props: {
|
|
|
206
197
|
)}
|
|
207
198
|
|
|
208
199
|
<div
|
|
209
|
-
className={
|
|
200
|
+
className={clsx(
|
|
210
201
|
"absolute inset-0 bg-black/50 flex-col gap-6 items-center justify-center text-center text-white hidden z-10 rounded-2xl",
|
|
211
|
-
classNames?.overlay
|
|
212
|
-
|
|
213
|
-
.filter(Boolean)
|
|
214
|
-
.join(" ")}
|
|
202
|
+
classNames?.overlay
|
|
203
|
+
)}
|
|
215
204
|
style={{ display: isEnded ? "flex" : "none" }}
|
|
216
205
|
>
|
|
217
206
|
<p
|
|
@@ -231,12 +220,10 @@ export function ReactVideoPlayer(props: {
|
|
|
231
220
|
</ReactModalTrigger>
|
|
232
221
|
<button
|
|
233
222
|
type="button"
|
|
234
|
-
className={
|
|
223
|
+
className={clsx(
|
|
235
224
|
"px-10 py-2.5 bg-white/20 hover:bg-white/30 rounded-full transition text-sm",
|
|
236
|
-
classNames?.overlayReplayButton
|
|
237
|
-
|
|
238
|
-
.filter(Boolean)
|
|
239
|
-
.join(" ")}
|
|
225
|
+
classNames?.overlayReplayButton
|
|
226
|
+
)}
|
|
240
227
|
onClick={(e) => {
|
|
241
228
|
e.stopPropagation();
|
|
242
229
|
const v = videoRef.current;
|
|
@@ -252,4 +239,4 @@ export function ReactVideoPlayer(props: {
|
|
|
252
239
|
</div>
|
|
253
240
|
</div>
|
|
254
241
|
);
|
|
255
|
-
}
|
|
242
|
+
});
|