@atlaskit/global-search
Version:
A cross-product search component (batteries included)
56 lines (45 loc) • 2.58 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import React from 'react';
import AdvancedSearchResult from './AdvancedSearchResult';
import { ADVANCED_PEOPLE_SEARCH_RESULT_ID } from './SearchResultsUtil';
import { AnalyticsType } from '../model/Result';
var SearchPeopleItem = /*#__PURE__*/function (_React$Component) {
_inherits(SearchPeopleItem, _React$Component);
var _super = _createSuper(SearchPeopleItem);
function SearchPeopleItem() {
_classCallCheck(this, SearchPeopleItem);
return _super.apply(this, arguments);
}
_createClass(SearchPeopleItem, [{
key: "render",
value: function render() {
var _this$props = this.props,
query = _this$props.query,
icon = _this$props.icon,
text = _this$props.text,
analyticsData = _this$props.analyticsData,
isCompact = _this$props.isCompact; // key should change per search to make keyboard nav work
var key = "search_people_".concat(Date.now());
return /*#__PURE__*/React.createElement(AdvancedSearchResult, {
href: "/people/search?q=".concat(encodeURIComponent(query)),
icon: icon,
key: key,
analyticsData: analyticsData,
resultId: ADVANCED_PEOPLE_SEARCH_RESULT_ID,
text: text,
type: AnalyticsType.AdvancedSearchPeople,
target: "_blank",
isCompact: isCompact,
onClick: this.props.onClick
});
}
}]);
return SearchPeopleItem;
}(React.Component);
export { SearchPeopleItem as default };