"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _react = _interopRequireDefault(require("react"));
var _SidebarHeaderSt = require("./SidebarHeader.st.css.js");
var _constants = require("./constants");
var _Text = _interopRequireDefault(require("../Text"));
var _SidebarAPI = require("../Sidebar/SidebarAPI");
var _constants2 = require("../Sidebar/constants");
var _Box = _interopRequireDefault(require("../Box"));
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/SidebarHeader/SidebarHeader.jsx";
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
/** A header within the sidebar with title, subtitle and custom content at the bottom. */
var SidebarHeader = /*#__PURE__*/function (_React$PureComponent) {
  function SidebarHeader() {
    (0, _classCallCheck2["default"])(this, SidebarHeader);
    return _callSuper(this, SidebarHeader, arguments);
  }
  (0, _inherits2["default"])(SidebarHeader, _React$PureComponent);
  return (0, _createClass2["default"])(SidebarHeader, [{
    key: "render",
    value: function render() {
      var _this = this;
      var _this$props = this.props,
        dataHook = _this$props.dataHook,
        title = _this$props.title,
        subtitle = _this$props.subtitle,
        children = _this$props.children;
      return /*#__PURE__*/_react["default"].createElement(_SidebarAPI.SidebarContext.Consumer, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 16,
          columnNumber: 7
        }
      }, function (context) {
        var skin = context && context.getSkin() || _constants2.sidebarSkins.dark;
        return /*#__PURE__*/_react["default"].createElement("div", {
          "data-hook": dataHook,
          className: (0, _SidebarHeaderSt.st)(_SidebarHeaderSt.classes.root, {
            skin: skin
          }),
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 21,
            columnNumber: 13
          }
        }, title && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 23,
            columnNumber: 17
          }
        }, /*#__PURE__*/_react["default"].createElement(_Text["default"], {
          dataHook: _constants.dataHooks.title,
          className: _SidebarHeaderSt.classes.title,
          size: "medium",
          weight: "bold",
          ellipsis: true,
          light: skin === _constants2.sidebarSkins.dark,
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 24,
            columnNumber: 19
          }
        }, title)), subtitle && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 37,
            columnNumber: 17
          }
        }, /*#__PURE__*/_react["default"].createElement(_Text["default"], {
          dataHook: _constants.dataHooks.subtitle,
          className: _SidebarHeaderSt.classes.subtitle,
          size: "tiny",
          weight: "thin",
          ellipsis: true,
          light: skin === _constants2.sidebarSkins.dark,
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 38,
            columnNumber: 19
          }
        }, subtitle)), children && /*#__PURE__*/_react["default"].createElement("div", {
          "data-hook": _constants.dataHooks.children,
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 50,
            columnNumber: 28
          }
        }, children));
      });
    }
  }]);
}(_react["default"].PureComponent);
SidebarHeader.displayName = 'SidebarHeader';
var _default = exports["default"] = SidebarHeader;