Skip to content

Commit

Permalink
refactor: icon to icons for navbar (apache#15643)
Browse files Browse the repository at this point in the history
* initial commit

* remove code
  • Loading branch information
pkdotson authored and cccs-RyanS committed Dec 17, 2021
1 parent ad20e8a commit b96bf00
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
11 changes: 7 additions & 4 deletions superset-frontend/src/common/components/index.tsx
Expand Up @@ -181,11 +181,14 @@ export const StyledSubMenu = styled(AntdMenu.SubMenu)`
& > .ant-menu-submenu-title {
padding: 0 ${({ theme }) => theme.gridUnit * 6}px 0
${({ theme }) => theme.gridUnit * 3}px !important;
svg {
span[role='img'] {
position: absolute;
top: ${({ theme }) => theme.gridUnit * 4 + 7}px;
right: ${({ theme }) => theme.gridUnit}px;
width: ${({ theme }) => theme.gridUnit * 6}px;
right: ${({ theme }) => -theme.gridUnit + -2}px;
top: ${({ theme }) => theme.gridUnit * 5.25}px;
svg {
font-size: ${({ theme }) => theme.gridUnit * 6}px;
color: ${({ theme }) => theme.colors.grayscale.base};
}
}
& > span {
position: relative;
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/components/Menu/LanguagePicker.tsx
Expand Up @@ -19,7 +19,7 @@
import React from 'react';
import { MainNav as Menu } from 'src/common/components';
import { styled } from '@superset-ui/core';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';

const { SubMenu } = Menu;

Expand Down Expand Up @@ -66,7 +66,7 @@ export default function LanguagePicker(props: LanguagePickerProps) {
<StyledFlag className={`flag ${languages[locale].flag}`} />
</div>
}
icon={<Icon name="triangle-down" />}
icon={<Icons.TriangleDown />}
{...rest}
>
{Object.keys(languages).map(langKey => (
Expand Down
8 changes: 6 additions & 2 deletions superset-frontend/src/components/Menu/Menu.tsx
Expand Up @@ -24,7 +24,7 @@ import { getUrlParam } from 'src/utils/urlUtils';
import { MainNav as DropdownMenu, MenuMode } from 'src/common/components';
import { Link } from 'react-router-dom';
import { Row, Col, Grid } from 'antd';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import RightMenu from './MenuRight';
import { Languages } from './LanguagePicker';
import { URL_PARAMS } from '../../constants';
Expand Down Expand Up @@ -189,7 +189,11 @@ export function Menu({
);
}
return (
<SubMenu key={index} title={label} icon={<Icon name="triangle-down" />}>
<SubMenu
key={index}
title={label}
icon={showMenu === 'inline' ? <></> : <Icons.TriangleDown />}
>
{childs?.map((child: MenuObjectChildProps | string, index1: number) => {
if (typeof child === 'string' && child === '-') {
return <DropdownMenu.Divider key={`$${index1}`} />;
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/components/Menu/MenuRight.tsx
Expand Up @@ -20,7 +20,7 @@ import React from 'react';
import { MainNav as Menu } from 'src/common/components';
import { t, styled, css, SupersetTheme } from '@superset-ui/core';
import { Link } from 'react-router-dom';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import LanguagePicker from './LanguagePicker';
import { NavBarProps, MenuObjectProps } from './Menu';

Expand Down Expand Up @@ -92,7 +92,7 @@ const RightMenu = ({
title={
<StyledI data-test="new-dropdown-icon" className="fa fa-plus" />
}
icon={<Icon name="triangle-down" />}
icon={<Icons.TriangleDown />}
>
{dropdownItems.map(menu => (
<Menu.Item key={menu.label}>
Expand All @@ -107,7 +107,7 @@ const RightMenu = ({
))}
</SubMenu>
)}
<SubMenu title="Settings" icon={<Icon name="triangle-down" />}>
<SubMenu title="Settings" icon={<Icons.TriangleDown iconSize="xl" />}>
{settings.map((section, index) => [
<Menu.ItemGroup key={`${section.label}`} title={section.label}>
{section.childs?.map(child => {
Expand Down

0 comments on commit b96bf00

Please sign in to comment.