Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/src/components/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function ComposerNotice({
return (
<div
role="alert"
className={`mx-5.5 -mb-4 flex items-center gap-2.5 rounded-t-2xl border border-b-0 ${surface} px-3 pt-2.5 pb-6 text-xs leading-snug`}
className={`mx-3 flex items-center gap-2.5 rounded-t-xl border border-b-0 ${surface} px-3 py-2 text-xs leading-snug`}
>
<Icon className={`size-4 shrink-0 ${text}`} strokeWidth={2} aria-hidden />
<div className="min-w-0 flex-1">
Expand Down
37 changes: 16 additions & 21 deletions apps/web/src/components/composer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CornerDownLeft, X, type LucideIcon } from "lucide-react";
import { ArrowUp, X, type LucideIcon } from "lucide-react";
import type { ReactNode, Ref } from "react";

import { cn } from "@/lib/utils";
Expand Down Expand Up @@ -59,12 +59,14 @@ export function Composer({
>
{header}
<div
className={compact ? "px-3.5 pt-2.5 pb-0.5" : header !== undefined ? "px-4 pt-2 pb-2" : "px-4 pt-4 pb-2"}
className={
compact ? "px-3 pt-2.5 pb-1" : header !== undefined ? "px-3 pt-1.5 pb-1.5" : "px-3 pt-3.5 pb-1.5"
}
>
<textarea
ref={inputRef}
autoFocus={autoFocus}
rows={1}
rows={compact ? 1 : 2}
value={value}
onChange={(event) => onChange(event.target.value)}
onKeyDown={(event) => {
Expand All @@ -81,31 +83,24 @@ export function Composer({
}}
placeholder={placeholder}
aria-label="Prompt"
// Grows with its text, from four lines (one when compact) up to about nine, then scrolls.
className={`block max-h-52 w-full resize-none bg-transparent text-body text-ink outline-none [field-sizing:content] placeholder:text-ink-muted ${compact ? "min-h-6" : "min-h-19.5"}`}
// Grows with its text, from two lines (one when compact) up to about seven, then scrolls.
className={`block max-h-40 w-full resize-none bg-transparent text-sm leading-5.5 text-ink outline-none [field-sizing:content] placeholder:overflow-hidden placeholder:text-ellipsis placeholder:whitespace-nowrap placeholder:text-ink-muted/70 ${compact ? "min-h-5.5" : "min-h-11"}`}
/>
</div>
<div className={`flex items-center gap-2 ${compact ? "px-2.5 pb-2.5" : "px-4 pb-4"}`}>
{/* Pulled left by a control's padding, so the first one's icon lines up with the prompt's text. */}
<div className="-ml-2.5 flex min-w-0 flex-1 flex-wrap items-center gap-1 text-ui font-medium text-ink-muted">
{controls}
</div>
{actions}
<div className="flex items-center gap-1 px-2 pb-2.5">
<div className="flex min-w-0 flex-1 flex-wrap items-center gap-1 text-2xs text-ink">{controls}</div>
<div className="flex shrink-0 items-center gap-1">{actions}</div>
</div>
</form>
{tray !== undefined && (
// Inset from the card's rounded corners, tucked under its bottom edge.
<div className="mx-3 -mt-3 flex items-center gap-2 rounded-b-lg border border-edge bg-selection-subtle px-2 pt-4 pb-1 text-ui text-ink-muted">
<div className="flex min-w-0 items-center gap-2.5 overflow-hidden px-[15px] pt-1.5 text-ui text-ink-muted">
{tray}
</div>
)}
</div>
);
}

/** Shared expanded surface for starting a session and replying to one. */
export const PromptComposer = Composer;

export function ComposerHeader({
title,
icon: Icon,
Expand All @@ -116,7 +111,7 @@ export function ComposerHeader({
readonly onClose?: () => void;
}) {
return (
<div className="flex h-pane items-center gap-2 px-4 text-ui text-ink-muted">
<div className="flex h-pane items-center gap-2 px-3 text-ui text-ink-muted">
<Icon className="size-3.5" aria-hidden />
<span className="flex-1 font-medium">{title}</span>
{onClose !== undefined && (
Expand Down Expand Up @@ -146,12 +141,12 @@ export function ComposerSubmit({
return (
<button
type="submit"
aria-label={label}
disabled={disabled}
className="flex h-7 shrink-0 items-center gap-2 rounded-md bg-primary px-2.5 text-ui font-medium text-primary-foreground outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-frame press disabled:pointer-events-none disabled:bg-primary/25 disabled:text-primary-foreground/60"
className="grid size-6.5 shrink-0 place-items-center rounded-md bg-primary text-primary-foreground outline-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-frame press disabled:pointer-events-none disabled:bg-primary/30 disabled:text-primary-foreground/40"
title={title ?? `${label} (Enter)`}
>
{label}
<CornerDownLeft className="size-3.5 opacity-70" aria-hidden />
<ArrowUp className="size-3.5" strokeWidth={2.25} aria-hidden />
</button>
);
}
Expand All @@ -176,7 +171,7 @@ export function ComposerButton({
title={label}
disabled={disabled}
onClick={onClick}
className="grid size-7 shrink-0 place-items-center rounded-md bg-primary text-primary-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring press enabled:hover:bg-primary/90 disabled:bg-primary/25 disabled:text-primary-foreground/60"
className="grid size-6.5 shrink-0 place-items-center rounded-md bg-primary text-primary-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring press enabled:hover:bg-primary/90 disabled:bg-primary/30 disabled:text-primary-foreground/40"
>
{children}
</button>
Expand Down
Loading
Loading