mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
44
src/containers/UniversalSearch/components.js
Normal file
44
src/containers/UniversalSearch/components.js
Normal file
@@ -0,0 +1,44 @@
|
||||
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 (
|
||||
<MenuItem
|
||||
active={modifiers.active}
|
||||
disabled={modifiers.disabled}
|
||||
text={
|
||||
<div>
|
||||
<div>{highlightText(item.text, query)}</div>
|
||||
|
||||
{item.subText && (
|
||||
<span class="bp3-text-muted">
|
||||
{highlightText(item.subText, query)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
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);
|
||||
};
|
||||
Reference in New Issue
Block a user