mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 18:13:32 -06:00
* remove old page component * add test to check initDashboard is only called once (prevent variables loading twice) * add help node * update unit tests * remove last mentions of topnav * fix unit tests * remove unused props from ButtonRow interface * remove prop from test
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import { css } from '@emotion/css';
|
|
import React from 'react';
|
|
|
|
import { NavModelItem, GrafanaTheme2 } from '@grafana/data';
|
|
import { useStyles2, TabsBar, Tab, toIconName } from '@grafana/ui';
|
|
|
|
export interface Props {
|
|
navItem: NavModelItem;
|
|
}
|
|
|
|
export function PageTabs({ navItem }: Props) {
|
|
const styles = useStyles2(getStyles);
|
|
|
|
return (
|
|
<div className={styles.tabsWrapper}>
|
|
<TabsBar>
|
|
{navItem.children!.map((child, index) => {
|
|
const icon = child.icon ? toIconName(child.icon) : undefined;
|
|
return (
|
|
!child.hideFromTabs && (
|
|
<Tab
|
|
label={child.text}
|
|
active={child.active}
|
|
key={`${child.url}-${index}`}
|
|
icon={icon}
|
|
href={child.url}
|
|
suffix={child.tabSuffix}
|
|
/>
|
|
)
|
|
);
|
|
})}
|
|
</TabsBar>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const getStyles = (theme: GrafanaTheme2) => {
|
|
return {
|
|
tabsWrapper: css({
|
|
paddingBottom: theme.spacing(3),
|
|
}),
|
|
};
|
|
};
|