2022-07-25 17:31:20 +00:00
|
|
|
import {
|
|
|
|
DetailedHTMLProps,
|
|
|
|
InputHTMLAttributes,
|
|
|
|
TextareaHTMLAttributes,
|
|
|
|
} from 'react';
|
2022-07-25 17:22:59 +00:00
|
|
|
|
2022-07-25 17:31:20 +00:00
|
|
|
type Props =
|
|
|
|
| ({ multiline: true } & DetailedHTMLProps<
|
|
|
|
TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
|
|
HTMLTextAreaElement
|
|
|
|
>)
|
|
|
|
| ({ multiline: false | undefined } & DetailedHTMLProps<
|
|
|
|
InputHTMLAttributes<HTMLInputElement>,
|
|
|
|
HTMLInputElement
|
|
|
|
>);
|
2022-07-25 17:22:59 +00:00
|
|
|
|
|
|
|
export default function TextInput({ multiline, className, ...props }: Props) {
|
|
|
|
if (multiline) {
|
2022-07-25 17:31:20 +00:00
|
|
|
return (
|
|
|
|
<textarea
|
|
|
|
className={
|
|
|
|
'bg-slate-600 p-1 overflow-auto rounded ' + className
|
|
|
|
}
|
2022-07-25 17:37:35 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2022-07-25 17:31:20 +00:00
|
|
|
{...(props as any)}
|
|
|
|
/>
|
|
|
|
);
|
2022-07-25 17:22:59 +00:00
|
|
|
} else {
|
2022-07-25 17:31:20 +00:00
|
|
|
return (
|
|
|
|
<input
|
|
|
|
className={
|
|
|
|
'bg-slate-600 p-1 overflow-auto rounded ' + className
|
|
|
|
}
|
2022-07-25 17:37:35 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2022-07-25 17:31:20 +00:00
|
|
|
{...(props as any)}
|
|
|
|
/>
|
|
|
|
);
|
2022-07-25 17:22:59 +00:00
|
|
|
}
|
|
|
|
}
|