import React from 'react'; import PropTypes from 'prop-types'; import { Icon } from '../coral-ui'; import styles from './Comment.css'; import Slot from 'coral-framework/components/Slot'; import CommentTimestamp from 'coral-framework/components/CommentTimestamp'; import CommentContent from 'coral-framework/components/CommentContent'; import cn from 'classnames'; import { getTotalReactionsCount } from 'coral-framework/utils'; import t from 'coral-framework/services/i18n'; class Comment extends React.Component { render() { const { comment, link, data, root } = this.props; const reactionCount = getTotalReactionsCount(comment.action_summaries); const queryData = { root, comment, asset: comment.asset }; return (
{reactionCount} {reactionCount === 1 ? t('common.reaction') : t('common.reactions')} {comment.replyCount} {comment.replyCount === 1 ? t('common.reply') : t('common.replies')}
{t('common.story')}:{' '} {comment.asset.title ? comment.asset.title : comment.asset.url}
); } } Comment.propTypes = { comment: PropTypes.shape({ id: PropTypes.string, body: PropTypes.string, }).isRequired, }; export default Comment;