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 { Row, Col } from '@whalecloud/fdx';
import CommodityTags from '../commodity-tags';
import CommodityStar from '../commodity-star';

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

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

        return _possibleConstructorReturn(this, (CommodityInfo.__proto__ || Object.getPrototypeOf(CommodityInfo)).apply(this, arguments));
    }

    _createClass(CommodityInfo, [{
        key: 'render',
        value: function render() {
            var _props = this.props,
                data = _props.data,
                sku = _props.sku,
                _onRateClick = _props.onRateClick,
                onTitleClick = _props.onTitleClick,
                onStoreClick = _props.onStoreClick;

            return React.createElement(
                'div',
                { className: 'commodity-info-wrap' },
                React.createElement(
                    Row,
                    { className: 'commodity-info-row', type: 'flex', justify: 'space-between' },
                    React.createElement(
                        Col,
                        { span: 24, className: 'info-price' },
                        sku && sku.price
                    ),
                    React.createElement(
                        Col,
                        { span: 24, className: 'info-title' },
                        React.createElement(
                            'span',
                            { onClick: function onClick() {
                                    return onTitleClick && onTitleClick();
                                } },
                            data && data.title
                        )
                    ),
                    React.createElement(
                        Col,
                        { span: 12, className: 'info-stars' },
                        React.createElement(CommodityStar, { data: data && data.stars, onRateClick: function onRateClick() {
                                return _onRateClick && _onRateClick();
                            } })
                    ),
                    React.createElement(
                        Col,
                        { span: 12, className: 'info-purchased' },
                        data && data.purchased,
                        '+ Purchased'
                    ),
                    React.createElement(
                        Col,
                        { span: 24, className: 'info-store' },
                        React.createElement(
                            'a',
                            { onClick: function onClick() {
                                    return onStoreClick && onStoreClick();
                                } },
                            data && data.store
                        )
                    ),
                    React.createElement(
                        Col,
                        { span: 24 },
                        React.createElement(CommodityTags, { data: data && data.tags })
                    )
                )
            );
        }
    }]);

    return CommodityInfo;
}(React.Component);

export default CommodityInfo;