From f4c4f548e54868e899df95f6456ae3944954af34 Mon Sep 17 00:00:00 2001 From: Philipp Veller Date: Tue, 12 Mar 2024 10:50:23 +0100 Subject: [PATCH] control-bar: hide filter section when there is no filter fixes #5397 --- meinberlin/react/contrib/ControlBar.jsx | 43 +++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/meinberlin/react/contrib/ControlBar.jsx b/meinberlin/react/contrib/ControlBar.jsx index 6ade1b22ae..60d56ad87c 100644 --- a/meinberlin/react/contrib/ControlBar.jsx +++ b/meinberlin/react/contrib/ControlBar.jsx @@ -38,7 +38,7 @@ export const ControlBar = () => { .concat([{ type: 'search', label: term, value: term }]) .filter((f) => f.type !== 'ordering' && - queryParams?.has(f.type) + queryParams?.has(f.type) ) .map((f) => ({ ...f, value: queryParams.get(f.type) || f.value })) const nonOrderingFilters = filters.filter((f) => f.type !== 'ordering') @@ -126,13 +126,13 @@ export const ControlBar = () => { -
- - {translated.filters} - -
-
- {nonOrderingFilters.length > 0 && ( + {nonOrderingFilters.length > 0 && ( +
+ + {translated.filters} + +
+
{ nonOrderingFilters .slice(0, expandFilters ? nonOrderingFilters.length : 3).map((filter) => ( { onSelectFilter={(choice) => handleFilterChange(filter.type, choice[0])} /> )) + } +
+ {nonOrderingFilters.length > 3 && ( + )}
- {nonOrderingFilters.length > 3 && ( - - )} -
-
+ + )}