diff options
Diffstat (limited to 'ui/src/components/Drawer.tsx')
| -rw-r--r-- | ui/src/components/Drawer.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ui/src/components/Drawer.tsx b/ui/src/components/Drawer.tsx new file mode 100644 index 00000000..65bb5ab4 --- /dev/null +++ b/ui/src/components/Drawer.tsx @@ -0,0 +1,26 @@ +import * as React from "react"; + +import { Drawer as VDrawer } from "vaul"; + +export default function Drawer({ + trigger, + children, + width, + open, + onOpenChange, +}: any) { + return ( + <VDrawer.Root direction="right" open={open} onOpenChange={onOpenChange}> + <VDrawer.Trigger asChild>{trigger}</VDrawer.Trigger> + <VDrawer.Portal> + <VDrawer.Overlay className="fixed inset-0 bg-black/40 z-50" /> + <VDrawer.Content + style={{ width: width || "400px" }} + className={`bg-white flex flex-col z-50 h-full mt-24 fixed bottom-0 right-0`} + > + {children} + </VDrawer.Content> + </VDrawer.Portal> + </VDrawer.Root> + ); +} |
