Fix: Tab icons not showing (#21465)

* revert back to i element

* snap
This commit is contained in:
Peter Holmberg 2020-01-13 13:53:39 +01:00 committed by GitHub
parent 30eef76162
commit 891b84e986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 5 deletions

View File

@ -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>
);

View File

@ -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) => {

View File

@ -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)}
/>
);

View File

@ -100,6 +100,9 @@ exports[`ServerStats Should render table with stats 1`] = `
className="css-b418eg"
onClick={[Function]}
>
<i
className="icon"
/>
Admin
</li>
</ul>