optimizely-oui
Version:
Optimizely's Component Library.
33 lines (29 loc) • 1.25 kB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import PropTypes from "prop-types";
import React from "react";
import classNames from "classnames";
import ToolbarItemContents from "../ToolbarItemContents";
var ToolbarLink = function ToolbarLink(props, context) {
var _classNames;
return React.createElement("a", {
className: classNames((_classNames = {
flex: true,
toolbar__button: true,
"is-active": props.isActive
}, _defineProperty(_classNames, "link--disabled", props.isDisabled), _defineProperty(_classNames, "pointer-events--none", props.isDisabled), _classNames)),
"data-test-section": props.testSection,
href: props.href
}, ToolbarItemContents(props));
};
ToolbarLink.propTypes = {
href: PropTypes.string,
icon: PropTypes.string,
isActive: PropTypes.bool,
isDisabled: PropTypes.bool,
isDropdown: PropTypes.bool,
label: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.node.isRequired]).isRequired,
onClick: PropTypes.func,
testSection: PropTypes.string,
title: PropTypes.string
};
export default ToolbarLink;