Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Icons): Replaces custom icons with Ant Design 5 icons #32112

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
refactor(icons): Replaces custom icons (tags, filter) with antd5 icons
  • Loading branch information
EnxDev committed Feb 2, 2025
commit 4527e1c62b873deb35f8fd8aa309bcd454fa4a19
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/
import {
styled,
t,
useTheme,
getClientErrorObject,
Expand Down
6 changes: 6 additions & 0 deletions superset-frontend/src/components/Icons/AntdEnhanced.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ import {
UserOutlined,
VerticalLeftOutlined,
VerticalRightOutlined,
NumberOutlined,
ThunderboltOutlined,
FilterOutlined,
} from '@ant-design/icons';
import { StyledIcon } from './Icon';
import IconType from './IconType';
Expand Down Expand Up @@ -142,6 +145,9 @@ const AntdIcons = {
UserOutlined,
VerticalLeftOutlined,
VerticalRightOutlined,
NumberOutlined,
ThunderboltOutlined,
FilterOutlined,
};

const AntdEnhancedIcons = Object.keys(AntdIcons)
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/components/Icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const IconFileNames = [
'bar-chart-tile',
'big-number-chart-tile',
'binoculars',
'bolt',
'bolt_small',
'bolt_small_run',
'calendar',
Expand Down Expand Up @@ -153,12 +152,13 @@ const IconFileNames = [
'warning_solid',
'x-large',
'x-small',
'tags',
'ballot',
'category',
'undo',
'redo',
// to remove
'tags',
'bolt',
];

const iconOverrides: Record<string, FC<IconType>> = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export const FiltersBadge = ({ chartId }: FiltersBadgeProps) => {
tabIndex={0}
onKeyDown={handleKeyDown}
>
<Icons.Filter iconSize="m" />
<Icons.FilterOutlined iconSize="m" />
<StyledBadge
data-test="applied-filter-count"
className="applied-count"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const FilterControls: FC<FilterControlsProps> = ({
<DropdownContainer
items={items}
dropdownTriggerIcon={
<Icons.FilterSmall
<Icons.FilterOutlined
css={css`
&& {
margin-right: -4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
FC,
} from 'react';
import cx from 'classnames';
import { styled, t } from '@superset-ui/core';
import { styled, t, useTheme } from '@superset-ui/core';
import Icons from 'src/components/Icons';
import Loading from 'src/components/Loading';
import { EmptyState } from 'src/components/EmptyState';
Expand Down Expand Up @@ -104,10 +104,6 @@ const StyledCollapseIcon = styled(Icons.Collapse)`
`}
`;

const StyledFilterIcon = styled(Icons.Filter)`
color: ${({ theme }) => theme.colors.grayscale.base};
`;

const FilterBarEmptyStateContainer = styled.div`
margin-top: ${({ theme }) => theme.gridUnit * 8}px;
`;
Expand All @@ -132,6 +128,7 @@ const VerticalFilterBar: FC<VerticalBarProps> = ({
toggleFiltersBar,
width,
}) => {
const theme = useTheme();
const [isScrolling, setIsScrolling] = useState(false);
const timeout = useRef<any>();

Expand Down Expand Up @@ -209,7 +206,8 @@ const VerticalFilterBar: FC<VerticalBarProps> = ({
{...getFilterBarTestId('expand-button')}
iconSize="l"
/>
<StyledFilterIcon
<Icons.FilterOutlined
iconColor={theme.colors.grayscale.base}
{...getFilterBarTestId('filter-icon')}
iconSize="l"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const NameRow = ({
`}
>
<InternalRow>
<Icons.FilterSmall
<Icons.FilterOutlined
iconSize="s"
css={(theme: SupersetTheme) => css`
margin-right: ${theme.gridUnit}px;
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const FilterTitlePane: FC<Props> = ({
<Button
buttonSize="default"
buttonStyle="secondary"
icon={<Icons.Filter iconSize="m" />}
icon={<Icons.FilterOutlined iconSize="m" />}
data-test="add-new-filter-button"
onClick={() => handleOnAdd(NativeFilterType.NativeFilter)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const datasourceIconLookup = {
[DatasourceType.Query]: (
<Icons.ConsoleSqlOutlined className="datasource-svg" />
),
[DatasourceType.Table]: <Icons.TableOutlined className="datasource-svg" />,
[DatasourceType.Table]: <Icons.TableOutlined className="datasource-svg" />,
};

// Render title for datasource with tooltip only if text is longer than VISIBLE_TITLE_LENGTH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ export const VizTile = ({
`}
`}
>
<span
css={
css`
padding:0px ${theme.gridUnit}px;
`
}
>{vizMeta.icon}</span>
<span
css={css`
padding: 0px ${theme.gridUnit}px;
`}
>
{vizMeta.icon}
</span>
<span
css={css`
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export default function VizTypeGallery(props: VizTypeGalleryProps) {
},
[Sections.Tags]: {
title: t('Tags'),
icon: <Icons.Tags iconSize="m" />,
icon: <Icons.NumberOutlined iconSize="m" />,
selectors: tags,
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const FEATURED_CHARTS: VizMeta[] = [
icon: <Icons.BarChartTile />,
},
{ name: VizType.Area, icon: <Icons.AreaChartTile /> },
{ name: VizType.Table, icon: <Icons.TableOutlined iconSize='l' /> },
{ name: VizType.Table, icon: <Icons.TableOutlined iconSize="l" /> },
{
name: VizType.BigNumberTotal,
icon: <Icons.BigNumberChartTile />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ const DatasetPanel = ({
title={tableName || ''}
>
{tableName && (
<Icons.DatasetPanel iconColor={theme.colors.grayscale.base} />
<Icons.TableOutlined iconColor={theme.colors.grayscale.base} />
)}
{tableName}
</StyledHeader>
Expand Down
Loading