"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _icon = require("antd/es/icon"); var _icon2 = _interopRequireDefault(_icon); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); require("antd/es/icon/style/css"); var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _Comment = require("../../Comment"); var _Comment2 = _interopRequireDefault(_Comment); var _CommentInput = require("../CommentInput"); var _CommentInput2 = _interopRequireDefault(_CommentInput); require("./index.css"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // import PropTypes from 'prop-type'; var ReplyItem = function (_Component) { _inherits(ReplyItem, _Component); function ReplyItem(props) { _classCallCheck(this, ReplyItem); var _this = _possibleConstructorReturn(this, (ReplyItem.__proto__ || Object.getPrototypeOf(ReplyItem)).call(this, props)); _this.state = { showInput: false }; _this.handleToggleInput = _this.handleToggleInput.bind(_this); return _this; } _createClass(ReplyItem, [{ key: "handleToggleInput", value: function handleToggleInput() { this.setState({ showInput: !this.state.showInput }); } }, { key: "render", value: function render() { var _props = this.props, commentId = _props.commentId, replyItem = _props.replyItem, action = _props.action, app = _props.app; var replyId = replyItem.id; // console.log('replyId', replyId); var showInput = this.state.showInput; return _react2.default.createElement( "div", { className: "reply-item" }, _react2.default.createElement( "div", { className: "reply-item-content" }, "@", _react2.default.createElement( "strong", null, replyItem.user_name ), replyItem.reply ? " \u56DE\u590D @" + replyItem.reply.user_name : null, ": \xA0", replyItem.content ), _react2.default.createElement( "div", { className: "reply-item-icon" }, _react2.default.createElement( "span", { className: "reply-item-span" }, _react2.default.createElement(_icon2.default, { type: "heart", onClick: function onClick() { // 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" }), "\xA0 ", replyItem.favor_count ), _react2.default.createElement( "span", { className: "reply-item-span" }, _react2.default.createElement(_icon2.default, { type: "message", onClick: this.handleToggleInput }), " \xA0", " ", replyItem.reply_count || 0 ) ), showInput && _react2.default.createElement(_CommentInput2.default, { content: app.children, action: action, replyId: replyId, commentId: commentId, callback: this.handleToggleInput }) ); } }]); return ReplyItem; }(_react.Component); exports.default = (0, _Comment2.default)(ReplyItem); //# sourceMappingURL=index.js.map