Open History to see the last commit
1import { cn } from "@/lib/utils";
2import * as ResizablePrimitive from "react-resizable-panels";
3
4function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps) {
5 return (
6 <ResizablePrimitive.Group
7 data-slot="resizable-panel-group"
8 className={cn("flex h-full w-full aria-[orientation=vertical]:flex-col", className)}
9 {...props}
10 />
11 );
12}
13
14function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
15 return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
16}
17
18function ResizableHandle({
19 withHandle,
20 className,
21 children,
22 ...props
23}: ResizablePrimitive.SeparatorProps & {
24 withHandle?: boolean;
25}) {
26 return (
27 <ResizablePrimitive.Separator
28 data-slot="resizable-handle"
29 className={cn(
30 "relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
31 className,
32 )}
33 {...props}
34 >
35 {withHandle && <div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />}
36 {children}
37 </ResizablePrimitive.Separator>
38 );
39}
40
41export { ResizableHandle, ResizablePanel, ResizablePanelGroup };