import _extends from 'babel-runtime/helpers/extends';
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 WcnSkuItemMagic = function (_React$Component) {
    _inherits(WcnSkuItemMagic, _React$Component);

    function WcnSkuItemMagic(props) {
        _classCallCheck(this, WcnSkuItemMagic);

        return _possibleConstructorReturn(this, (WcnSkuItemMagic.__proto__ || Object.getPrototypeOf(WcnSkuItemMagic)).call(this, props));
    }

    _createClass(WcnSkuItemMagic, [{
        key: 'render',
        value: function render() {
            var _props = this.props,
                data = _props.data,
                style = _props.style,
                imgStyle = _props.imgStyle,
                clickItem = _props.clickItem;

            if (!data) {
                return React.createElement(React.Fragment, null);
            }
            return React.createElement(
                'div',
                { onClick: function onClick() {
                        return clickItem(data);
                    }, className: 'wcn-sku-item-magic-warp', style: _extends({}, style) },
                React.createElement(
                    'div',
                    null,
                    React.createElement('img', { className: 'wcn-sku-item-img', style: _extends({}, imgStyle), 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 WcnSkuItemMagic;
}(React.Component);

export default WcnSkuItemMagic;