diff --git a/frontend/src/components/TextArea.tsx b/frontend/src/components/TextArea.tsx index b650423f..311efe81 100644 --- a/frontend/src/components/TextArea.tsx +++ b/frontend/src/components/TextArea.tsx @@ -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) => void; - onPaste?: (e: React.ClipboardEvent) => void; - onKeyDown?: (e: React.KeyboardEvent) => void; -}; +import { TextAreaProps } from './types'; const TextArea = ({ value, @@ -26,7 +13,7 @@ const TextArea = ({ onChange, onPaste, onKeyDown, -}: Props) => { +}: TextAreaProps) => { const textAreaRef = useRef(null); useEffect(() => { diff --git a/frontend/src/components/types/index.ts b/frontend/src/components/types/index.ts new file mode 100644 index 00000000..3cebc1c2 --- /dev/null +++ b/frontend/src/components/types/index.ts @@ -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, + ) => void; + onPaste?: ( + e: React.ClipboardEvent, + ) => void; + onKeyDown?: ( + e: React.KeyboardEvent, + ) => void; +}; + +export type InputProps = TextAreaProps & { + type: 'text' | 'number'; +};