Skip to content

Commit

Permalink
refactor: icon to icons for nativeFilter components (apache#15528)
Browse files Browse the repository at this point in the history
* initial commit for cascade filters

* migrate delete icon

* Update superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CascadeFilters/CascadePopover/index.tsx

Co-authored-by: Geido <60598000+geido@users.noreply.github.com>

* add uniform style for icons

* fix lint

Co-authored-by: Geido <60598000+geido@users.noreply.github.com>
  • Loading branch information
pkdotson and geido authored Jul 7, 2021
1 parent c732d2d commit 58cda8f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* under the License.
*/
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { styled, t, DataMask } from '@superset-ui/core';
import { styled, t, DataMask, css, SupersetTheme } from '@superset-ui/core';
import Popover from 'src/components/Popover';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import { Pill } from 'src/dashboard/components/FiltersBadge/Styles';
import { DataMaskStateWithId } from 'src/dataMask/types';
import FilterControl from 'src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl';
Expand Down Expand Up @@ -61,10 +61,10 @@ const StyledTitle = styled.h4`
padding: 0;
`;

const StyledIcon = styled(Icon)`
margin-right: ${({ theme }) => theme.gridUnit}px;
color: ${({ theme }) => theme.colors.grayscale.dark1};
width: ${({ theme }) => theme.gridUnit * 4}px;
const IconStyles = (theme: SupersetTheme) => css`
margin-right: ${theme.gridUnit}px;
color: ${theme.colors.grayscale.dark1};
width: ${theme.gridUnit * 4}px;
`;

const StyledPill = styled(Pill)`
Expand Down Expand Up @@ -163,10 +163,17 @@ const CascadePopover: React.FC<CascadePopoverProps> = ({
const title = (
<StyledTitleBox>
<StyledTitle>
<StyledIcon name="edit" />
<Icons.Edit
iconSize="l"
css={(theme: SupersetTheme) => IconStyles(theme)}
/>
{t('Select parent filters')} ({allFilters.length})
</StyledTitle>
<StyledIcon name="close" onClick={() => onVisibleChange(false)} />
<Icons.Close
iconSize="l"
css={(theme: SupersetTheme) => IconStyles(theme)}
onClick={() => onVisibleChange(false)}
/>
</StyledTitleBox>
);

Expand Down Expand Up @@ -207,7 +214,7 @@ const CascadePopover: React.FC<CascadePopoverProps> = ({
<>
{filter.cascadeChildren.length !== 0 && (
<StyledPill onClick={() => onVisibleChange(true)}>
<Icon name="filter" /> {allFilters.length}
<Icons.Filter iconSize="m" /> {allFilters.length}
</StyledPill>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { PlusOutlined } from '@ant-design/icons';
import { styled, t } from '@superset-ui/core';
import React, { FC } from 'react';
import { LineEditableTabs } from 'src/components/Tabs';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import { FilterRemoval } from './types';
import { REMOVAL_DELAY_SECS } from './utils';

Expand Down Expand Up @@ -51,7 +51,7 @@ export const StyledAddFilterBox = styled.div`
}
`;

export const StyledTrashIcon = styled(Icon)`
export const StyledTrashIcon = styled(Icons.Trash)`
color: ${({ theme }) => theme.colors.grayscale.light3};
`;

Expand Down Expand Up @@ -124,14 +124,13 @@ const FilterTabsContainer = styled(LineEditableTabs)`
margin: 0 ${theme.gridUnit * 2}px 0 0;
padding: ${theme.gridUnit}px
${theme.gridUnit * 2}px;
&:hover,
&-active {
color: ${theme.colors.grayscale.dark1};
border-radius: ${theme.borderRadius}px;
background-color: ${theme.colors.secondary.light4};
.ant-tabs-tab-remove > svg {
.ant-tabs-tab-remove > span {
color: ${theme.colors.grayscale.base};
transition: all 0.3s;
}
Expand Down Expand Up @@ -238,9 +237,7 @@ const FilterTabs: FC<FilterTabsProps> = ({
</FilterTabTitle>
}
key={id}
closeIcon={
removedFilters[id] ? <></> : <StyledTrashIcon name="trash" />
}
closeIcon={removedFilters[id] ? <></> : <StyledTrashIcon />}
>
{
// @ts-ignore
Expand Down

0 comments on commit 58cda8f

Please sign in to comment.