Skip to content

Commit

Permalink
fix(TextInput): do not shrink clear button size (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored and amje committed Jul 14, 2023
1 parent 22cc5ff commit 82808d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/controls/TextInput/TextInput.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ $block: '.#{variables.$ns}text-input';
z-index: 1;
}

&__clear {
flex-shrink: 0;
}

&__error {
@include mixins.text-body-1();

Expand Down
6 changes: 5 additions & 1 deletion src/components/controls/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ export const TextInput = React.forwardRef<HTMLSpanElement, TextInputProps>(funct
)}
<TextInputControl {...props} {...commonProps} controlRef={handleRef} />
{isClearControlVisible && (
<ClearButton size={mapTextInputSizeToButtonSize(size)} onClick={handleClear} />
<ClearButton
size={mapTextInputSizeToButtonSize(size)}
onClick={handleClear}
className={b('clear')}
/>
)}
{isRightContentVisible && (
<AdditionalContent placement="right" onClick={handleAdditionalContentClick}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/controls/TextInput/TextInputControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export function TextInputControl(props: Props) {

return (
<input
{...(controlProps as React.InputHTMLAttributes<HTMLInputElement>)}
ref={controlRef as React.Ref<HTMLInputElement>}
{...controlProps}
ref={controlRef}
className={b('control', {type: 'input'}, controlProps?.className)}
type={type}
name={name}
Expand Down

0 comments on commit 82808d8

Please sign in to comment.