Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active December 6, 2018 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/8a7c946e27e02424d1f3ed36faed05af to your computer and use it in GitHub Desktop.
Save productioncoder/8a7c946e27e02424d1f3ed36faed05af to your computer and use it in GitHub Desktop.
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