mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 00:53:14 +00:00
fix: removed unused TextArea component
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { TextAreaProps } from './types';
|
||||
|
||||
const TextArea = ({
|
||||
value,
|
||||
isAutoFocused,
|
||||
id,
|
||||
maxLength,
|
||||
name,
|
||||
placeholder,
|
||||
className,
|
||||
children,
|
||||
onChange,
|
||||
onPaste,
|
||||
onKeyDown,
|
||||
}: TextAreaProps) => {
|
||||
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const autoResizeTextArea = () => {
|
||||
if (textAreaRef.current) {
|
||||
textAreaRef.current.style.height = 'auto';
|
||||
|
||||
const maxHeight = 96;
|
||||
const currentContentHeight = textAreaRef.current.scrollHeight;
|
||||
|
||||
const newHeight = Math.min(maxHeight, currentContentHeight);
|
||||
|
||||
textAreaRef.current.style.height = `${newHeight}px`;
|
||||
}
|
||||
};
|
||||
|
||||
autoResizeTextArea();
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
<textarea
|
||||
ref={textAreaRef}
|
||||
className={`w-full resize-none self-stretch overflow-y-auto overflow-x-hidden whitespace-pre-wrap rounded-full bg-white px-9 pt-5 pb-[22px] text-base leading-tight opacity-100 focus:outline-none dark:bg-raisin-black
|
||||
dark:text-bright-gray ${className}`}
|
||||
id={id}
|
||||
rows={1}
|
||||
dir="auto"
|
||||
value={value}
|
||||
name={name}
|
||||
maxLength={maxLength}
|
||||
placeholder={placeholder}
|
||||
autoFocus={isAutoFocused}
|
||||
onChange={onChange}
|
||||
onPaste={onPaste}
|
||||
onKeyDown={onKeyDown}
|
||||
>
|
||||
{children}
|
||||
</textarea>
|
||||
);
|
||||
};
|
||||
|
||||
export default TextArea;
|
||||
Reference in New Issue
Block a user