Skip to content

Commit

Permalink
Merge branch 'main' into 81-form-contact
Browse files Browse the repository at this point in the history
  • Loading branch information
bstopp authored May 23, 2024
2 parents 74ac9ba + 3ced32a commit 85a5634
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions blocks/hero/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ function rotateImage(images) {

export default async function decorate(block) {
// check if it has a video
const video = block.querySelector('a[href*=".mp4"]');
const videoWrapper = video && video.closest('div');
videoWrapper.classList.add('video-wrapper');
const videoLink = videoWrapper?.firstElementChild;
// transform link into a video tag
const videoLink = block.querySelector('a[href*=".mp4"]');
let videoWrapper;
if (videoLink) {
const parent = videoLink.parentElement;
videoWrapper = document.createElement('div');
videoWrapper.classList.add('video-wrapper');
const videoHref = videoLink.href;
videoLink.remove();
setTimeout(() => {
decorateVideo(parent, videoHref);
decorateVideo(videoWrapper, videoHref);
}, 3000);
}

Expand Down

0 comments on commit 85a5634

Please sign in to comment.