Skip to content

Commit

Permalink
Merge pull request #12 from ufotechnologies/dev
Browse files Browse the repository at this point in the history
Article MP4 as object with width and height
  • Loading branch information
pschroen authored Jul 10, 2024
2 parents 8e92400 + 754c8de commit e7214a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/js/components/Figure.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,24 @@ export class Figure extends Component {
}

render() {
const { indent, image, featuredImage, label, caption, mp4, mp4Link } = this.sectionData;
const { indent, image, featuredImage, label, caption, mp4 } = this.sectionData;

if (mp4Link) {
if (mp4?.link) {
this.nodeList = html(/* html */ `
<figure class="${indent ? 'indent ' : ''}lazy">
<video autoplay muted loop playsinline src="${mp4Link}"></video>
<video autoplay muted loop playsinline src="${mp4.link}" width="${mp4.width}" height="${mp4.height}"></video>
<figcaption>
${label ? /* html */ `<div><strong>${label}</strong></div>` : ''}
${caption ? /* html */ `<div>${caption}</div>` : ''}
</figcaption>
</figure>
`);
} else if (mp4) {
const asset = data.get('files').find(doc => doc._id === mp4.asset._ref);
} else if (mp4?.video) {
const asset = data.get('files').find(doc => doc._id === mp4.video.asset._ref);

this.nodeList = html(/* html */ `
<figure class="${indent ? 'indent ' : ''}lazy">
<video autoplay muted loop playsinline src="${asset.url}"></video>
<video autoplay muted loop playsinline src="${asset.url}" width="${mp4.width}" height="${mp4.height}"></video>
<figcaption>
${label ? /* html */ `<div><strong>${label}</strong></div>` : ''}
${caption ? /* html */ `<div>${caption}</div>` : ''}
Expand Down

0 comments on commit e7214a4

Please sign in to comment.