import React from 'react'; import { MenuItem } from '@blueprintjs/core'; import { highlightText } from 'utils'; import { getUniversalSearchBind } from './utils'; /** * Default univesal search item component. */ function UniversalSearchItemDetail(item, { handleClick, modifiers, query }) { return (
{highlightText(item.text, query)}
{item.subText && ( {highlightText(item.subText, query)} )} } label={item.label ? highlightText(item.label, query) : ''} onClick={handleClick} /> ); } /** * * @param {*} props * @param {*} actions * @returns */ export const DashboardUniversalSearchItem = (props, actions) => { const itemRenderer = getUniversalSearchBind(props._type, 'itemRenderer'); return typeof itemRenderer !== 'undefined' ? itemRenderer(props, actions) : UniversalSearchItemDetail(props, actions); };