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
|
|
|
|
2017-06-18 16:05:30 +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">
|
2017-06-18 16:05:30 +09:00
|
|
|
{comment.childrenResults.map(comment => <CommentsNode currentUser={currentUser} comment={comment} key={comment._id} />)}
|
2016-02-18 17:53:04 +09:00
|
|
|
</div>
|
2017-06-18 16:05:30 +09:00
|
|
|
: 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
|
2016-10-14 08:47:18 +02:00
|
|
|
};
|
|
|
|
|
2016-12-08 23:48:16 +01:00
|
|
|
registerComponent('CommentsNode', CommentsNode);
|