Skip to content

An AI-powered search engine with a generative UI

Merge pull request #86 from albertdbio/feat/auto-resizing-textbox

Yoshiki Miura321004cf6021
diff --cc components/chat-panel.tsx
index b4a2c188,749ae121..51113493
--- a/components/chat-panel.tsx
+++ b/components/chat-panel.tsx
@@@ -81,21 -82,25 +82,23 @@@ export function ChatPanel()
)
}
- // Condition 1 and 3: If there are no messages or the button is pressed, display the form
- const formPositionClass =
- messages.length === 0
- ? 'fixed bottom-8 left-0 right-0 top-10 mx-auto h-screen flex flex-col items-center justify-center'
- : 'fixed bottom-8-ml-6'
return (
- <div className={formPositionClass}>
- {/* <IconKuroko className="w-6 h-6 mb-4" /> */}
+ <div
+ className={
+ 'fixed bottom-8 left-0 right-0 top-10 mx-auto h-screen flex flex-col items-center justify-center'
+ }
+ >
<form onSubmit={handleSubmit} className="max-w-2xl w-full px-6">
<div className="relative flex items-center w-full">
- <Input
+ <Textarea
ref={inputRef}
- type="text"
name="input"
+ rows={1}
+ tabIndex={0}
placeholder="Ask a question..."
+ spellCheck={false}
value={input}
- className="pl-4 pr-10 h-12 rounded-full bg-muted"
+ className="leading-5 resize-none pl-8 sm:pl-10 pr-14 h-12 rounded-full bg-muted flex min-h-[70px] w-full border border-input py-6 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
onChange={e => {
setInput(e.target.value)
setShowEmptyScreen(e.target.value.length === 0)