'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _fdx = require('@whalecloud/fdx');

var _goodsTags = require('../goods-tags');

var _goodsTags2 = _interopRequireDefault(_goodsTags);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var GoodsInfo = function (_React$Component) {
    (0, _inherits3['default'])(GoodsInfo, _React$Component);

    function GoodsInfo() {
        (0, _classCallCheck3['default'])(this, GoodsInfo);

        var _this = (0, _possibleConstructorReturn3['default'])(this, (GoodsInfo.__proto__ || Object.getPrototypeOf(GoodsInfo)).apply(this, arguments));

        _this.handleGoStore = function (e) {
            e.stopPropagation();
            _this.props.onStoreClick();
        };
        return _this;
    }

    (0, _createClass3['default'])(GoodsInfo, [{
        key: 'render',
        value: function render() {
            var _this2 = this;

            var _props = this.props,
                data = _props.data,
                onDetailClick = _props.onDetailClick;

            return _react2['default'].createElement(
                'div',
                { className: 'info-wrap', onClick: function onClick() {
                        return onDetailClick && onDetailClick();
                    } },
                _react2['default'].createElement(
                    'div',
                    { className: 'justify' },
                    _react2['default'].createElement(
                        'span',
                        { className: 'price' },
                        data.price
                    ),
                    data.discount === '$ 0.00' ? null : _react2['default'].createElement(
                        'span',
                        { className: 'discount' },
                        _react2['default'].createElement('span', null),
                        data.discount
                    )
                ),
                _react2['default'].createElement(
                    'p',
                    { className: 'name' },
                    _react2['default'].createElement('span', null),
                    data.productName
                ),
                _react2['default'].createElement(
                    'div',
                    { className: 'justify' },
                    _react2['default'].createElement(
                        'div',
                        { className: 'stars' },
                        _react2['default'].createElement(_fdx.Rate, { allowHalf: true, disabled: true, defaultValue: data.stars, style: { fontSize: 12 } })
                    ),
                    _react2['default'].createElement(
                        'span',
                        { className: 'reviews' },
                        data.reviews,
                        ' Sold'
                    )
                ),
                _react2['default'].createElement(
                    'p',
                    { className: 'store', onClick: function onClick(e) {
                            return _this2.handleGoStore(e);
                        } },
                    data.store
                ),
                _react2['default'].createElement(
                    'div',
                    { className: 'tags' },
                    _react2['default'].createElement(_goodsTags2['default'], { data: data.tags })
                )
            );
        }
    }]);
    return GoodsInfo;
}(_react2['default'].Component);

exports['default'] = GoodsInfo;
module.exports = exports['default'];