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

style: FilterSelect style tweaks #10446

Merged
merged 4 commits into from
Jul 29, 2020
Merged
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
24 changes: 15 additions & 9 deletions superset-frontend/src/components/ListView/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React, { useState } from 'react';
import { styled, withTheme } from '@superset-ui/style';
import { styled, withTheme, SupersetThemeProps } from '@superset-ui/style';

import {
Select,
Expand Down Expand Up @@ -46,11 +46,13 @@ interface SelectFilterProps extends BaseFilter {
emptyLabel?: string;
fetchSelects?: Filter['fetchSelects'];
paginate?: boolean;
theme: SupersetThemeProps['theme'];
}

const FilterContainer = styled.div`
display: inline-flex;
margin-right: 2em;
font-size: ${({ theme }) => theme.typography.sizes.s}px;
`;

const FilterTitle = styled.label`
Expand All @@ -59,13 +61,6 @@ const FilterTitle = styled.label`
margin: 0 0.4em 0 0;
`;

const filterSelectTheme: PartialThemeConfig = {
spacing: {
baseUnit: 2,
minWidth: '5em',
},
};

const filterSelectStyles: PartialStylesConfig = {
container: (provider, { getValue }) => ({
...provider,
Expand All @@ -79,6 +74,7 @@ const filterSelectStyles: PartialStylesConfig = {
...provider,
borderWidth: 0,
boxShadow: 'none',
cursor: 'pointer',
}),
};

Expand All @@ -92,7 +88,16 @@ function SelectFilter({
onSelect,
fetchSelects,
paginate = false,
theme,
}: SelectFilterProps) {
const filterSelectTheme: PartialThemeConfig = {
spacing: {
baseUnit: 2,
minWidth: '5em',
fontSize: theme.typography.sizes.s,
},
};

const clearFilterSelect = {
label: emptyLabel,
value: CLEAR_SELECT_FILTER_VALUE,
Expand Down Expand Up @@ -169,6 +174,7 @@ function SelectFilter({
</FilterContainer>
);
}
const StyledSelectFilter = withTheme(SelectFilter);

interface SearchHeaderProps extends BaseFilter {
Header: string;
Expand Down Expand Up @@ -233,7 +239,7 @@ function UIFilters({
internalFilters[index] && internalFilters[index].value;
if (input === 'select') {
return (
<SelectFilter
<StyledSelectFilter
key={id}
name={id}
Header={Header}
Expand Down