Skip to content

Commit 2c6b139

Browse files
committed
refactor with simpler solution
1 parent a511b2d commit 2c6b139

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/TextInput.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,14 @@ const TextInput = React.forwardRef<HTMLInputElement, TextInputInternalProps>(
3737
// this class is necessary to style FilterSearch, plz no touchy!
3838
const wrapperClasses = classnames(className, 'TextInput-wrapper')
3939

40-
// temporarily fixes an issue using icon and block in tandem
41-
const customStyles = IconComponent && block && {...sxProp, ...{display: 'flex'}}
42-
4340
return (
4441
<TextInputWrapper
4542
block={block}
4643
className={wrapperClasses}
4744
contrast={contrast}
4845
disabled={disabled}
4946
hasIcon={!!IconComponent}
50-
sx={customStyles || sxProp}
47+
sx={sxProp}
5148
theme={theme}
5249
width={widthProp}
5350
minWidth={minWidthProp}

src/_TextInputWrapper.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ const TextInputWrapper = styled.span<StyledWrapperProps>`
9191
display: block;
9292
width: 100%;
9393
`}
94+
95+
${props =>
96+
props.block &&
97+
props.hasIcon &&
98+
css`
99+
display: flex;
100+
`}
94101
95102
// Ensures inputs don't zoom on mobile but are body-font size on desktop
96103
@media (min-width: ${get('breakpoints.1')}) {

0 commit comments

Comments
 (0)