(react) add horizontal mode to LabelledBox

This way initially added for the multi select but after some discussions
we decided to keep the label vertical even for the multi select. But this
could be useful in the future.
This commit is contained in:
Nathan Vasse
2023-06-12 14:26:12 +02:00
committed by NathanVss
parent be87c97f31
commit 02aa441b3b
2 changed files with 20 additions and 0 deletions

View File

@@ -38,4 +38,21 @@
flex-grow: 1;
}
}
&--horizontal {
display: flex;
align-items: center;
height: auto;
label {
padding-top: 0;
position: static;
flex-shrink: 0;
}
.labelled-box__children {
flex-grow: 1;
padding: 0;
}
}
}

View File

@@ -7,6 +7,7 @@ export interface Props extends PropsWithChildren {
htmlFor?: string;
labelId?: string;
hideLabel?: boolean;
horizontal?: boolean;
}
export const LabelledBox = ({
@@ -16,11 +17,13 @@ export const LabelledBox = ({
htmlFor,
labelId,
hideLabel,
horizontal,
}: Props) => {
return (
<div
className={classNames("labelled-box", {
"labelled-box--no-label": hideLabel,
"labelled-box--horizontal": horizontal,
})}
>
{label && (