"use strict";

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

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

var _common = require("../../../../../common");

var _coreUtil = require("../../../../../utils/coreUtil");

require("./index.less");

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 BannerConfigSetting =
/** @class */
function (_super) {
  __extends(BannerConfigSetting, _super);

  function BannerConfigSetting() {
    var _this = _super !== null && _super.apply(this, arguments) || this;

    _this.reRender = function () {
      (0, _coreUtil.renderPreview)();

      _this.setState({});
    };

    return _this;
  }

  BannerConfigSetting.prototype.render = function () {
    var _this = this;

    var setting = this.props.setting;
    var height = (0, _coreUtil.isPc)() ? setting.pcHeight : setting.mobileHeight;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "banner_setting"
    }, /*#__PURE__*/_react["default"].createElement(_common.Field, {
      title: "Height And Color"
    }, /*#__PURE__*/_react["default"].createElement(_common.Slider, {
      needColor: true,
      onChange: function onChange(value) {
        if ((0, _coreUtil.isPc)()) {
          setting.pcHeight = value.count;
        } else {
          setting.mobileHeight = value.count;
        }

        setting.backgroundColor = value.color;

        _this.reRender();
      },
      unit: "px",
      value: {
        count: height,
        color: setting.backgroundColor
      }
    })));
  };

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

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