Created
November 17, 2018 08:55
-
-
Save productioncoder/3a6a612a009faf39bd5980f1b0a9a6a4 to your computer and use it in GitHub Desktop.
Youtube in React: make single comment dynamic
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
export function Comment(props) { | |
if (!props.comment) { | |
return <div/>; | |
} | |
const topLevelComment = props.comment.snippet.topLevelComment; | |
const {authorProfileImageUrl, authorDisplayName, textOriginal} = topLevelComment.snippet; | |
const likeCount = topLevelComment.snippet.likeCount; | |
return ( | |
<div className='comment'> | |
<Image className='user-image' src={authorProfileImageUrl} circular /> | |
<div> | |
<div className='user-name'>{authorDisplayName}</div> | |
<span>{textOriginal}</span> | |
<div className='comment-actions'> | |
<Rating likeCount={likeCount}/> <Button size='mini' compact>REPLY</Button> | |
</div> | |
</div> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment