import React, { Component } from "react"; // import PropTypes from 'prop-type'; import { Icon } from "antd"; import Comment from "../../Comment"; import CommentInput from "../CommentInput"; import "./index.css"; class ReplyItem extends Component { constructor(props) { super(props); this.state = { showInput: false }; this.handleToggleInput = this.handleToggleInput.bind(this); } handleToggleInput() { this.setState({ showInput: !this.state.showInput }); } render() { const { commentId, replyItem, replyId, action, app } = this.props; const { showInput } = this.state; return (
@{replyItem.user_name} {replyItem.reply ? ` 回复 @${replyItem.reply.user_name}` : null}:   {replyItem.content}
{ if (replyId) { // 如果有 replyId,则说明是评论的回复 app.sReplyFavor(replyItem.id, commentId, replyItem.favored); return; } app.sCommentFavor(replyItem.id, replyItem.favored); }} className={ replyItem.favored ? "comment-favor comment-favored" : "comment-favor" } />   {replyItem.favor_count}  {" "} {replyItem.reply_count || 0}
{showInput && ( )}
); } } export default Comment(ReplyItem);