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 { Tag } from '@whalecloud/fdx';
import './index.less';

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

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

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

    _createClass(WcnSkuItem, [{
        key: 'render',
        value: function render() {
            var data = this.props.data;

            if (!data) {
                return React.createElement(React.Fragment, null);
            }
            return React.createElement(
                'div',
                { className: 'wcn-sku-item-warp', onClick: function onClick() {
                        return window.location.href = data.href;
                    } },
                React.createElement(
                    'div',
                    null,
                    React.createElement('img', { className: 'wcn-sku-item-img', src: data.imgSrc })
                ),
                React.createElement(
                    'div',
                    { className: 'wcn-sku-item-description' },
                    data.name
                ),
                React.createElement(
                    'div',
                    { className: 'wcn-sku-item-layout' },
                    React.createElement(
                        'div',
                        { className: 'wcn-sku-item-price' },
                        data.price
                    ),
                    data.discount ? React.createElement(
                        'div',
                        null,
                        React.createElement(
                            Tag,
                            { color: 'red' },
                            data.discount,
                            ' off'
                        )
                    ) : null
                ),
                React.createElement(
                    'div',
                    { className: 'wcn-sku-item-costn' },
                    data.costn
                )
            );
        }
    }]);

    return WcnSkuItem;
}(React.Component);

export default WcnSkuItem;