From 28e26a32839f30c19c338f0221f03d2d64c59543 Mon Sep 17 00:00:00 2001 From: Johan Lahti Date: Mon, 4 Dec 2023 15:10:07 +0100 Subject: [PATCH] refactor(sn-filter-pane): show filterpane border depending on component and theme only (#389) --- packages/sn-filter-pane/src/components/ListboxContainer.tsx | 3 +-- .../components/ListboxGrid/distribute-resources-counting.ts | 2 +- .../sn-filter-pane/src/hooks/__tests__/use-styling.spec.ts | 1 - packages/sn-filter-pane/src/hooks/types/components.d.ts | 3 --- packages/sn-filter-pane/src/hooks/use-styling.ts | 3 --- 5 files changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/sn-filter-pane/src/components/ListboxContainer.tsx b/packages/sn-filter-pane/src/components/ListboxContainer.tsx index 2cdce821..4f48b45c 100644 --- a/packages/sn-filter-pane/src/components/ListboxContainer.tsx +++ b/packages/sn-filter-pane/src/components/ListboxContainer.tsx @@ -39,7 +39,6 @@ const ListboxContainer = ({ options, renderTracker, env, - styles, directQueryEnabled, fpLayout, } = stores.store.getState(); @@ -51,7 +50,7 @@ const ListboxContainer = ({ directQueryEnabled, layout, listBoxModel: model, constraints, }); - const showBorder = !sense || inSelection || styles?.stardustTheme?.getStyle('', '', '_cards'); + const showBorder = !sense || inSelection; const [key] = useState(uid()); diff --git a/packages/sn-filter-pane/src/components/ListboxGrid/distribute-resources-counting.ts b/packages/sn-filter-pane/src/components/ListboxGrid/distribute-resources-counting.ts index 4f8e1393..6112466c 100644 --- a/packages/sn-filter-pane/src/components/ListboxGrid/distribute-resources-counting.ts +++ b/packages/sn-filter-pane/src/components/ListboxGrid/distribute-resources-counting.ts @@ -1,6 +1,6 @@ import { IListLayout, IListboxResource } from '../../hooks/types'; import { - COLLAPSED_HEIGHT, COLUMN_MIN_WIDTH, COLUMN_SPACING, EXPANDED_HEADER_HEIGHT, ITEM_SPACING, LIST_ROW_HEIGHT, DENSE_ROW_HEIGHT, GRID_ROW_HEIGHT, ITEM_MIN_WIDTH, REMOVE_TICK_LIMIT, ITEM_MAX_WIDTH, TICK_WIDTH, FREQUENCY_ADD_WIDTH, CHAR_WIDTH, CHECKBOX_ADD_WIDTH, SCROLL_BAR_WIDTH, + COLLAPSED_HEIGHT, COLUMN_MIN_WIDTH, COLUMN_SPACING, EXPANDED_HEADER_HEIGHT, ITEM_SPACING, LIST_ROW_HEIGHT, DENSE_ROW_HEIGHT, GRID_ROW_HEIGHT, ITEM_MIN_WIDTH, REMOVE_TICK_LIMIT, ITEM_MAX_WIDTH, TICK_WIDTH, FREQUENCY_ADD_WIDTH, CHAR_WIDTH, CHECKBOX_ADD_WIDTH, } from './grid-constants'; import { ExpandProps, IColumn, ISize } from './interfaces'; diff --git a/packages/sn-filter-pane/src/hooks/__tests__/use-styling.spec.ts b/packages/sn-filter-pane/src/hooks/__tests__/use-styling.spec.ts index 94e87e3c..d89dbf0f 100644 --- a/packages/sn-filter-pane/src/hooks/__tests__/use-styling.spec.ts +++ b/packages/sn-filter-pane/src/hooks/__tests__/use-styling.spec.ts @@ -72,7 +72,6 @@ describe('use styling', () => { fontFamily: 'ComponentFontFamily', fontWeight: 'bold', }, - stardustTheme: {}, }); }); }); diff --git a/packages/sn-filter-pane/src/hooks/types/components.d.ts b/packages/sn-filter-pane/src/hooks/types/components.d.ts index 5542891b..d43fae25 100644 --- a/packages/sn-filter-pane/src/hooks/types/components.d.ts +++ b/packages/sn-filter-pane/src/hooks/types/components.d.ts @@ -1,5 +1,3 @@ -import { Theme as StardustTheme } from '@nebula.js/stardust'; - export type ISizing = 'originalSize' | 'alwaysFit' | 'fitWidth' | 'fitHeight' | 'stretchFit' | 'alwaysFill'; export type IColor = { @@ -86,5 +84,4 @@ export interface IStyles { popover: { backgroundColor?: string; // TODO: should we allow customisable background image in popover mode }; - stardustTheme: StardustTheme; } diff --git a/packages/sn-filter-pane/src/hooks/use-styling.ts b/packages/sn-filter-pane/src/hooks/use-styling.ts index bb1ac52a..3ea63e3c 100644 --- a/packages/sn-filter-pane/src/hooks/use-styling.ts +++ b/packages/sn-filter-pane/src/hooks/use-styling.ts @@ -81,9 +81,6 @@ export default function useStyling({ app, components = [] }: ICreateStylingArgs) textDecoration: headerFontStyle.underline ? 'underline' : 'initial', fontStyle: (headerFontStyle.italic && 'italic') || (headerFontStyle.italic === false && 'normal') || getListboxStyle('title.main', 'fontStyle') || 'initial', }, - // The theme is only exposed here temporarilly. The idea is to not expose any theme directly, - // but instead let them populate the merged style. Remove when possible. - stardustTheme, }; return mergedStyle;