'use strict';

var React = require('react');
var ui_IconButton = require('../../ui/IconButton.js');
var ui_Icon = require('../../ui/Icon.js');
var ui_Label = require('../../index-2bfd366f.js');
var ui_TextButton = require('../../ui/TextButton.js');
var LocalizationContext = require('../../LocalizationContext-44d2f61b.js');
require('../../_rollupPluginBabelHelpers-21ae158b.js');
require('prop-types');
require('../../stringSet-7aebf034.js');
require('../../color-0c04efbd.js');
require('../../index-88e8fdfa.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function ThreadHeader(_ref) {
  let {
    className,
    channelName,
    renderActionIcon,
    onActionIconClick,
    onChannelNameClick
  } = _ref;
  const {
    stringSet
  } = LocalizationContext.useLocalization();
  const MemoizedActionIcon = React.useMemo(() => {
    if (typeof renderActionIcon === 'function') {
      return renderActionIcon({
        onActionIconClick
      });
    }
    return null;
  }, [renderActionIcon]);
  return /*#__PURE__*/React__default["default"].createElement("div", {
    className: `sendbird-thread-header ${className}`
  }, /*#__PURE__*/React__default["default"].createElement(ui_Label.Label, {
    className: "sendbird-thread-header__title",
    type: ui_Label.LabelTypography.H_2,
    color: ui_Label.LabelColors.ONBACKGROUND_1
  }, stringSet.THREAD__HEADER_TITLE), /*#__PURE__*/React__default["default"].createElement(ui_TextButton, {
    onClick: e => onChannelNameClick === null || onChannelNameClick === void 0 ? void 0 : onChannelNameClick(e),
    disableUnderline: true
  }, /*#__PURE__*/React__default["default"].createElement(ui_Label.Label, {
    className: "sendbird-thread-header__channel-name",
    type: ui_Label.LabelTypography.CAPTION_3,
    color: ui_Label.LabelColors.ONBACKGROUND_2
  }, channelName)), MemoizedActionIcon || /*#__PURE__*/React__default["default"].createElement("div", {
    className: "sendbird-thread-header__action"
  }, /*#__PURE__*/React__default["default"].createElement(ui_IconButton, {
    width: "32px",
    height: "32px",
    onClick: e => onActionIconClick(e)
  }, /*#__PURE__*/React__default["default"].createElement(ui_Icon["default"], {
    type: ui_Icon.IconTypes.CLOSE,
    fillColor: ui_Icon.IconColors.ON_BACKGROUND_1,
    width: "22px",
    height: "22px"
  }))));
}

module.exports = ThreadHeader;
//# sourceMappingURL=ThreadHeader.js.map
