Skip to content

Commit c64d2d8

Browse files
committed
fix(ui): adjust input boxes + background
1 parent 92292c5 commit c64d2d8

File tree

2 files changed

+33
-31
lines changed

2 files changed

+33
-31
lines changed

components/message.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,15 @@ const PurePreviewMessage = ({
228228

229229
if (part.output && 'error' in part.output) {
230230
return (
231-
<div key={toolCallId} className="p-4 text-red-500 rounded-lg border border-red-200 bg-red-50 dark:bg-red-950/50">
231+
<div
232+
key={toolCallId}
233+
className="p-4 text-red-500 bg-red-50 rounded-lg border border-red-200 dark:bg-red-950/50"
234+
>
232235
Error updating document: {String(part.output.error)}
233236
</div>
234237
);
235238
}
236-
239+
237240
return (
238241
<div key={toolCallId} className="relative">
239242
<DocumentPreview
@@ -320,15 +323,15 @@ export const ThinkingMessage = () => {
320323
animate={{ y: 0, opacity: 1, transition: { delay: 1 } }}
321324
data-role={role}
322325
>
323-
<div className="flex gap-4 w-full items-start justify-start">
324-
<div className="flex justify-center items-center rounded-full ring-1 size-8 shrink-0 ring-border bg-background mt-1">
326+
<div className="flex items-start gap-3 justify-start -ml-3">
327+
<div className="flex justify-center items-center mt-1 rounded-full ring-1 size-8 shrink-0 ring-border bg-background">
325328
<SparklesIcon size={14} />
326329
</div>
327330

328-
<div className="flex flex-col gap-2 w-full">
329-
<div className="flex flex-col gap-2 text-muted-foreground">
330-
Hmm...
331-
</div>
331+
<div className="flex flex-col gap-4 w-full">
332+
<MessageContent className="bg-transparent -ml-4">
333+
<div className="text-muted-foreground">Hmm...</div>
334+
</MessageContent>
332335
</div>
333336
</div>
334337
</motion.div>

components/multimodal-input.tsx

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ import {
2828
PromptInputModelSelectTrigger,
2929
PromptInputModelSelectContent,
3030
} from './elements/prompt-input';
31-
import {
32-
SelectItem,
33-
SelectValue,
34-
} from '@/components/ui/select';
31+
import { SelectItem, SelectValue } from '@/components/ui/select';
3532
import equal from 'fast-deep-equal';
3633
import type { UseChatHelpers } from '@ai-sdk/react';
3734
import { AnimatePresence, motion } from 'framer-motion';
@@ -83,15 +80,13 @@ function PureMultimodalInput({
8380

8481
const adjustHeight = () => {
8582
if (textareaRef.current) {
86-
textareaRef.current.style.height = 'auto';
87-
textareaRef.current.style.height = `${textareaRef.current.scrollHeight + 2}px`;
83+
textareaRef.current.style.height = '72px';
8884
}
8985
};
9086

9187
const resetHeight = () => {
9288
if (textareaRef.current) {
93-
textareaRef.current.style.height = 'auto';
94-
textareaRef.current.style.height = '98px';
89+
textareaRef.current.style.height = '72px';
9590
}
9691
};
9792

@@ -269,7 +264,7 @@ function PureMultimodalInput({
269264
/>
270265

271266
<PromptInput
272-
className="border border-transparent shadow-lg transition-all duration-200 shadow-black/10 hover:border-primary/20 focus-within:border-primary/30 focus-within:shadow-xl focus-within:shadow-primary/20"
267+
className="bg-gray-50 rounded-3xl border border-gray-300 shadow-none transition-all duration-200 dark:bg-sidebar dark:border-sidebar-border hover:ring-1 hover:ring-primary/30 focus-within:ring-1 focus-within:ring-primary/50"
273268
onSubmit={(event) => {
274269
event.preventDefault();
275270
if (status !== 'ready') {
@@ -319,15 +314,14 @@ function PureMultimodalInput({
319314
placeholder="Send a message..."
320315
value={input}
321316
onChange={handleInput}
322-
minHeight={48}
323-
maxHeight={48}
317+
minHeight={72}
318+
maxHeight={200}
324319
disableAutoResize={true}
325-
style={{ height: '48px', minHeight: '48px', maxHeight: '48px' }}
326-
className="text-sm resize-none py-1 px-3 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]"
320+
className="text-base resize-none py-4 px-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] bg-transparent !border-0 !border-none outline-none ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-none"
327321
rows={1}
328322
autoFocus
329323
/>
330-
<PromptInputToolbar className="px-2 py-1">
324+
<PromptInputToolbar className="px-4 py-2 !border-t-0 !border-top-0 shadow-none dark:!border-transparent dark:border-0">
331325
<PromptInputTools className="gap-2">
332326
<AttachmentsButton fileInputRef={fileInputRef} status={status} />
333327
<ModelSelectorCompact selectedModelId={selectedModelId} />
@@ -338,9 +332,10 @@ function PureMultimodalInput({
338332
<PromptInputSubmit
339333
status={status}
340334
disabled={!input.trim() || uploadQueue.length > 0}
341-
className="bg-primary hover:bg-primary/90 text-primary-foreground size-8"
342-
size="sm"
343-
/>
335+
className="rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-sidebar-accent dark:hover:bg-sidebar-accent/80 p-3 text-gray-700 dark:text-gray-300"
336+
>
337+
<ArrowUpIcon size={20} />
338+
</PromptInputSubmit>
344339
)}
345340
</PromptInputToolbar>
346341
</PromptInput>
@@ -394,13 +389,15 @@ function PureModelSelectorCompact({
394389
}) {
395390
const [optimisticModelId, setOptimisticModelId] = useState(selectedModelId);
396391

397-
const selectedModel = chatModels.find(model => model.id === optimisticModelId);
392+
const selectedModel = chatModels.find(
393+
(model) => model.id === optimisticModelId,
394+
);
398395

399396
return (
400397
<PromptInputModelSelect
401398
value={selectedModel?.name}
402399
onValueChange={(modelName) => {
403-
const model = chatModels.find(m => m.name === modelName);
400+
const model = chatModels.find((m) => m.name === modelName);
404401
if (model) {
405402
setOptimisticModelId(model.id);
406403
startTransition(() => {
@@ -409,18 +406,20 @@ function PureModelSelectorCompact({
409406
}
410407
}}
411408
>
412-
<PromptInputModelSelectTrigger
409+
<PromptInputModelSelectTrigger
413410
type="button"
414411
className="text-xs focus:outline-none focus:ring-0 focus:ring-offset-0 focus-visible:ring-0 focus-visible:ring-offset-0 data-[state=open]:ring-0 data-[state=closed]:ring-0"
415412
>
416-
{selectedModel?.name || "Select model"}
413+
{selectedModel?.name || 'Select model'}
417414
</PromptInputModelSelectTrigger>
418415
<PromptInputModelSelectContent>
419416
{chatModels.map((model) => (
420417
<SelectItem key={model.id} value={model.name}>
421-
<div className="flex flex-col items-start gap-1 py-1">
418+
<div className="flex flex-col gap-1 items-start py-1">
422419
<div className="font-medium">{model.name}</div>
423-
<div className="text-xs text-muted-foreground">{model.description}</div>
420+
<div className="text-xs text-muted-foreground">
421+
{model.description}
422+
</div>
424423
</div>
425424
</SelectItem>
426425
))}

0 commit comments

Comments
 (0)