From 36fddb0f13a53bd8769af10f27d056a0a402bc52 Mon Sep 17 00:00:00 2001 From: Birte Jelsa Date: Tue, 26 Mar 2024 10:52:23 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20Should=20only=20have=20top?= =?UTF-8?q?=20margin=20when=20label=20is=20provided?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Inputs/ComboBox/ComboBox.styles.ts | 8 +++++--- src/components/Inputs/ComboBox/ComboBox.tsx | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/Inputs/ComboBox/ComboBox.styles.ts b/src/components/Inputs/ComboBox/ComboBox.styles.ts index 5882a0b4e..c948f1171 100644 --- a/src/components/Inputs/ComboBox/ComboBox.styles.ts +++ b/src/components/Inputs/ComboBox/ComboBox.styles.ts @@ -11,6 +11,7 @@ const { colors: EDSColors, spacings: EDSSpacings } = tokens; interface ContainerProps { $lightBackground?: boolean; $underlineHighlight?: boolean; + $label?: boolean; } export const Container = styled.div` @@ -34,7 +35,8 @@ export const Container = styled.div` box-shadow: inset 0 -2px 0 0 ${EDSColors.interactive.primary__resting.rgba}; } - margin-top: 1rem; + ${({ $label }) => $label && `margin-top: 1rem;`}; + > label { position: absolute; top: -1rem; @@ -138,8 +140,8 @@ export const StyledChip = styled(Chip)` $tryingToRemove ? EDSColors.interactive.primary__hover_alt.rgba : $lightBackground - ? EDSColors.ui.background__light.rgba - : EDSColors.ui.background__default.rgba}; + ? EDSColors.ui.background__light.rgba + : EDSColors.ui.background__default.rgba}; `; interface CustomMenuItemProps { diff --git a/src/components/Inputs/ComboBox/ComboBox.tsx b/src/components/Inputs/ComboBox/ComboBox.tsx index 996d5c8fe..b58b2dc47 100644 --- a/src/components/Inputs/ComboBox/ComboBox.tsx +++ b/src/components/Inputs/ComboBox/ComboBox.tsx @@ -253,6 +253,7 @@ export const ComboBox = ( aria-expanded={open} $underlineHighlight={underlineHighlight} $lightBackground={lightBackground} + $label={!!label} > {label &&