feat(ui): show close button on right panel header hover

The close button appears on the right side of the header when
hovering over the right panel header area.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jiayuan
2026-01-15 01:56:48 +08:00
parent ea29bdce13
commit 948c648ddf

View File

@@ -94,13 +94,27 @@ export function SidebarTrigger({
// Sub-components for consistent structure
export function RightPanelHeader({
className,
children,
...props
}: React.ComponentProps<'div'>) {
const toggle = useUIStore((s) => s.toggleRightPanel)
return (
<div
className={cn('flex h-11 items-center border-b px-4', className)}
className={cn('group flex h-11 items-center border-b px-4', className)}
{...props}
/>
>
{children}
<Button
variant="ghost"
size="icon"
className="ml-auto size-7 opacity-0 group-hover:opacity-100 transition-opacity"
onClick={toggle}
>
<PanelRightIcon className="h-4 w-4" />
<span className="sr-only">Close Right Panel</span>
</Button>
</div>
)
}