"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;

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

var _classnames = _interopRequireDefault(require("classnames"));

var _tooltip = _interopRequireDefault(require("../../../../tooltip"));

var _openData = require("../../../../../utils/open-data");

require("./index.css");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _default(props) {
  var data = props.data,
      onRemove = props.onRemove,
      isSelectedPanel = props.isSelectedPanel;

  var onRemoveHandler = function onRemoveHandler() {
    onRemove && onRemove(props);
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "perspm-depart"
  }, /*#__PURE__*/_react["default"].createElement("span", {
    className: "perspm-depart__icon"
  }), /*#__PURE__*/_react["default"].createElement("span", {
    className: "perspm-depart__name",
    title: ""
  }, /*#__PURE__*/_react["default"].createElement(_tooltip["default"].Text, {
    text: /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
      id: data.id,
      name: data.name
    }),
    isPercent: true
  })), !isSelectedPanel ? /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("perspm-tree__selector", "perspm-tree__selector-depart")
  }) : undefined, isSelectedPanel ? /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("perspm-tree__close"),
    onClick: onRemoveHandler
  }) : undefined);
}