diff --git a/.changeset/cool-pigs-wink.md b/.changeset/cool-pigs-wink.md new file mode 100644 index 0000000000..862d9d1c13 --- /dev/null +++ b/.changeset/cool-pigs-wink.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Add Input component diff --git a/packages/gitbook/src/components/AIChat/AIChatInput.tsx b/packages/gitbook/src/components/AIChat/AIChatInput.tsx index edee25d8e3..b25a95ac9d 100644 --- a/packages/gitbook/src/components/AIChat/AIChatInput.tsx +++ b/packages/gitbook/src/components/AIChat/AIChatInput.tsx @@ -1,11 +1,10 @@ import { t, tString, useLanguage } from '@/intl/client'; -import { tcls } from '@/lib/tailwind'; import { Icon } from '@gitbook/icons'; import { useEffect, useRef } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; import { useAIChatState } from '../AI/useAIChat'; -import { Button, HoverCard, HoverCardRoot, HoverCardTrigger } from '../primitives'; -import { KeyboardShortcut } from '../primitives/KeyboardShortcut'; +import { HoverCard, HoverCardRoot, HoverCardTrigger } from '../primitives'; +import { Input } from '../primitives/Input'; export function AIChatInput(props: { value: string; @@ -24,15 +23,6 @@ export function AIChatInput(props: { const inputRef = useRef(null); - const handleInput = (event: React.ChangeEvent) => { - const textarea = event.currentTarget; - onChange(textarea.value); - - // Auto-resize - textarea.style.height = 'auto'; - textarea.style.height = `${textarea.scrollHeight}px`; - }; - useEffect(() => { if (chat.opened && !disabled && !loading) { // Add a small delay to ensure the input is rendered before focusing @@ -57,57 +47,34 @@ export function AIChatInput(props: { ); return ( -
-