diff --git a/client/src/components/Chat/SubagentThreadLink.tsx b/client/src/components/Chat/SubagentThreadLink.tsx index 74cb097147..3833aba568 100644 --- a/client/src/components/Chat/SubagentThreadLink.tsx +++ b/client/src/components/Chat/SubagentThreadLink.tsx @@ -29,7 +29,11 @@ export default function SubagentThreadLink({ return ( ); - /** Transparent so the toggle reads as an icon on the header rather than a - * raised control; the border and hover still mark it as hit-able. */ + /** Opaque: the chat header is a gradient that fades to nothing with the + * conversation scrolling under it, so a transparent toggle shows message + * text through itself while every neighbour sits on `bg-presentation`. */ expect(screen.getByRole('button', { name: 'Toggle' })).toHaveClass( - 'bg-transparent', + 'bg-presentation', 'border-border-light', 'rounded-xl', 'duration-0', @@ -46,6 +47,31 @@ describe('Button', () => { ); }); + /** `size: 'sm'` carries `rounded-lg`, which is emitted after the variant and + * would otherwise win the merge, squaring off a text-bearing header control + * next to the icon-sized ones sharing its row. A caller that names a shape + * still outranks that repair, the way it does for `subtle`. */ + it('keeps the header-action corner at every size', () => { + const { rerender } = render( + , + ); + + const button = screen.getByRole('button', { name: 'Back' }); + expect(button).toHaveClass('rounded-xl', 'h-9', 'bg-presentation'); + expect(button).not.toHaveClass('rounded-lg'); + + rerender( + , + ); + + expect(button).toHaveClass('rounded-theme-control', 'h-9'); + expect(button).not.toHaveClass('rounded-xl'); + }); + it('preserves variant geometry until a shape is explicitly selected', () => { const { rerender } = render(); const button = screen.getByRole('button', { name: 'Subtle' }); diff --git a/packages/client/src/components/Button.tsx b/packages/client/src/components/Button.tsx index 72da84ee8f..4e562e233c 100644 --- a/packages/client/src/components/Button.tsx +++ b/packages/client/src/components/Button.tsx @@ -94,12 +94,17 @@ const buttonVariantRecipe = cva( * A control floating on the presentation surface — the sidebar * toggle in the chat header and its mirror in the mobile drawer * header, so the pair reads as one persistent button across views. + * The fill is opaque and not transparent: the chat header is a + * gradient that fades to nothing while the conversation scrolls + * underneath, so a see-through control has message text moving + * through it, and every neighbour in that row — model selector, new + * chat, overflow menu — already sits on `bg-presentation`. * `duration-0` makes the hover fill instant: these sit over a * scrolling gradient, where the shared color transition reads as * lag rather than polish. */ 'header-action': - 'rounded-xl border border-border-light bg-transparent text-text-primary duration-0 hover:bg-surface-active-alt hover:text-text-primary', + 'rounded-xl border border-border-light bg-presentation text-text-primary duration-0 hover:bg-surface-active-alt hover:text-text-primary', }, size: { default: 'h-10 px-4 py-2', @@ -138,6 +143,18 @@ const buttonVariantRecipe = cva( size: 'default', class: 'h-auto px-1 py-2', }, + /* `size: 'sm'` brings its own `rounded-lg`, emitted after the variant + * and so winning the merge. A text-bearing header control keeps the + * row's `rounded-xl` corner, matching the icon-sized ones beside it. + * Gated on `shape: 'unset'` like `subtle` above: a compound is emitted + * after the shape recipe, so an ungated one would silently outrank a + * caller that asked for `shape="theme"` or `shape="round"`. */ + { + variant: 'header-action', + size: 'sm', + shape: 'unset', + class: 'rounded-xl', + }, ], defaultVariants: { variant: 'default',