Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

RightPanelResizeHandle.tsx

34 lines1.0 KB

1import type { ResizableWidthHandlers } from "~/hooks/useResizableWidth";
2import { cn } from "~/lib/utils";
3​
4interface Props {
5 handlers: ResizableWidthHandlers;
6 className?: string;
7}
8​
9/**
10 * Hit target for resizing a right-anchored panel via its left edge.
11 *
12 * - Sits on top of the panel's border with a 4px overlap on each side so the
13 * user can grab a few pixels off the edge without aiming.
14 * - Visual indicator is a 1px line that lights up on hover/active to mirror
15 * VS Code / Cursor.
16 */
17export function RightPanelResizeHandle({ handlers, className }: Props) {
18 return (
19 <div
20 role="separator"
21 aria-orientation="vertical"
22 className={cn(
23 "group absolute inset-y-0 -left-1 z-20 w-2 cursor-col-resize select-none",
24 className,
25 )}
26 {...handlers}
27 >
28 <span
29 aria-hidden
30 className="pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover:bg-border group-active:bg-primary/60"
31 />
32 </div>
33 );