2018-01-30 09:54:45 -05:00
|
|
|
var classNames = require('classnames');
|
|
|
|
var FormattedRelative = require('react-intl').FormattedRelative;
|
|
|
|
var React = require('react');
|
2017-08-31 17:05:22 -04:00
|
|
|
|
2018-01-30 09:54:45 -05:00
|
|
|
var EmojiText = require('../emoji-text/emoji-text.jsx');
|
2017-08-31 17:05:22 -04:00
|
|
|
|
|
|
|
require('./comment.scss');
|
|
|
|
|
2018-01-30 09:54:45 -05:00
|
|
|
var CommentText = React.createClass({
|
|
|
|
type: 'CommentText',
|
|
|
|
propTypes: {
|
|
|
|
comment: React.PropTypes.string.isRequired,
|
|
|
|
datetimeCreated: React.PropTypes.string,
|
|
|
|
className: React.PropTypes.string
|
|
|
|
},
|
|
|
|
render: function () {
|
|
|
|
var classes = classNames(
|
|
|
|
'comment-text',
|
|
|
|
this.props.class
|
|
|
|
);
|
|
|
|
return (
|
|
|
|
<div className={classes}>
|
|
|
|
<EmojiText className="mod-comment" text={this.props.comment} />
|
|
|
|
{typeof this.props.datetimeCreated !== 'undefined' ? [
|
|
|
|
<p className="comment-text-timestamp">
|
|
|
|
<FormattedRelative value={new Date(this.props.datetimeCreated)} />
|
|
|
|
</p>
|
|
|
|
] : []}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
2017-08-31 17:05:22 -04:00
|
|
|
|
|
|
|
module.exports = CommentText;
|