UNPKG

@attivio/suit

Version:

Attivio SUIT, the Search UI Toolkit, is a library for creating search clients for searching the Attivio platform.

50 lines (37 loc) 2.01 kB
var _class, _temp; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import React, { Children } from 'react'; /** * A toggle component for use in DropdownButtons */ var Toggle = (_temp = _class = function (_React$Component) { _inherits(Toggle, _React$Component); function Toggle(props) { _classCallCheck(this, Toggle); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this.handleClick = _this.handleClick.bind(_this); return _this; } Toggle.prototype.handleClick = function handleClick(e) { e.preventDefault(); this.props.onClick(e); }; Toggle.prototype.render = function render() { var _props$customClassNam = this.props.customClassName, customClassName = _props$customClassNam === undefined ? '' : _props$customClassNam; var className = customClassName || 'attivio-smalltoolbar-btn'; return React.createElement( 'a', { href: true, className: className, onClick: this.handleClick }, this.props.children ); }; return Toggle; }(React.Component), _class.displayName = 'Toggle', _temp); export { Toggle as default };