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
@@ -3,7 +3,6 @@ import React, {PropTypes} from 'react';
import PermalinkButton from 'coral-plugin-permalinks/PermalinkButton';
import AuthorName from 'coral-plugin-author-name/AuthorName';
import TagLabel from 'coral-plugin-tag-label/TagLabel';
import Content from 'coral-plugin-commentcontent/CommentContent';
import PubDate from 'coral-plugin-pubdate/PubDate';
import {ReplyBox, ReplyButton} from 'coral-plugin-replies';
import FlagComment from 'coral-plugin-flags/FlagComment';
@@ -466,8 +465,7 @@ export default class Comment extends React.Component {
stopEditing={this.stopEditing}
/>
: <div>
<Content body={comment.body} />
<Slot fill="commentContent" />
<Slot fill="commentContent" comment={comment} />
</div>
}
@@ -1,17 +0,0 @@
import React from 'react';
const name = 'coral-plugin-commentcontent';
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;
@@ -1,11 +0,0 @@
import React from 'react';
import {shallow} from 'enzyme';
import {expect} from 'chai';
import CommentContent from '../CommentContent';
describe('CommentContent', () => {
it('should render content', () => {
const render = shallow(<CommentContent content="test"/>);
expect(render.contains('test')).to.be.truthy;
});
});
+4 -3
View File
@@ -1,8 +1,8 @@
import React, {PropTypes} from 'react';
import {Icon} from '../coral-ui';
import styles from './Comment.css';
import Slot from 'coral-framework/components/Slot';
import PubDate from '../coral-plugin-pubdate/PubDate';
import Content from '../coral-plugin-commentcontent/CommentContent';
import t from 'coral-framework/services/i18n';
@@ -10,9 +10,10 @@ const Comment = (props) => {
return (
<div className={styles.myComment}>
<div>
<Content
<Slot
fill="commentContent"
className={`${styles.commentBody} myCommentBody`}
body={props.comment.body}
comment={props.comment}
/>
<p className="myCommentAsset">
<a