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

fix(native-filters): Misc spacing fixes for horizontal and horizontal overflow filter bar items #22288

Merged
merged 3 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ const HorizontalFilterControlContainer = styled(Form)`
const HorizontalOverflowFilterControlContainer = styled(
VerticalFilterControlContainer,
)`
&& .ant-form-item-label > label {
padding-right: unset;
&& .ant-form-item-label {
line-height: 1;
& > label {
padding-right: unset;
}
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const FilterControls: FC<FilterControlsProps> = ({
id: filter.id,
element: (
<div
className="filter-item-wrapper"
css={css`
flex-shrink: 0;
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ const HorizontalDivider = ({ title, description }: FilterDividerProps) => {
css={css`
display: flex;
align-items: center;
height: ${8 * theme.gridUnit}px;
height: ${6 * theme.gridUnit}px;
border-left: 1px solid ${theme.colors.grayscale.light2};
padding-left: ${4 * theme.gridUnit}px;

.filter-item-wrapper:first-child & {
border-left: none;
padding-left: 0;
}
`}
>
<Tooltip overlay={titleIsTruncated ? title : null}>
Expand Down Expand Up @@ -109,6 +114,7 @@ const HorizontalOverflowDivider = ({
font-weight: ${theme.typography.weights.normal};
font-size: ${theme.typography.sizes.m}px;
margin: 0 0 ${theme.gridUnit}px 0;
line-height: 1;
`}
>
{title}
Expand All @@ -124,7 +130,8 @@ const HorizontalOverflowDivider = ({
display: block;
font-size: ${theme.typography.sizes.s}px;
color: ${theme.colors.grayscale.base};
margin: 0;
margin: ${theme.gridUnit * 2.5}px 0 0 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should use full grid units. Can we change 2.5 to 2 or 3 (whichever looks better)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #22307!

line-height: 1;
`}
>
{description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const FiltersDropdownContent = ({
css={(theme: SupersetTheme) =>
css`
width: ${theme.gridUnit * 56}px;
padding: ${theme.gridUnit}px 0;
`
}
>
Expand All @@ -46,6 +47,7 @@ export const FiltersDropdownContent = ({
<FiltersOutOfScopeCollapsible
filtersOutOfScope={filtersOutOfScope}
renderer={renderer}
horizontalOverflow
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,66 @@
*/
import React, { ReactNode } from 'react';
import { css } from '@emotion/react';
import { Divider, Filter, t } from '@superset-ui/core';
import { Divider, Filter, SupersetTheme, t } from '@superset-ui/core';
import { AntdCollapse } from 'src/components';

export interface FiltersOutOfScopeCollapsibleProps {
filtersOutOfScope: (Filter | Divider)[];
renderer: (filter: Filter | Divider) => ReactNode;
hasTopMargin?: boolean;
horizontalOverflow?: boolean;
}

export const FiltersOutOfScopeCollapsible = ({
filtersOutOfScope,
hasTopMargin,
renderer,
hasTopMargin,
horizontalOverflow,
}: FiltersOutOfScopeCollapsibleProps) => (
<AntdCollapse
ghost
bordered
expandIconPosition="right"
collapsible={filtersOutOfScope.length === 0 ? 'disabled' : undefined}
css={theme => css`
&.ant-collapse {
margin-top: ${hasTopMargin
? theme.gridUnit * 6
: theme.gridUnit * -3}px;
& > .ant-collapse-item {
& > .ant-collapse-header {
padding-left: 0;
padding-bottom: ${theme.gridUnit * 2}px;
css={(theme: SupersetTheme) =>
horizontalOverflow
? css`
&.ant-collapse > .ant-collapse-item {
& > .ant-collapse-header {
padding: 0;

& > .ant-collapse-arrow {
right: 0;
padding: 0;
}
}

& > .ant-collapse-arrow {
right: ${theme.gridUnit}px;
& .ant-collapse-content-box {
padding: ${theme.gridUnit * 4}px 0 0;
margin-bottom: ${theme.gridUnit * -4}px;
}
}
}
`
: css`
&.ant-collapse {
margin-top: ${hasTopMargin ? theme.gridUnit * 6 : 0}px;
& > .ant-collapse-item {
& > .ant-collapse-header {
padding-left: 0;
padding-bottom: ${theme.gridUnit * 2}px;

& .ant-collapse-content-box {
padding: ${theme.gridUnit * 4}px 0 0;
}
}
}
`}
& > .ant-collapse-arrow {
right: ${theme.gridUnit}px;
}
}

& .ant-collapse-content-box {
padding: ${theme.gridUnit * 4}px 0 0;
}
}
}
`
}
>
<AntdCollapse.Panel
header={t('Filters out of scope (%d)', filtersOutOfScope.length)}
Expand Down