"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _AlignSelector = require("../../../../../common/AlignSelector");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __extends = void 0 && (void 0).__extends || function () {
  var _extendStatics = function extendStatics(d, b) {
    _extendStatics = Object.setPrototypeOf || {
      __proto__: []
    } instanceof Array && function (d, b) {
      d.__proto__ = b;
    } || function (d, b) {
      for (var p in b) {
        if (b.hasOwnProperty(p)) d[p] = b[p];
      }
    };

    return _extendStatics(d, b);
  };

  return function (d, b) {
    _extendStatics(d, b);

    function __() {
      this.constructor = d;
    }

    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  };
}();

var ImageTextMobile =
/** @class */
function (_super) {
  __extends(ImageTextMobile, _super);

  function ImageTextMobile() {
    var _this = _super !== null && _super.apply(this, arguments) || this; // state = {
    //   clickedGroup: '',
    // }
    // componentDidMount() {
    //   this.distroy = autorun(() => {
    //     this.setState({
    //       clickedGroup: store.clickedGroup,
    //     });
    //   });
    // }
    // componentWillUnmount() {
    //   this.distroy();
    // }


    _this.calcWidth = function (num) {
      return (100 - (num * 2 - 1)) / num + "%";
    };

    _this.getCardStyle = function (source, i) {
      var data = _this.props.data;
      var cardStyle = {
        width: _this.calcWidth(data.customize.rowNum),
        marginRight: i % data.customize.rowNum == 0 ? '2%' : 0,
        alignItems: _AlignSelector.alignItemMap[data.customize.align]
      };

      if (source.background.bgType == 'color') {
        cardStyle.backgroundColor = source.background.color;
        cardStyle.opacity = source.background.opacity ? source.background.opacity / 100 : 1;
      } else {
        cardStyle.backgroundImage = source.background.image;
        cardStyle.backgroundPosition = 'center';
      }

      return cardStyle;
    };

    return _this;
  }

  ImageTextMobile.prototype.render = function () {
    // const { data } = this.props;
    // const { ready } = this.state;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "m-image-text-mobile"
    });
  };

  ImageTextMobile.defaultProps = {
    data: {}
  };
  return ImageTextMobile;
}(_react["default"].Component);

var _default = ImageTextMobile;
exports["default"] = _default;