From c7cc7dfbdc7f2409b3282198ece9ecff7bcf213a Mon Sep 17 00:00:00 2001 From: Dylan Decrulle Date: Thu, 11 Jul 2024 14:26:26 +0200 Subject: [PATCH] fix: do not display empty `` (#275) --- src/Input.tsx | 16 +++++++++------- src/Range.tsx | 18 ++++++++++-------- src/SegmentedControl.tsx | 26 ++++++++++++++------------ src/Select.tsx | 12 ++++++++---- src/SelectNext.tsx | 10 ++++++---- src/ToggleSwitch.tsx | 22 ++++++++++++---------- src/Upload.tsx | 10 ++++++---- src/blocks/PasswordInput.tsx | 16 +++++++++------- src/shared/Fieldset.tsx | 14 ++++++++------ 9 files changed, 82 insertions(+), 62 deletions(-) diff --git a/src/Input.tsx b/src/Input.tsx index bcf240b2a..d04e60aa8 100644 --- a/src/Input.tsx +++ b/src/Input.tsx @@ -127,13 +127,15 @@ export const Input = memo( id={id} {...rest} > - + {Boolean(label || hintText) && ( + + )} {(() => { const nativeInputOrTextArea = ( - + {Boolean(label || hintText) && ( + + )}
- + {segment.label && ( + + )}
); })} diff --git a/src/Select.tsx b/src/Select.tsx index 12eaa7eef..6e6324517 100644 --- a/src/Select.tsx +++ b/src/Select.tsx @@ -90,10 +90,14 @@ export const Select = memo( style={style} {...rest} > - + {Boolean(label || hint) && ( + + )} - + {label && ( + + )} {helperText && (

{helperText} diff --git a/src/Upload.tsx b/src/Upload.tsx index c402afa95..2cfca967e 100644 --- a/src/Upload.tsx +++ b/src/Upload.tsx @@ -72,10 +72,12 @@ export const Upload = memo( )} ref={ref} > - + {Boolean(label || hint) && ( + + )} - + {Boolean(label || hintText) && ( + + )}

- + {Boolean(label || hintText) && ( + + )} {"illustration" in rest && (
{rest.illustration}