Skip to content

Commit e9d2552

Browse files
committed
style(prompt-input): tighten the toolbar popups
The select and add menu rows stacked a bold name over its description and marked the active row with an accent stripe as well as a fill. Draw each option as one row, the description inline and muted, mark the active row with the neutral fill alone, as Menu does, and keep the check for the chosen option. Rows sit flush with less padding.
1 parent b31ff4a commit e9d2552

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

‎src/ui/prompt-input-toolbar.tsx‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export type PromptInputPopupAlign = "start" | "end";
7878
// Above the textarea (z-10) and the suggestion list (z-20); the popups open
7979
// upward, over the box, since the box sits at the bottom of the screen.
8080
const POPUP =
81-
"absolute bottom-full z-30 mb-2 flex max-h-72 w-max max-w-80 min-w-48 flex-col gap-0.5 overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg";
81+
"absolute bottom-full z-30 mb-2 flex max-h-72 w-max max-w-80 min-w-48 flex-col gap-px overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg";
8282

8383
const ICON_BUTTON =
8484
"grid size-8 shrink-0 place-items-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50";
@@ -307,7 +307,7 @@ export function PromptInputAddMenu({
307307
aria-disabled={item.disabled === true ? true : undefined}
308308
data-slot="prompt-input-add-menu-item"
309309
className={cn(
310-
"flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-start text-sm",
310+
"flex w-full items-center gap-2 rounded-md px-2 py-1 text-start text-sm",
311311
"hover:bg-muted focus-visible:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:bg-transparent",
312312
)}
313313
onClick={() => {
@@ -319,15 +319,15 @@ export function PromptInputAddMenu({
319319
{item.icon === undefined ? null : (
320320
<span
321321
aria-hidden
322-
className="mt-0.5 grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-4"
322+
className="grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5"
323323
>
324324
{item.icon}
325325
</span>
326326
)}
327-
<span className="flex min-w-0 flex-col">
328-
<span>{item.label}</span>
327+
<span className="flex min-w-0 items-baseline gap-2">
328+
<span className="shrink-0">{item.label}</span>
329329
{item.detail === undefined ? null : (
330-
<span className="text-xs text-muted-foreground">
330+
<span className="truncate text-xs text-muted-foreground">
331331
{item.detail}
332332
</span>
333333
)}
@@ -495,8 +495,7 @@ function OptionSelect({
495495
data-active={active ? "" : undefined}
496496
data-slot="prompt-input-select-option"
497497
className={cn(
498-
"flex cursor-default items-start gap-2 rounded-md border-s-2 border-transparent px-2 py-1.5 text-sm",
499-
"data-[active]:border-primary data-[active]:bg-muted",
498+
"flex cursor-default items-center gap-2 rounded-md px-2 py-1 text-sm data-[active]:bg-muted",
500499
)}
501500
// Focus stays on the trigger.
502501
onMouseDown={(event) => event.preventDefault()}
@@ -505,17 +504,17 @@ function OptionSelect({
505504
}}
506505
onClick={() => choose(option)}
507506
>
508-
<span className="flex min-w-0 flex-1 flex-col">
509-
<span className="font-medium">{option.name}</span>
507+
<span className="flex min-w-0 flex-1 items-baseline gap-2">
508+
<span className="shrink-0">{option.name}</span>
510509
{option.detail === undefined ? null : (
511-
<span className="text-xs text-muted-foreground">
510+
<span className="truncate text-xs text-muted-foreground">
512511
{option.detail}
513512
</span>
514513
)}
515514
</span>
516515
<Check
517516
aria-hidden
518-
className={cn("mt-0.5 size-4 shrink-0", !selected && "invisible")}
517+
className={cn("size-3.5 shrink-0", !selected && "invisible")}
519518
/>
520519
</div>
521520
);
@@ -612,7 +611,7 @@ function OptionSelect({
612611
key={group.name}
613612
role="group"
614613
aria-labelledby={`${listId}-group-${groupIndex}`}
615-
className="flex flex-col gap-0.5"
614+
className="flex flex-col gap-px"
616615
>
617616
<div
618617
id={`${listId}-group-${groupIndex}`}

0 commit comments

Comments
 (0)