|
1
|
"use client" |
|
2
|
|
|
3
|
import { GripVertical } from "lucide-react" |
|
4
|
import * as ResizablePrimitive from "react-resizable-panels" |
|
5
|
|
|
6
|
import { cn } from "@/lib/utils" |
|
7
|
|
|
8
|
const ResizablePanelGroup = ({ |
|
9
|
className, |
|
10
|
...props |
|
11
|
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => ( |
|
12
|
<ResizablePrimitive.PanelGroup |
|
13
|
className={cn( |
|
14
|
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col", |
|
15
|
className |
|
16
|
)} |
|
17
|
{...props} |
|
18
|
/> |
|
19
|
) |
|
20
|
|
|
21
|
const ResizablePanel = ResizablePrimitive.Panel |
|
22
|
|
|
23
|
const ResizableHandle = ({ |
|
24
|
withHandle, |
|
25
|
className, |
|
26
|
...props |
|
27
|
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & { |
|
28
|
withHandle?: boolean |
|
29
|
}) => ( |
|
30
|
<ResizablePrimitive.PanelResizeHandle |
|
31
|
className={cn( |
|
32
|
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 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-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90", |
|
33
|
className |
|
34
|
)} |
|
35
|
{...props} |
|
36
|
> |
|
37
|
{withHandle && ( |
|
38
|
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border"> |
|
39
|
<GripVertical className="h-2.5 w-2.5" /> |
|
40
|
</div> |
|
41
|
)} |
|
42
|
</ResizablePrimitive.PanelResizeHandle> |
|
43
|
) |
|
44
|
|
|
45
|
export { ResizablePanelGroup, ResizablePanel, ResizableHandle } |