import React__default, { useContext } from 'react';
import { a as LocalizationContext } from '../../LocalizationContext-57b46f6c.js';
import useSendbirdStateContext from '../../useSendbirdStateContext.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-4023d1b2.js';
import Avatar from '../../ui/Avatar.js';
import '../../stringSet-7a8ce1ce.js';
import '../../index-865112db.js';
import '../../withSendbird.js';
import '../../_rollupPluginBabelHelpers-0bc76382.js';
import 'prop-types';
import '../../ui/ImageRenderer.js';
import '../../ui/Icon.js';
import '../../uuid-1f1bbd9c.js';

const ChannelListHeader = _ref => {
  let {
    renderHeader,
    renderTitle,
    renderIconButton,
    onEdit,
    allowProfileEdit
  } = _ref;
  const {
    stores,
    config
  } = useSendbirdStateContext();
  const {
    user
  } = stores.userStore;
  const {
    logger
  } = config;
  const {
    stringSet
  } = useContext(LocalizationContext);
  if (renderHeader) {
    logger === null || logger === void 0 ? void 0 : logger.warning('Recomend to use "renderTitle" instead of "renderHeader". It will be deprecated.');
  }
  // renderTitle should have higher priority
  const titleRenderer = renderHeader || renderTitle;
  return /*#__PURE__*/React__default.createElement("div", {
    className: ['sendbird-channel-header', allowProfileEdit ? 'sendbird-channel-header--allow-edit' : ''].join(' ')
  }, (titleRenderer === null || titleRenderer === void 0 ? void 0 : titleRenderer()) || /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-channel-header__title",
    role: "button",
    onClick: () => {
      onEdit === null || onEdit === void 0 ? void 0 : onEdit();
    },
    onKeyDown: () => {
      onEdit === null || onEdit === void 0 ? void 0 : onEdit();
    },
    tabIndex: 0
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-channel-header__title__left"
  }, /*#__PURE__*/React__default.createElement(Avatar, {
    width: "32px",
    height: "32px",
    src: user.profileUrl,
    alt: user.nickname
  })), /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-channel-header__title__right"
  }, /*#__PURE__*/React__default.createElement(Label, {
    className: "sendbird-channel-header__title__right__name",
    type: LabelTypography.SUBTITLE_2,
    color: LabelColors.ONBACKGROUND_1
  }, user.nickname || stringSet.NO_NAME), /*#__PURE__*/React__default.createElement(Label, {
    className: "sendbird-channel-header__title__right__user-id",
    type: LabelTypography.BODY_2,
    color: LabelColors.ONBACKGROUND_2
  }, user.userId))), /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-channel-header__right-icon"
  }, renderIconButton === null || renderIconButton === void 0 ? void 0 : renderIconButton()));
};

export { ChannelListHeader as default };
//# sourceMappingURL=ChannelListHeader.js.map
