"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _uiIcons = require("@teamleader/ui-icons");

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

var _badgedLink = _interopRequireDefault(require("../badgedLink"));

var _box = require("../box");

var _container = _interopRequireDefault(require("../container"));

var _section = _interopRequireDefault(require("../section"));

var _typography = require("../typography");

var _theme = _interopRequireDefault(require("./theme.css"));

var _excluded = ["backLinkProps", "children", "title", "titleColor", "titleSuffix"];

var DetailPageHeader = function DetailPageHeader(_ref) {
  var backLinkProps = _ref.backLinkProps,
      children = _ref.children,
      title = _ref.title,
      _ref$titleColor = _ref.titleColor,
      titleColor = _ref$titleColor === void 0 ? 'teal' : _ref$titleColor,
      titleSuffix = _ref.titleSuffix,
      others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  return /*#__PURE__*/_react.default.createElement(_container.default, (0, _extends2.default)({}, others, {
    element: _section.default
  }), /*#__PURE__*/_react.default.createElement(_box.Box, {
    className: _theme.default['header-inner'],
    display: "flex"
  }, backLinkProps && /*#__PURE__*/_react.default.createElement(_typography.TextBody, {
    className: _theme.default['back-link']
  }, /*#__PURE__*/_react.default.createElement(_badgedLink.default, (0, _extends2.default)({}, backLinkProps, {
    icon: /*#__PURE__*/_react.default.createElement(_uiIcons.IconArrowLeftSmallOutline, null),
    inherit: false
  }))), /*#__PURE__*/_react.default.createElement(_box.Box, {
    flex: "1 0 200px",
    paddingTop: 5,
    overflow: "hidden"
  }, /*#__PURE__*/_react.default.createElement(_box.Box, {
    alignItems: "center",
    display: "flex"
  }, /*#__PURE__*/_react.default.createElement(_typography.Heading1, {
    color: titleColor,
    maxLines: 1,
    tint: titleColor === 'neutral' ? 'dark' : 'darkest',
    title: typeof title === 'string' ? title : undefined
  }, title), titleSuffix && /*#__PURE__*/_react.default.createElement(_box.Box, {
    marginLeft: 3
  }, titleSuffix))), children && /*#__PURE__*/_react.default.createElement(_box.Box, {
    flex: "0 0 auto",
    display: "flex",
    paddingLeft: 7
  }, children)));
};

DetailPageHeader.displayName = 'DetailPage.Header';
var _default = DetailPageHeader;
exports.default = _default;