Adding multiline comments.

This commit is contained in:
David Jay
2016-11-07 18:09:26 -05:00
parent 47bcd163b1
commit 456524e4ee
3 changed files with 15 additions and 7 deletions
@@ -121,7 +121,7 @@ class CommentStream extends Component {
<hr aria-hidden={true}/>
<AuthorName name={comment.username}/>
<PubDate created_at={comment.created_at}/>
<Content content={comment.body}/>
<Content body={comment.body}/>
<div className="commentActions">
{
// <Flag
@@ -151,7 +151,7 @@ class CommentStream extends Component {
<hr aria-hidden={true}/>
<AuthorName name={reply.username}/>
<PubDate created_at={reply.created_at}/>
<Content content={reply.body}/>
<Content body={reply.body}/>
<div className="replyActions">
{
// <Flag
@@ -122,4 +122,5 @@ hr {
.coral-plugin-pubdate-text {
color: #CCC;
display: inline-block;
}
@@ -1,10 +1,17 @@
import React from 'react'
const name = 'coral-plugin-replies'
const Content = (props) => <div
className={name + '-text'}
style={props.styles && props.styles.text}>
{props.content}
</div>
const Content = ({body, styles}) => {
const textbreaks = body.split('\n')
return <div
className={name + '-text'}
style={styles && styles.text}>
{
textbreaks.map((line, i) => <span key={i} className={name+'-line'}>
{line} <br className={name+'-linebreak'}/>
</span>)
}
</div>
}
export default Content