From 91779788c62acfba467f587da460829fe4f48a5e Mon Sep 17 00:00:00 2001 From: ngc2207 Date: Mon, 4 Nov 2024 18:05:45 +0800 Subject: [PATCH] feat: add shadcn resizable --- package.json | 1 + src/components/ui/resizable.tsx | 45 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/components/ui/resizable.tsx diff --git a/package.json b/package.json index ac86f02..00fe9b9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "react": "19.0.0-rc-02c0e824-20241028", "react-dom": "19.0.0-rc-02c0e824-20241028", "react-hook-form": "^7.53.1", + "react-resizable-panels": "^2.1.6", "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", "zod": "^3.23.8" diff --git a/src/components/ui/resizable.tsx b/src/components/ui/resizable.tsx new file mode 100644 index 0000000..5942eb0 --- /dev/null +++ b/src/components/ui/resizable.tsx @@ -0,0 +1,45 @@ +"use client" + +import { DragHandleDots2Icon } from "@radix-ui/react-icons" +import * as ResizablePrimitive from "react-resizable-panels" + +import { cn } from "@/lib/utils" + +const ResizablePanelGroup = ({ + className, + ...props +}: React.ComponentProps) => ( + +) + +const ResizablePanel = ResizablePrimitive.Panel + +const ResizableHandle = ({ + withHandle, + className, + ...props +}: React.ComponentProps & { + withHandle?: boolean +}) => ( + div]:rotate-90", + className + )} + {...props} + > + {withHandle && ( +
+ +
+ )} +
+) + +export { ResizablePanelGroup, ResizablePanel, ResizableHandle }