mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 03:22:14 +08:00

* update eslint, tsconfig + esbuild to handle new jsx transform * remove thing that breaks the new jsx transform * remove react imports * adjust grafana-icons build * is this the correct syntax? * try this * well this was much easier than expected... * change grafana-plugin-configs webpack config * fixes * fix lockfile * fix 2 more violations * use path.resolve instead of require.resolve * remove react import * fix react imports * more fixes * remove React import * remove import React from docs * remove another react import
30 lines
790 B
TypeScript
30 lines
790 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
|
|
|
|
import { Tab, TabsBar } from '@grafana/ui';
|
|
import { GeomapLayerHover } from 'app/plugins/panel/geomap/event';
|
|
|
|
type Props = {
|
|
layers?: GeomapLayerHover[];
|
|
setActiveTabIndex: Dispatch<SetStateAction<number>>;
|
|
activeTabIndex: number;
|
|
};
|
|
|
|
export const DataHoverTabs = ({ layers, setActiveTabIndex, activeTabIndex }: Props) => {
|
|
return (
|
|
<TabsBar>
|
|
{layers &&
|
|
layers.map((g, index) => (
|
|
<Tab
|
|
key={index}
|
|
label={g.layer.getName()}
|
|
active={index === activeTabIndex}
|
|
counter={g.features.length > 1 ? g.features.length : null}
|
|
onChangeTab={() => {
|
|
setActiveTabIndex(index);
|
|
}}
|
|
/>
|
|
))}
|
|
</TabsBar>
|
|
);
|
|
};
|