coral-plugin-commnet-content

This commit is contained in:
Belen Curcio
2017-06-12 19:09:42 -03:00
parent efc4db56d0
commit 65f7ee2ab3
16 changed files with 106 additions and 39 deletions
@@ -0,0 +1,23 @@
import React from 'react';
import isLink from '../helpers/isLink';
import Link from './Link';
const name = 'coral-plugin-comment-content';
const CommentContent = ({comment}) => {
const textbreaks = comment.body.split('\n');
return <div className={`${name}-text`}>
{
textbreaks.map((line, i) => {
return (
<span key={i} className={`${name}-line`}>
{line.split(' ').map((w) => isLink(w) ? <Link url={w} key={i} /> : ` ${w}`)}
<br className={`${name}-linebreak`}/>
</span>
);
})
}
</div>;
};
export default CommentContent;