mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
chore: migrated prop type definition into a types declaration file for components. other components prop types will live here
This commit is contained in:
@@ -1,18 +1,5 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
|
||||
type Props = {
|
||||
value: string | string[] | number;
|
||||
isAutoFocused: boolean;
|
||||
id?: string;
|
||||
maxLength?: number;
|
||||
name?: string;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
children?: React.ReactElement;
|
||||
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
||||
onPaste?: (e: React.ClipboardEvent<HTMLTextAreaElement>) => void;
|
||||
onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
|
||||
};
|
||||
import { TextAreaProps } from './types';
|
||||
|
||||
const TextArea = ({
|
||||
value,
|
||||
@@ -26,7 +13,7 @@ const TextArea = ({
|
||||
onChange,
|
||||
onPaste,
|
||||
onKeyDown,
|
||||
}: Props) => {
|
||||
}: TextAreaProps) => {
|
||||
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
23
frontend/src/components/types/index.ts
Normal file
23
frontend/src/components/types/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export type TextAreaProps = {
|
||||
value: string | string[] | number;
|
||||
isAutoFocused: boolean;
|
||||
id?: string;
|
||||
maxLength?: number;
|
||||
name?: string;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
children?: React.ReactElement;
|
||||
onChange: (
|
||||
e: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
|
||||
) => void;
|
||||
onPaste?: (
|
||||
e: React.ClipboardEvent<HTMLTextAreaElement | HTMLInputElement>,
|
||||
) => void;
|
||||
onKeyDown?: (
|
||||
e: React.KeyboardEvent<HTMLTextAreaElement | HTMLInputElement>,
|
||||
) => void;
|
||||
};
|
||||
|
||||
export type InputProps = TextAreaProps & {
|
||||
type: 'text' | 'number';
|
||||
};
|
||||
Reference in New Issue
Block a user