Created
November 18, 2018 12:49
-
-
Save productioncoder/b572c24a3cfb3dd638a033165706bfc4 to your computer and use it in GitHub Desktop.
Youtube in React: showing description in video preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
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