UNPKG

optimizely-oui

Version:

Optimizely's Component Library.

41 lines (36 loc) 1.52 kB
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); } import React from "react"; import classNames from "classnames"; import PropTypes from "prop-types"; import Icon from "react-oui-icons"; export default function DropdownBlockLinkText(props) { var testSection = props.testSection ? "block-link-text-" + props.testSection : null; return React.createElement("span", _extends({ className: classNames("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.createElement("span", { className: "oui-dropdown__block-link--icon" }, React.createElement(Icon, { name: "external", size: "small" }))); } DropdownBlockLinkText.defaultProps = { text: null }; DropdownBlockLinkText.propTypes = { /** adds external icon when true */ hasExternalIcon: PropTypes.bool, /** Changes text to red when true */ isDestructive: PropTypes.bool, /** Changes text to black when true */ isItemSelected: PropTypes.bool, /** test section from parent */ testSection: PropTypes.string, /** text, if provided */ text: PropTypes.node };