Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 18, 2018 12:49
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/b572c24a3cfb3dd638a033165706bfc4 to your computer and use it in GitHub Desktop.
Save productioncoder/b572c24a3cfb3dd638a033165706bfc4 to your computer and use it in GitHub Desktop.
Youtube in React: showing description in video preview
/* ... */
render() {
/* ... */
const expanded = this.props.expanded ? 'expanded' : null;
const description = this.props.expanded ? video.snippet.description : null;
return (
<Link to={{pathname: this.props.pathname, search: this.props.search}}>
<div className={['video-preview', horizontal, expanded].join(' ')}>
{/* ... */}
<div className='video-info'>
<div className={['semi-bold', 'show-max-two-lines', expanded].join(' ')}>{video.snippet.title}</div>
<div className='video-preview-metadata-container'>
<div className='channel-title'>{video.snippet.channelTitle}</div>
<div className='view-and-time'>{viewAndTimeString}</div>
<div className='show-max-two-lines'>{description}</div>
</div>
</div>
</div>
</Link>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment