"use strict";

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactOuiIcons = _interopRequireDefault(require("react-oui-icons"));

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function DropdownBlockLinkText(props) {
  var testSection = props.testSection ? "block-link-text-" + props.testSection : null;
  return _react["default"].createElement("span", _extends({
    className: (0, _classnames["default"])("flex flex-justified--between", {
      "color--bad-news": props.isDestructive,
      "color--base": !props.isDestructive && props.isItemSelected
    })
  }, testSection ? {
    "data-test-section": testSection
  } : {}), props.text, props.hasExternalIcon && _react["default"].createElement("span", {
    className: "oui-dropdown__block-link--icon"
  }, _react["default"].createElement(_reactOuiIcons["default"], {
    name: "external",
    size: "small"
  })));
}

DropdownBlockLinkText.defaultProps = {
  text: null
};
DropdownBlockLinkText.propTypes = {
  /** adds external icon when true */
  hasExternalIcon: _propTypes["default"].bool,

  /** Changes text to red when true */
  isDestructive: _propTypes["default"].bool,

  /** Changes text to black when true */
  isItemSelected: _propTypes["default"].bool,

  /** test section from parent */
  testSection: _propTypes["default"].string,

  /** text, if provided */
  text: _propTypes["default"].node
};