Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active December 17, 2018 11:54
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/c6c05c79ce60936f24f52ff21d825b95 to your computer and use it in GitHub Desktop.
Save productioncoder/c6c05c79ce60936f24f52ff21d825b95 to your computer and use it in GitHub Desktop.
Youtube dynamic VideoPreview first version
import React from 'react';
import {Image} from 'semantic-ui-react';
import './VideoPreview.scss';
export class VideoPreview extends React.Component {
render() {
const {video} = this.props;
if (!video) {
return <div/>;
}
const horizontal = this.props.horizontal ? 'horizontal': null;
return (
<div className={['video-preview', horizontal].join(' ')}>
<div className='image-container'>
<Image src={video.snippet.thumbnails.medium.url}/>
<div className='time-label'>
<span>{video.contentDetails.duration}</span>
</div>
</div>
<div className='video-info'>
<div className='semi-bold show-max-two-lines'>{video.snippet.title}</div>
<div className='video-preview-metadata-container'>
<div className='channel-title'>{video.snippet.channelTitle}</div>
<div><span>{video.statistics.viewCount} views • {video.snippet.publishedAt}</span></div>
</div>
</div>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment