diff --git a/src/components/videoBackground/VideoBackground.js b/src/components/videoBackground/VideoBackground.js
index 40dc0401..75aa9a03 100644
--- a/src/components/videoBackground/VideoBackground.js
+++ b/src/components/videoBackground/VideoBackground.js
@@ -1,8 +1,9 @@
import React, { useEffect, useRef, useState } from "react"
import ButtonLink from "../ButtonLink/ButtonLink"
import "./videoBackground.scss"
+
const VideoBackground = ({
- data: { video, description, button, strapi_component, id, backgroundImage },
+ data: { video, description, button, strapi_component, id, backgroundImage, videoUrl },
}) => {
const [isVideoPause, setIsVideoPause] = useState(false)
const videoRef = useRef(null)
@@ -32,6 +33,14 @@ const VideoBackground = ({
localStorage.setItem("videoPaused", isVideoPause)
}, [isVideoPause])
+ const url = videoUrl?.replace("watch?v=", "embed/")
+ let code = url?.substring(url.lastIndexOf("/") + 1, url.length)
+ const codeIndex = code?.indexOf("?")
+
+ if (codeIndex !== -1 && code !== undefined) {
+ code = code.substring(0, code.indexOf("?"))
+ }
+
return (
-
-
-
{description}
-
-
+ {(video?.url !== null && video?.url !== undefined) ?
+
: (videoUrl !== null && videoUrl !== undefined) && (
+ <>
+ {(url !== undefined && code !== undefined) && (
+
+ )
+ }
+ >
+ )
+ }
+
+ {description &&
+
+
{description}
+
+
+ }
diff --git a/src/components/videoBackground/videoBackground.scss b/src/components/videoBackground/videoBackground.scss
index 2919513c..7017e18b 100644
--- a/src/components/videoBackground/videoBackground.scss
+++ b/src/components/videoBackground/videoBackground.scss
@@ -5,9 +5,10 @@
margin-top: 50px;
margin-bottom: 50px;
}
- video {
+ video,
+ iframe {
width: 100%;
- height: 250px;
+ height: 195px;
object-fit: cover;
display: block;
border-radius: 5px;
@@ -37,7 +38,7 @@
@media screen and (min-width: $breakpoint-md) {
.videoBackground {
// width: calc(100% - 6em);
- height: 550px;
+ height: 400px;
position: relative;
z-index: 3;
display: flex;
@@ -46,7 +47,7 @@
margin-top: 80px;
margin-bottom: 80px;
}
- video {
+ .video {
top: 0;
position: absolute;
width: 100%;
@@ -81,13 +82,19 @@
@media screen and (min-width: $breakpoint-lg) {
.videoBackground {
- height: 80vh;
+ height: 520px;
&-container {
margin-bottom: 80px;
}
}
}
+@media screen and (min-width: $breakpoint-xl) {
+ .videoBackground {
+ height: 720px;
+ }
+}
+
// @media screen and (max-width: $breakpoint-md) {
// .videoBackground {
// height: 500px;