import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
import _createClass from 'babel-runtime/helpers/createClass';
import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
import _inherits from 'babel-runtime/helpers/inherits';
import React from 'react';
import { Rate } from '@whalecloud/fdx';
import GoodsTags from '../goods-tags';

var GoodsInfo = function (_React$Component) {
    _inherits(GoodsInfo, _React$Component);

    function GoodsInfo() {
        _classCallCheck(this, GoodsInfo);

        var _this = _possibleConstructorReturn(this, (GoodsInfo.__proto__ || Object.getPrototypeOf(GoodsInfo)).apply(this, arguments));

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

    _createClass(GoodsInfo, [{
        key: 'render',
        value: function render() {
            var _this2 = this;

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

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

    return GoodsInfo;
}(React.Component);

export default GoodsInfo;