Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMULSIF-246: Convert Videos to support SDC #149

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/components/videos/video-embed.component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/10.1.x/core/modules/sdc/src/metadata.schema.json

name: Video Embed
group: Components
status: stable
props:
type: object
required:
- video__type
- video_content
properties:
video__type:
type: string
title: Video Type
description: 'Specifies the type of video to embed. Possible values: embed, html5'
data: 'embed'
video_content:
type: string
title: Video Content
description: 'Directly specifies the HTML content for embed videos'
data: "<iframe title='Test Video' width='854' height='480' frameborder='0' allowfullscreen='allowfullscreen' src='https://www.youtube.com/embed/YRnVnlhjOBs?autoplay=0&amp;start=0'></iframe>"
2 changes: 0 additions & 2 deletions src/components/videos/video-embed.yml

This file was deleted.

23 changes: 23 additions & 0 deletions src/components/videos/video-html5.component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$schema: https://git.drupalcode.org/project/drupal/-/raw/10.1.x/core/modules/sdc/src/metadata.schema.json

name: Video HTML5
group: Components
status: stable
props:
type: object
required:
- video__type
- video__urls
properties:
video__type:
type: string
title: Video Type
description: 'Specifies the type of video to embed. Possible values: embed, html5'
data: 'html5'
video__urls:
type: array
title: Video URLs
description: 'List of video URLs for HTML5 videos'
data:
- 'https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4'
- 'https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-webm-file.webm'
5 changes: 0 additions & 5 deletions src/components/videos/video-html5.yml

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/videos/videos.stories.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import video from './video.twig';

import videoEmbedData from './video-embed.yml';
import videoHTML5Data from './video-html5.yml';
import { props as videoEmbedProps } from './video-embed.component.yml';
import { props as videoHTML5Props } from './video-html5.component.yml';

import { mapDataToTwig } from '../../util/dataTransformers';
import './video-embed';

/**
* Storybook Definition.
*/
export default { title: 'Components/Media' };

const videoEmbedData = mapDataToTwig(videoEmbedProps.properties);
const videoHTML5Data = mapDataToTwig(videoHTML5Props.properties);

export const videoEmbed = () => video(videoEmbedData);
export const videoHtml5 = () => video(videoHTML5Data);
Loading