Skip to content

Instantly share code, notes, and snippets.

@productioncoder productioncoder/Video.js
Last active Dec 6, 2018

Embed
What would you like to do?
Youtube Video component first version
import React from 'react';
import './Video.scss';
const BASE_EMBED_URL = 'https://www.youtube.com/embed/';
export function Video(props) {
if (!props.id) {
return null;
}
const embedUrl = `${BASE_EMBED_URL}${props.id}`;
return (
<iframe width={'560'} height={'315'} src={embedUrl} frameBorder='0'
allow='autoplay; encrypted-media' allowFullScreen />
);
}
import React from 'react';
import './Watch.scss';
import {Video} from '../../components/Video/Video';
export class Watch extends React.Component {
render() {
return (
<div style={{maxWidth: '80%'}}>
<Video id='-7fuHEEmEjs'/>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.