Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Commit

Permalink
style: change color, width when dragging ResizeHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
aiktb committed Oct 26, 2024
1 parent 1204e87 commit b9e5259
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions app/components/ui/resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ const ResizableHandle = ({
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
withHandle?: boolean;
}) => (
<ResizablePrimitive.PanelResizeHandle
className={cn(
"after:-translate-x-1/2 data-[panel-group-direction=vertical]:after:-translate-y-1/2 relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
className,
)}
{...props}
>
{withHandle && (
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
<span className="i-lucide-grip-vertical size-2.5" />
</div>
)}
</ResizablePrimitive.PanelResizeHandle>
<div className="relative">
<ResizablePrimitive.PanelResizeHandle
className={cn(
"after:-translate-x-1/2 data-[panel-group-direction=vertical]:after:-translate-y-1/2 relative flex w-[1px] items-center justify-center bg-border transition-[width,_background-color] after:absolute after:inset-y-0 after:left-1/2 after:w-1 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>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 && (
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
<span className="i-lucide-grip-vertical size-2.5" />
</div>
)}
</ResizablePrimitive.PanelResizeHandle>
</div>
);

export { ResizablePanelGroup, ResizablePanel, ResizableHandle };

0 comments on commit b9e5259

Please sign in to comment.