grafana/public/app/core/components/sidemenu/TopSection.tsx
Torkel Ödegaard 1d689888b0
Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files

* Update eslint plugin

* updated files
2021-01-20 07:59:48 +01:00

30 lines
820 B
TypeScript

import React, { FC } from 'react';
import _ from 'lodash';
import TopSectionItem from './TopSectionItem';
import config from '../../config';
import { getLocationSrv } from '@grafana/runtime';
const TopSection: FC<any> = () => {
const navTree = _.cloneDeep(config.bootData.navTree);
const mainLinks = _.filter(navTree, (item) => !item.hideFromMenu);
const searchLink = {
text: 'Search',
icon: 'search',
};
const onOpenSearch = () => {
getLocationSrv().update({ query: { search: 'open' }, partial: true });
};
return (
<div className="sidemenu__top">
<TopSectionItem link={searchLink} onClick={onOpenSearch} />
{mainLinks.map((link, index) => {
return <TopSectionItem link={link} key={`${link.id}-${index}`} />;
})}
</div>
);
};
export default TopSection;