From b9e525976552243a03a2402b5fd5a4437ba2a70f Mon Sep 17 00:00:00 2001 From: aiktb Date: Sat, 26 Oct 2024 21:43:07 +0800 Subject: [PATCH] style: change color, width when dragging `ResizeHandle` --- app/components/ui/resizable.tsx | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/app/components/ui/resizable.tsx b/app/components/ui/resizable.tsx index 5908447..07ee641 100644 --- a/app/components/ui/resizable.tsx +++ b/app/components/ui/resizable.tsx @@ -21,19 +21,24 @@ const ResizableHandle = ({ }: React.ComponentProps & { withHandle?: boolean; }) => ( - div]:rotate-90", - className, - )} - {...props} - > - {withHandle && ( -
- -
- )} -
+
+ div]:rotate-90", + "[backface-visibility:hidden] data-[resize-handle-state=drag]:w-[3px] data-[resize-handle-state=hover]:w-[3px] data-[resize-handle-state=drag]:bg-green-500 data-[resize-handle-state=hover]:bg-green-500", + "data-[panel-group-direction=vertical]:data-[resize-handle-state=drag]:h-[3px] data-[panel-group-direction=vertical]:data-[resize-handle-state=hover]:h-[3px] data-[panel-group-direction=vertical]:data-[resize-handle-state=drag]:bg-green-500 data-[panel-group-direction=vertical]:data-[resize-handle-state=hover]:bg-green-500", + "absolute inset-0 h-full", + className, + )} + {...props} + > + {withHandle && ( +
+ +
+ )} +
+
); export { ResizablePanelGroup, ResizablePanel, ResizableHandle };