"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HeaderContent = void 0;
var _isNil2 = _interopRequireDefault(require("ramda/src/isNil"));
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _TextWrapper = require("./TextWrapper");
var _constants = require("../../shared/constants");
var _SortIcon = require("./SortIcon");
var _SortButton = require("./SortButton");
var _ = require("../../../..");
var _shared = require("../../shared");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var StyledFlexboxContainer = (0, _styledComponents.default)(_.Flexbox).withConfig({
  displayName: "HeaderContent__StyledFlexboxContainer",
  componentId: "sc-139a6jz-0"
})(["justify-content:inherit;"]);
var HeaderContent = exports.HeaderContent = function HeaderContent(_ref) {
  var sortable = _ref.sortable,
    sortOrder = _ref.sortOrder,
    onSortClick = _ref.onSortClick,
    children = _ref.children;
  if (!sortable || sortOrder === null) {
    return _react.default.createElement(_TextWrapper.TextWrapper, {
      sorted: false
    }, children);
  }
  return _react.default.createElement(_SortButton.SortButton, {
    onClick: onSortClick
  }, _react.default.createElement(StyledFlexboxContainer, {
    container: true
  }, _react.default.createElement(_shared.CellInlineContainer, {
    item: true
  }, _react.default.createElement(_TextWrapper.TextWrapper, {
    sorted: !(0, _isNil2.default)(sortOrder) && sortOrder !== _constants.SORT_ORDER_NONE
  }, children)), _react.default.createElement(_.Flexbox, {
    item: true
  }, _react.default.createElement(_SortIcon.SortIcon, {
    sortOrder: sortOrder
  }))));
};