From 430f34c14f00614108a60b0d0e914094c9221e66 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 27 Jul 2020 20:21:22 -0700 Subject: [PATCH 1/3] style: FilterSelect style tweaks --- superset-frontend/src/components/ListView/Filters.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/superset-frontend/src/components/ListView/Filters.tsx b/superset-frontend/src/components/ListView/Filters.tsx index d7f3d5d7b1f16..67bf78667d51b 100644 --- a/superset-frontend/src/components/ListView/Filters.tsx +++ b/superset-frontend/src/components/ListView/Filters.tsx @@ -17,7 +17,7 @@ * under the License. */ import React, { useState } from 'react'; -import { styled, withTheme } from '@superset-ui/style'; +import { styled, withTheme, supersetTheme } from '@superset-ui/style'; import { Select, @@ -51,6 +51,7 @@ interface SelectFilterProps extends BaseFilter { const FilterContainer = styled.div` display: inline-flex; margin-right: 2em; + font-size: ${({ theme }) => theme.typography.sizes.s}px; `; const FilterTitle = styled.label` @@ -63,6 +64,7 @@ const filterSelectTheme: PartialThemeConfig = { spacing: { baseUnit: 2, minWidth: '5em', + fontSize: supersetTheme.typography.sizes.s, }, }; @@ -79,6 +81,7 @@ const filterSelectStyles: PartialStylesConfig = { ...provider, borderWidth: 0, boxShadow: 'none', + cursor: 'pointer', }), }; From f9332f809ba311c9b50f8cdecc4ad1d9c0846f4b Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Tue, 28 Jul 2020 20:30:34 -0700 Subject: [PATCH 2/3] using withTheme to avoid raw supersetTheme --- .../src/components/ListView/Filters.tsx | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/superset-frontend/src/components/ListView/Filters.tsx b/superset-frontend/src/components/ListView/Filters.tsx index 67bf78667d51b..8706c5d1de999 100644 --- a/superset-frontend/src/components/ListView/Filters.tsx +++ b/superset-frontend/src/components/ListView/Filters.tsx @@ -17,7 +17,7 @@ * under the License. */ import React, { useState } from 'react'; -import { styled, withTheme, supersetTheme } from '@superset-ui/style'; +import { styled, withTheme, SupersetThemeProps } from '@superset-ui/style'; import { Select, @@ -46,6 +46,7 @@ interface SelectFilterProps extends BaseFilter { emptyLabel?: string; fetchSelects?: Filter['fetchSelects']; paginate?: boolean; + theme: SupersetThemeProps["theme"]; } const FilterContainer = styled.div` @@ -60,14 +61,6 @@ const FilterTitle = styled.label` margin: 0 0.4em 0 0; `; -const filterSelectTheme: PartialThemeConfig = { - spacing: { - baseUnit: 2, - minWidth: '5em', - fontSize: supersetTheme.typography.sizes.s, - }, -}; - const filterSelectStyles: PartialStylesConfig = { container: (provider, { getValue }) => ({ ...provider, @@ -87,6 +80,8 @@ const filterSelectStyles: PartialStylesConfig = { const CLEAR_SELECT_FILTER_VALUE = 'CLEAR_SELECT_FILTER_VALUE'; +const StyledSelectFilter = withTheme(SelectFilter); + function SelectFilter({ Header, selects = [], @@ -95,7 +90,17 @@ 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, @@ -236,7 +241,7 @@ function UIFilters({ internalFilters[index] && internalFilters[index].value; if (input === 'select') { return ( - Date: Tue, 28 Jul 2020 22:27:39 -0700 Subject: [PATCH 3/3] lint --- superset-frontend/src/components/ListView/Filters.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/components/ListView/Filters.tsx b/superset-frontend/src/components/ListView/Filters.tsx index 8706c5d1de999..aa34c0d26bd31 100644 --- a/superset-frontend/src/components/ListView/Filters.tsx +++ b/superset-frontend/src/components/ListView/Filters.tsx @@ -46,7 +46,7 @@ interface SelectFilterProps extends BaseFilter { emptyLabel?: string; fetchSelects?: Filter['fetchSelects']; paginate?: boolean; - theme: SupersetThemeProps["theme"]; + theme: SupersetThemeProps['theme']; } const FilterContainer = styled.div` @@ -80,8 +80,6 @@ const filterSelectStyles: PartialStylesConfig = { const CLEAR_SELECT_FILTER_VALUE = 'CLEAR_SELECT_FILTER_VALUE'; -const StyledSelectFilter = withTheme(SelectFilter); - function SelectFilter({ Header, selects = [], @@ -92,7 +90,6 @@ function SelectFilter({ paginate = false, theme, }: SelectFilterProps) { - const filterSelectTheme: PartialThemeConfig = { spacing: { baseUnit: 2, @@ -177,6 +174,7 @@ function SelectFilter({ ); } +const StyledSelectFilter = withTheme(SelectFilter); interface SearchHeaderProps extends BaseFilter { Header: string;