mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
parent
30eef76162
commit
891b84e986
@ -1,14 +1,12 @@
|
||||
import React, { FC } from 'react';
|
||||
import { cx } from 'emotion';
|
||||
import { Icon } from '..';
|
||||
import { useTheme } from '../../themes';
|
||||
import { IconType } from '../Icon/types';
|
||||
import { getTabsStyle } from './styles';
|
||||
|
||||
export interface TabProps {
|
||||
label: string;
|
||||
active?: boolean;
|
||||
icon?: IconType;
|
||||
icon?: string;
|
||||
onChangeTab: () => void;
|
||||
}
|
||||
|
||||
@ -18,7 +16,7 @@ export const Tab: FC<TabProps> = ({ label, active, icon, onChangeTab }) => {
|
||||
|
||||
return (
|
||||
<li className={cx(tabsStyles.tabItem, active && tabsStyles.activeStyle)} onClick={onChangeTab}>
|
||||
{icon && <Icon name={icon} />}
|
||||
{icon && <i className={icon} />}
|
||||
{label}
|
||||
</li>
|
||||
);
|
||||
|
@ -26,7 +26,12 @@ const tabs = [
|
||||
export const Simple = () => {
|
||||
const VISUAL_GROUP = 'Visual options';
|
||||
// ---
|
||||
const icon = select('Icon', { None: undefined, Heart: 'heart', Star: 'star', User: 'user' }, undefined, VISUAL_GROUP);
|
||||
const icon = select(
|
||||
'Icon',
|
||||
{ None: undefined, Heart: 'fa fa-heart', Star: 'fa fa-star', User: 'fa fa-user' },
|
||||
undefined,
|
||||
VISUAL_GROUP
|
||||
);
|
||||
return (
|
||||
<UseState initialState={tabs}>
|
||||
{(state, updateState) => {
|
||||
|
@ -64,6 +64,7 @@ const Navigation = ({ main }: { main: NavModelItem }) => {
|
||||
label={child.text}
|
||||
active={child.active}
|
||||
key={`${child.url}-${index}`}
|
||||
icon={child.icon}
|
||||
onChangeTab={() => goToUrl(index)}
|
||||
/>
|
||||
);
|
||||
|
@ -100,6 +100,9 @@ exports[`ServerStats Should render table with stats 1`] = `
|
||||
className="css-b418eg"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<i
|
||||
className="icon"
|
||||
/>
|
||||
Admin
|
||||
</li>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user