import React__default, { useContext } from 'react';
import { a as LocalizationContext } from '../../LocalizationContext-426f3d58.js';
import useSendbirdStateContext from '../../useSendbirdStateContext.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../index-4105bc4d.js';
import Avatar from '../../ui/Avatar.js';
import '../../stringSet-a62108b2.js';
import '../../index-90420b99.js';
import '../../withSendbird.js';
import '../../_rollupPluginBabelHelpers-a69fd1ce.js';
import 'prop-types';
import '../../ui/ImageRenderer.js';
import '../../ui/Icon.js';
import '../../uuid-2e8efc75.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
