function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import { Icon } from '@whalecloud/fdx';
import React from 'react';
import ProductItem from '../../../../../common/ProductItem';
import CommonTitleLayout from './common-title';
import './index.less';
export default function index(props) {
  var loading = props.loading,
      data = props.data,
      onClick = props.onClick,
      rightTxt = props.rightTxt,
      title = props.title,
      isWill = props.isWill,
      renderCountDown = props.renderCountDown;
  return /*#__PURE__*/React.createElement(React.Fragment, null, data && data.length > 0 && /*#__PURE__*/React.createElement("div", {
    className: "flash-sale-wrap"
  }, /*#__PURE__*/React.createElement(CommonTitleLayout, {
    title: title,
    isWill: isWill,
    renderCountDown: renderCountDown,
    rightTxt: rightTxt,
    onClick: onClick
  }), /*#__PURE__*/React.createElement("div", {
    className: "list"
  }, data.map(function (item) {
    return /*#__PURE__*/React.createElement(ProductItem, {
      data: _objectSpread({}, item, {
        salePercent: isWill ? 0 : item.salePercent
      }),
      key: item.id,
      onItemClick: function onItemClick() {
        return onClick("/product/detail/".concat(item.offerId, "?productId=").concat(item.sppProductId));
      }
    });
  }), loading && /*#__PURE__*/React.createElement("div", {
    className: "loading-wrap"
  }, /*#__PURE__*/React.createElement(Icon, {
    type: "loading",
    style: {
      fontSize: 32,
      color: '#abacb2',
      cursor: 'pointer'
    }
  })))));
}