Sha256: 93bfba1728c0b1987c36ecdc6de88d09900faa6f72bad65bea297070a98d4f57
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
import { Component, PropTypes } from 'react'; import { filter, propType } from 'graphql-anywhere'; import gql from 'graphql-tag'; import { I18n } from 'react-i18nify'; import Comment from './comment.component'; import commentThreadFragment from './comment_thread.fragment.graphql' /** * Define a collection of comments. It represents a conversation with multiple users. * @class * @augments Component * @todo It doesn't handle multiple comments yet */ class CommentThread extends Component { render() { const { comment, currentUser, votable } = this.props; return ( <div> {this._renderTitle()} <div className="comment-thread"> <Comment comment={filter(Comment.fragments.comment, comment)} currentUser={currentUser} votable={votable} isRootComment /> </div> </div> ); } /** * Render conversation title if comment has replies * @private * @returns {Void|DOMElement} - The conversation's title */ _renderTitle() { const { comment: { author, hasReplies } } = this.props; if (hasReplies) { return ( <h6 className="comment-thread__title"> { I18n.t("components.comment_thread.title", { authorName: author.name }) } </h6> ); } return null; } } CommentThread.fragments = { comment: gql` ${commentThreadFragment} ${Comment.fragments.comment} ` }; CommentThread.propTypes = { currentUser: PropTypes.shape({ name: PropTypes.string.isRequired }), comment: propType(CommentThread.fragments.comment).isRequired, votable: PropTypes.bool }; export default CommentThread;
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-comments-0.0.2 | app/frontend/comments/comment_thread.component.jsx |
decidim-0.0.2 | decidim-comments/app/frontend/comments/comment_thread.component.jsx |