mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* Chore: Remove some IconName type assertions * fix actually importing the function * fix lint * fix lint
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),
|
|
}),
|
|
};
|
|
};
|