- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files. - Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter. - Updated project structure and references to reflect these removals.
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import React, {ChangeEvent} from "react";
|
|
|
|
type InputSize = 'sm' | 'md' | 'lg';
|
|
|
|
const sizeClasses: Record<InputSize, string> = {
|
|
sm: 'px-3 py-1.5 text-xs rounded-lg',
|
|
md: 'px-4 py-2.5 text-sm rounded-xl',
|
|
lg: 'px-5 py-3 text-base rounded-xl',
|
|
};
|
|
|
|
interface TextInputProps {
|
|
value: string;
|
|
setValue?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
placeholder?: string;
|
|
readOnly?: boolean;
|
|
disabled?: boolean;
|
|
onFocus?: () => void;
|
|
size?: InputSize;
|
|
}
|
|
|
|
export default function TextInput(
|
|
{
|
|
value,
|
|
setValue,
|
|
placeholder,
|
|
readOnly = false,
|
|
disabled = false,
|
|
onFocus,
|
|
size = 'md'
|
|
}: TextInputProps) {
|
|
return (
|
|
<input
|
|
type="text"
|
|
value={value}
|
|
onChange={setValue}
|
|
readOnly={readOnly}
|
|
disabled={disabled}
|
|
placeholder={placeholder}
|
|
onFocus={onFocus}
|
|
className={`input-base ${sizeClasses[size]}`}
|
|
/>
|
|
)
|
|
}
|