From f40bcad137aa95e4127acee24f854ef50043dcce Mon Sep 17 00:00:00 2001 From: Marius Tobiassen Bungum Date: Mon, 24 Nov 2025 13:56:35 +0100 Subject: [PATCH] :lipstick: Align search and clear icon in Filter search field to vertical center --- src/organisms/Filter/Filter.styles.ts | 10 +++- src/organisms/Filter/Filter.tsx | 67 ++++++++++++++------------- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/organisms/Filter/Filter.styles.ts b/src/organisms/Filter/Filter.styles.ts index b9e7e9506..3b7b5cb1c 100644 --- a/src/organisms/Filter/Filter.styles.ts +++ b/src/organisms/Filter/Filter.styles.ts @@ -52,9 +52,8 @@ export const Section = styled.section` } min-height: calc(48px - (2 * ${spacings.medium_small})); align-items: center; - flex-grow: 1; display: flex; - flex-wrap: wrap; + flex-grow: 1; gap: ${spacings.x_small}; padding: ${spacings.medium_small} ${spacings.small}; cursor: text; @@ -78,6 +77,13 @@ export const Section = styled.section` } `; +export const SearchAndValuesWrapper = styled.span` + display: flex; + flex-wrap: wrap; + flex-grow: 1; + gap: ${spacings.x_small}; +`; + export const SearchField = styled.input` background: transparent; width: 0; diff --git a/src/organisms/Filter/Filter.tsx b/src/organisms/Filter/Filter.tsx index 9a389921e..e391a7c4f 100644 --- a/src/organisms/Filter/Filter.tsx +++ b/src/organisms/Filter/Filter.tsx @@ -12,6 +12,7 @@ import { import { Container, Content, + SearchAndValuesWrapper, SearchField, SearchFieldWrapper, Section, @@ -133,39 +134,41 @@ export function Filter({ data={search_icon} color={colors.text.static_icons__tertiary.rgba} /> - {(Object.keys(values) as Array).flatMap((key) => - values[key].map(({ label, icon }, index, list) => ( - onClearFilter(key, index)} - leadingIconData={icon} - $tryingToRemove={ - attemptingToRemove === key && index === list.length - 1 - } - > - {label} - - )) - )} - - {'autoCompleteOptions' in rest && rest.autoCompleteOptions && ( - + + {(Object.keys(values) as Array).flatMap((key) => + values[key].map(({ label, icon }, index, list) => ( + onClearFilter(key, index)} + leadingIconData={icon} + $tryingToRemove={ + attemptingToRemove === key && index === list.length - 1 + } + > + {label} + + )) )} - - + + {'autoCompleteOptions' in rest && rest.autoCompleteOptions && ( + + )} + + + {(Object.values(values) as SelectOptionRequired[][]).some( (list) => list.length > 0 ) && (