'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _class, _temp2; /**
                     * Created by vison on 16/11/30.
                     */


var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _mxa = require('../../components/mxa');

var _imageLink = require('../constant/imageLink');

var _imageLink2 = _interopRequireDefault(_imageLink);

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var TabPaneHeader = (_temp2 = _class = function (_React$Component) {
  _inherits(TabPaneHeader, _React$Component);

  function TabPaneHeader() {
    var _ref;

    var _temp, _this, _ret;

    _classCallCheck(this, TabPaneHeader);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TabPaneHeader.__proto__ || Object.getPrototypeOf(TabPaneHeader)).call.apply(_ref, [this].concat(args))), _this), _this.renderIcon = function () {
      switch (_this.props.headerIcon) {
        case 'maskRemind':
          return _react2.default.createElement('img', { src: _imageLink2.default.home_schedule_mask_remind, alt: '\u4EFB\u52A1\u63D0\u793A', style: { padding: 10 } });
        case 'notification':
          return _react2.default.createElement('img', { src: _imageLink2.default.home_schedule_notification, alt: '\u63D0\u793A\u9875\u9762', style: { padding: 10 } });
        case 'warn':
          return _react2.default.createElement('img', { src: _imageLink2.default.home_schedule_warn, alt: '\u9884\u8B66\u9875\u9762', style: { padding: 10 } });
        case 'advice':
          return _react2.default.createElement('img', { src: _imageLink2.default.home_schedule_advice, alt: '\u5F81\u6C42\u610F\u89C1', style: { padding: 10 } });
        case 'link':
          return _react2.default.createElement('img', { src: _imageLink2.default.home_schedule_link, alt: '\u91CD\u70B9\u4FE1\u606F\u94FE\u63A5', style: { padding: 10 } });
        default:
          return _react2.default.createElement('img', { src: _imageLink2.default.home_schedule_mask_remind, alt: '\u4EFB\u52A1\u63D0\u793A', style: { padding: 10 } });
      }
    }, _this.renderUnRead = function () {
      return _react2.default.createElement(_mxa.Badge, {
        count: _this.props.unRead,
        style: { backgroundColor: '#fff', color: '#999', position: 'absolute', left: -5, top: 5 }
      });
    }, _temp), _possibleConstructorReturn(_this, _ret);
  }

  _createClass(TabPaneHeader, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        { style: { backgroundColor: this.props.bgColor, width: 100 } },
        _react2.default.createElement(
          _mxa.Row,
          { type: 'flex', justify: 'center' },
          this.renderIcon(),
          this.renderUnRead()
        ),
        _react2.default.createElement(
          _mxa.Row,
          { type: 'flex', justify: 'center' },
          _react2.default.createElement(
            'p',
            { style: { color: '#fff', paddingBottom: 10 } },
            this.props.headerText
          )
        )
      );
    }
  }]);

  return TabPaneHeader;
}(_react2.default.Component), _class.propTypes = {
  headerText: _react2.default.PropTypes.string,
  headerIcon: _react2.default.PropTypes.oneOf(['maskRemind', 'notification', 'warn', 'advice', 'link']),
  unRead: _react2.default.PropTypes.number,
  bgColor: _react2.default.PropTypes.string
}, _class.defaultProps = {
  unRead: 0,
  headerIcon: 'notification'
}, _temp2);
exports.default = TabPaneHeader;
//# sourceMappingURL=TabPaneHeader.js.map