mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* behaviour mostly there * slight performance improvement * slightly nicer... * refactor search and add it to the store * add comments about removing old component * remove unneeded logic * small design tweak * More small tweaks * Restore top margin * add onCloseSearch/onSelectSearchItem to useSearchQuery Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
25 lines
709 B
TypeScript
25 lines
709 B
TypeScript
import React, { FC, memo } from 'react';
|
|
|
|
import { config } from '@grafana/runtime';
|
|
import { useUrlParams } from 'app/core/navigation/hooks';
|
|
|
|
import { DashboardSearch } from './DashboardSearch';
|
|
import { DashboardSearchModal } from './DashboardSearchModal';
|
|
|
|
export const SearchWrapper: FC = memo(() => {
|
|
const [params] = useUrlParams();
|
|
const isOpen = params.get('search') === 'open';
|
|
const isTopnav = config.featureToggles.topnav;
|
|
|
|
return isOpen ? (
|
|
isTopnav ? (
|
|
<DashboardSearchModal isOpen={isOpen} />
|
|
) : (
|
|
// TODO: remove this component when we turn on the topnav feature toggle
|
|
<DashboardSearch />
|
|
)
|
|
) : null;
|
|
});
|
|
|
|
SearchWrapper.displayName = 'SearchWrapper';
|