"use strict";

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

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

var _compileClassNames5 = _interopRequireDefault(require("../../libraries/compileClassNames"));

var _Box = _interopRequireDefault(require("../layout/Box"));

var _Text = _interopRequireDefault(require("../text/Text"));

var _Dialog = require("./Dialog.propTypes");

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

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; }

function Header(props) {
  var defaultCustomId = "header";
  var children = props.children,
      _props$customClassNam = props.customClassNames,
      customClassNames = _props$customClassNam === void 0 ? {} : _props$customClassNam,
      cancelIcon = props.cancelIcon,
      onClose = props.onClose; // let headerStyle = customClassNames.header ? customClassNames.header : '';
  // let containerStyle = cancelIcon ? (customClassNames.container ? customClassNames.container : '') : '';
  // let textStyle = cancelIcon ? (customClassNames.label ? customClassNames.label : '') : '';
  // let iconStyle = cancelIcon ? (customClassNames.icon ? customClassNames.icon : '') : '';

  var headerStyle = (0, _compileClassNames5["default"])(_defineProperty({}, customClassNames.header, !!customClassNames.header)),
      containerStyle = (0, _compileClassNames5["default"])(_defineProperty({}, customClassNames.container, !!customClassNames.container)),
      textStyle = (0, _compileClassNames5["default"])(_defineProperty({}, customClassNames.label, !!customClassNames.label)),
      iconStyle = (0, _compileClassNames5["default"])(_defineProperty({}, customClassNames.icon, !!customClassNames.icon));
  return cancelIcon ? /*#__PURE__*/_react["default"].createElement(_Box["default"], {
    dataId: defaultCustomId,
    className: headerStyle
  }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
    className: containerStyle,
    align: "vertical",
    alignBox: "row",
    isCover: false,
    wrap: "wrap"
  }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
    flexible: true,
    basis: true,
    className: textStyle
  }, typeof children == 'string' ? /*#__PURE__*/_react["default"].createElement(_Text["default"], {
    content: children,
    weight: "bold",
    size: "sm",
    tagName: "h4"
  }) : children), /*#__PURE__*/_react["default"].createElement(_Box["default"], {
    className: iconStyle
  }, typeof cancelIcon == 'boolean' ? /*#__PURE__*/_react["default"].createElement(_Text["default"], {
    content: "X",
    weight: "bold",
    size: "lg",
    onClick: onClose
  }) : cancelIcon))) : /*#__PURE__*/_react["default"].createElement(_Box["default"], {
    dataId: defaultCustomId,
    className: headerStyle
  }, typeof children == 'string' ? /*#__PURE__*/_react["default"].createElement(_Text["default"], {
    content: children,
    weight: "bold",
    size: "lg"
  }) : children);
}

Header.propTypes = _Dialog.headerPropTypes;