Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.