File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,12 @@ function Toggle ({
3838 return (
3939 < Styled . ToggleWrapper textPosition = { textPosition } >
4040 { ( label || helperText ) && (
41- < Styled . TextWrapper textPosition = { textPosition } htmlFor = { id } hasLabel = { ! ! label } >
41+ < Styled . TextWrapper
42+ textPosition = { textPosition }
43+ htmlFor = { id }
44+ hasLabel = { ! ! label }
45+ hasHelperText = { ! ! helperText }
46+ >
4247 { label && < Styled . Title id = { labelId } > { label } </ Styled . Title > }
4348 { helperText && < Styled . HelperText id = { helperTextId } > { helperText } </ Styled . HelperText > }
4449 </ Styled . TextWrapper >
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export const TextWrapper = styled.label<StyledTextWrapperProps>`
4747 return 1 ;
4848 } } ;
4949 cursor: pointer;
50- ${ ( { hasLabel} ) => ! hasLabel && `justify-content: center;` }
50+ ${ ( { hasLabel, hasHelperText } ) => ( ! hasLabel || ! hasHelperText ) && `justify-content: center;` }
5151 ${ ( { textPosition } ) => {
5252 if ( textPosition === TEXT_POSITIONS . TOP || textPosition === TEXT_POSITIONS . BOTTOM ) {
5353 return css `
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export interface StyledToggleWrapperProps {
1010
1111export interface StyledTextWrapperProps extends StyledToggleWrapperProps {
1212 hasLabel : boolean ;
13+ hasHelperText : boolean ;
1314}
1415
1516export interface ToggleProps {
You can’t perform that action at this time.
0 commit comments