diff --git a/frontend/src/components/Input.tsx b/frontend/src/components/Input.tsx new file mode 100644 index 00000000..fe5cdba2 --- /dev/null +++ b/frontend/src/components/Input.tsx @@ -0,0 +1,39 @@ +import { InputProps } from './types'; + +const Input = ({ + id, + name, + type, + value, + isAutoFocused = false, + placeholder, + maxLength, + className, + hasSilverBorder, + children, + onChange, + onPaste, + onKeyDown, +}: InputProps) => { + return ( + + {children} + + ); +}; + +export default Input; diff --git a/frontend/src/components/types/index.ts b/frontend/src/components/types/index.ts index 3cebc1c2..3ee65ec4 100644 --- a/frontend/src/components/types/index.ts +++ b/frontend/src/components/types/index.ts @@ -1,6 +1,6 @@ export type TextAreaProps = { value: string | string[] | number; - isAutoFocused: boolean; + isAutoFocused?: boolean; id?: string; maxLength?: number; name?: string; @@ -20,4 +20,5 @@ export type TextAreaProps = { export type InputProps = TextAreaProps & { type: 'text' | 'number'; + hasSilverBorder?: boolean; }; diff --git a/frontend/src/preferences/APIKeyModal.tsx b/frontend/src/preferences/APIKeyModal.tsx index dd7a1b88..18cf53f3 100644 --- a/frontend/src/preferences/APIKeyModal.tsx +++ b/frontend/src/preferences/APIKeyModal.tsx @@ -4,6 +4,7 @@ import { ActiveState } from '../models/misc'; import { selectApiKey, setApiKey } from './preferenceSlice'; import { useMediaQuery, useOutsideAlerter } from './../hooks'; import Modal from '../modals'; +import Input from '../components/Input'; export default function APIKeyModal({ modalState, @@ -66,14 +67,14 @@ export default function APIKeyModal({ key for llm. Currently, we support only OpenAI but soon many more. You can find it here.
- setKey(e.target.value)} - /> + > ); }} diff --git a/frontend/src/preferences/PromptsModal.tsx b/frontend/src/preferences/PromptsModal.tsx index c16ddd2c..ce634c86 100644 --- a/frontend/src/preferences/PromptsModal.tsx +++ b/frontend/src/preferences/PromptsModal.tsx @@ -1,5 +1,6 @@ import { ActiveState } from '../models/misc'; import Exit from '../assets/exit.svg'; +import Input from '../components/Input'; function AddPrompt({ setModalState, @@ -34,13 +35,14 @@ function AddPrompt({ Add your custom prompt and save it to DocsGPT