mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 09:03:15 +00:00
chore: migrated to using custom Input component to address redundant twClasses
This commit is contained in:
39
frontend/src/components/Input.tsx
Normal file
39
frontend/src/components/Input.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { InputProps } from './types';
|
||||
|
||||
const Input = ({
|
||||
id,
|
||||
name,
|
||||
type,
|
||||
value,
|
||||
isAutoFocused = false,
|
||||
placeholder,
|
||||
maxLength,
|
||||
className,
|
||||
hasSilverBorder,
|
||||
children,
|
||||
onChange,
|
||||
onPaste,
|
||||
onKeyDown,
|
||||
}: InputProps) => {
|
||||
return (
|
||||
<input
|
||||
className={`h-[42px] w-full rounded-full border-2 px-3 outline-none dark:bg-transparent dark:text-white ${
|
||||
hasSilverBorder ? 'border-silver dark:border-silver/40' : ''
|
||||
} ${className}`}
|
||||
type={type}
|
||||
id={id}
|
||||
name={name}
|
||||
autoFocus={isAutoFocused}
|
||||
placeholder={placeholder}
|
||||
maxLength={maxLength}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
onPaste={onPaste}
|
||||
onKeyDown={onKeyDown}
|
||||
>
|
||||
{children}
|
||||
</input>
|
||||
);
|
||||
};
|
||||
|
||||
export default Input;
|
||||
@@ -1,6 +1,6 @@
|
||||
export type TextAreaProps = {
|
||||
value: string | string[] | number;
|
||||
isAutoFocused: boolean;
|
||||
isAutoFocused?: boolean;
|
||||
id?: string;
|
||||
maxLength?: number;
|
||||
name?: string;
|
||||
@@ -20,4 +20,5 @@ export type TextAreaProps = {
|
||||
|
||||
export type InputProps = TextAreaProps & {
|
||||
type: 'text' | 'number';
|
||||
hasSilverBorder?: boolean;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user