Vulcan/packages/vulcan-base-components/lib/comments/CommentsNode.jsx

21 lines
718 B
React
Raw Normal View History

2017-03-23 16:27:59 +09:00
import { Components, registerComponent } from 'meteor/vulcan:core';
2017-05-19 14:42:43 -06:00
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
2016-02-18 17:53:04 +09:00
const CommentsNode = ({ comment, currentUser }) =>
<div className="comments-node">
<Components.CommentsItem currentUser={currentUser} comment={comment} key={comment._id} />
{comment.childrenResults ?
2016-11-09 11:55:12 +09:00
<div className="comments-children">
{comment.childrenResults.map(comment => <CommentsNode currentUser={currentUser} comment={comment} key={comment._id} />)}
2016-02-18 17:53:04 +09:00
</div>
: null
}
</div>
2016-03-17 17:48:25 +09:00
2016-04-14 10:12:35 +09:00
CommentsNode.propTypes = {
2017-05-19 14:42:43 -06:00
comment: PropTypes.object.isRequired, // the current comment
};
registerComponent('CommentsNode', CommentsNode);