@cntrl-site/sdk-nextjs 1.8.19-alpha.0 → 1.8.19-alpha.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.
|
Binary file
|
|
@@ -50,30 +50,34 @@ const SectionVideo = ({ container, sectionId, media }) => {
|
|
|
50
50
|
}, [play]);
|
|
51
51
|
const isContainHeight = size === 'contain-height';
|
|
52
52
|
const hasOffsetX = offsetX !== null && size === 'contain';
|
|
53
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { ref: setVideo, autoPlay: play === 'auto', loop: true, controls: false, muted: play === 'auto', playsInline: true, preload: "auto", className: `video-background-${sectionId}`, onPlay: () => setIsPlaying(true), onPause: () => setIsPlaying(false), children: (0, jsx_runtime_1.jsx)("source", { src: `${url}#t=0.001` }) }), (0, jsx_runtime_1.jsx)("div", { className: `video-background-${sectionId}-cover-container`, onClick: handleCoverClick, children: coverUrl && play === 'on-click' && ((0, jsx_runtime_1.jsx)("img", { src: coverUrl, alt: "Video cover", className: `video-background-${sectionId}-cover`, style: { opacity: isPlaying ? 0 : 1 } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("video", { ref: setVideo, autoPlay: play === 'auto', loop: true, style: { opacity: !isPlaying && play === 'on-click' ? 0 : 1 }, controls: false, muted: play === 'auto', playsInline: true, preload: "auto", className: `video-background-${sectionId}`, onPlay: () => setIsPlaying(true), onPause: () => setIsPlaying(false), children: (0, jsx_runtime_1.jsx)("source", { src: `${url}#t=0.001` }) }), (0, jsx_runtime_1.jsx)("div", { className: `video-background-${sectionId}-cover-container`, onClick: handleCoverClick, children: coverUrl && play === 'on-click' && ((0, jsx_runtime_1.jsx)("img", { src: coverUrl, alt: "Video cover", className: `video-background-${sectionId}-cover`, style: { opacity: isPlaying ? 0 : 1 } })) }), (0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
54
54
|
.video-background-${sectionId}-cover-container {
|
|
55
|
-
position:
|
|
55
|
+
position: absolute;
|
|
56
56
|
pointer-events: ${play === 'on-click' ? 'auto' : 'none'};
|
|
57
57
|
left: 0;
|
|
58
|
-
width:
|
|
59
|
-
height:
|
|
60
|
-
top:
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
top: 0;
|
|
61
61
|
}
|
|
62
62
|
.video-background-${sectionId}-cover {
|
|
63
|
-
|
|
63
|
+
position: ${position === 'fixed' ? 'sticky' : 'relative'};
|
|
64
|
+
margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
|
|
65
|
+
width: ${isContainHeight ? 'auto' : '100%'};
|
|
66
|
+
height: ${position === 'fixed' ? '100vh' : '100%'};
|
|
67
|
+
object-fit: ${isContainHeight ? 'unset' : size !== null && size !== void 0 ? size : 'cover'};
|
|
64
68
|
transition: opacity 0.1s ease-in-out;
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
top: ${position === 'fixed' ? '100vh' : '0'};
|
|
70
|
+
transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
|
|
71
|
+
${hasOffsetX ? 'max-width: 100vw;' : ''}
|
|
67
72
|
}
|
|
68
73
|
.video-background-${sectionId} {
|
|
69
74
|
object-fit: ${isContainHeight ? 'unset' : size !== null && size !== void 0 ? size : 'cover'};
|
|
70
|
-
width: ${isContainHeight
|
|
75
|
+
width: ${isContainHeight ? 'auto' : '100%'};
|
|
71
76
|
height: ${position === 'fixed' ? '100vh' : '100%'};
|
|
72
77
|
transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
|
|
73
78
|
position: ${position === 'fixed' ? 'sticky' : 'relative'};
|
|
74
79
|
top: ${position === 'fixed' ? '100vh' : 'unset'};
|
|
75
80
|
margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
|
|
76
|
-
${offsetX ? 'max-width: 100vw;' : ''}
|
|
77
81
|
}
|
|
78
82
|
` })] }));
|
|
79
83
|
};
|
package/package.json
CHANGED
|
@@ -69,6 +69,7 @@ export const SectionVideo: FC<Props> = ({ container, sectionId, media }) => {
|
|
|
69
69
|
ref={setVideo}
|
|
70
70
|
autoPlay={play === 'auto'}
|
|
71
71
|
loop
|
|
72
|
+
style={{ opacity: !isPlaying && play === 'on-click' ? 0 : 1 }}
|
|
72
73
|
controls={false}
|
|
73
74
|
muted={play === 'auto'}
|
|
74
75
|
playsInline
|
|
@@ -86,28 +87,32 @@ export const SectionVideo: FC<Props> = ({ container, sectionId, media }) => {
|
|
|
86
87
|
</div>
|
|
87
88
|
<JSXStyle id={id}>{`
|
|
88
89
|
.video-background-${sectionId}-cover-container {
|
|
89
|
-
position:
|
|
90
|
+
position: absolute;
|
|
90
91
|
pointer-events: ${play === 'on-click' ? 'auto' : 'none'};
|
|
91
92
|
left: 0;
|
|
92
|
-
width:
|
|
93
|
-
height:
|
|
94
|
-
top:
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
top: 0;
|
|
95
96
|
}
|
|
96
97
|
.video-background-${sectionId}-cover {
|
|
97
|
-
|
|
98
|
+
position: ${position === 'fixed' ? 'sticky' : 'relative'};
|
|
99
|
+
margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
|
|
100
|
+
width: ${isContainHeight ? 'auto' : '100%'};
|
|
101
|
+
height: ${position === 'fixed' ? '100vh' : '100%'};
|
|
102
|
+
object-fit: ${isContainHeight ? 'unset' : size ?? 'cover'};
|
|
98
103
|
transition: opacity 0.1s ease-in-out;
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
top: ${position === 'fixed' ? '100vh' : '0'};
|
|
105
|
+
transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
|
|
106
|
+
${hasOffsetX ? 'max-width: 100vw;' : ''}
|
|
101
107
|
}
|
|
102
108
|
.video-background-${sectionId} {
|
|
103
109
|
object-fit: ${isContainHeight ? 'unset' : size ?? 'cover'};
|
|
104
|
-
width: ${isContainHeight
|
|
110
|
+
width: ${isContainHeight ? 'auto' : '100%'};
|
|
105
111
|
height: ${position === 'fixed' ? '100vh' : '100%'};
|
|
106
112
|
transform: ${isContainHeight ? 'translateX(-50%)' : 'none'};
|
|
107
113
|
position: ${position === 'fixed' ? 'sticky' : 'relative'};
|
|
108
114
|
top: ${position === 'fixed' ? '100vh' : 'unset'};
|
|
109
115
|
margin-left: ${isContainHeight ? '50%' : (hasOffsetX ? `${offsetX * 100}vw` : '0')};
|
|
110
|
-
${offsetX ? 'max-width: 100vw;' : ''}
|
|
111
116
|
}
|
|
112
117
|
`}
|
|
113
118
|
</JSXStyle>
|