Fix URL 2px grow on focus

This commit is contained in:
Gregory Schier
2024-01-19 21:49:51 -08:00
parent 8bc131de6c
commit de8bf3ca70
2 changed files with 11 additions and 9 deletions

View File

@@ -49,11 +49,12 @@ export const UrlBar = memo(function UrlBar({ id: requestId, url, method, classNa
});
return (
<form onSubmit={handleSubmit} className={classNames('url-bar', className)}>
<form onSubmit={handleSubmit} className={className}>
<Input
autocompleteVariables
ref={inputRef}
size={isFocused ? 'auto' : 'sm'}
size="sm"
wrapLines={isFocused}
hideLabel
useTemplating
contentType="url"

View File

@@ -40,6 +40,7 @@ export type InputProps = Omit<
placeholder?: string;
validate?: (v: string) => boolean;
require?: boolean;
wrapLines?: boolean;
};
export const Input = forwardRef<EditorView | undefined, InputProps>(function Input(
@@ -60,6 +61,7 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
placeholder,
require,
rightSlot,
wrapLines,
size = 'md',
type = 'text',
validate,
@@ -82,7 +84,7 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
}, [onBlur]);
const id = `input-${name}`;
const inputClassName = classNames(
const editorClassName = classNames(
className,
'!bg-transparent min-w-0 h-auto w-full focus:outline-none placeholder:text-placeholder',
);
@@ -144,10 +146,9 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
'border',
focused ? 'border-focus' : 'border-highlight',
!isValid && '!border-invalid',
size === 'md' && 'h-md',
size === 'sm' && 'h-sm',
size === 'xs' && 'h-xs',
size === 'auto' && 'min-h-sm',
size === 'md' && 'min-h-md',
size === 'sm' && 'min-h-sm',
size === 'xs' && 'min-h-xs',
)}
>
{leftSlot}
@@ -163,14 +164,14 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
ref={ref}
id={id}
singleLine
wrapLines={size === 'auto'}
wrapLines={wrapLines}
onKeyDown={handleKeyDown}
type={type === 'password' && !obscured ? 'text' : type}
defaultValue={defaultValue}
forceUpdateKey={forceUpdateKey}
placeholder={placeholder}
onChange={handleChange}
className={inputClassName}
className={editorClassName}
onFocus={handleFocus}
onBlur={handleBlur}
{...props}