| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- "use client";
- import * as React from "react";
- import * as SheetPrimitive from "@radix-ui/react-dialog";
- import { cn } from "@/lib/utils";
- const Sheet = SheetPrimitive.Root;
- const SheetTrigger = SheetPrimitive.Trigger;
- const SheetClose = SheetPrimitive.Close;
- const SheetPortal = SheetPrimitive.Portal;
- const SheetOverlay = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Overlay>,
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
- >(({ className, ...props }, ref) => (
- <SheetPrimitive.Overlay
- className={cn(
- "fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
- className,
- )}
- {...props}
- ref={ref}
- />
- ));
- SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
- const SheetContent = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Content>,
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>
- >(({ className, children, ...props }, ref) => (
- <SheetPortal>
- <SheetOverlay />
- <SheetPrimitive.Content
- ref={ref}
- className={cn(
- "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
- "inset-y-0 left-0 h-full w-3/4 max-w-xs border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
- className,
- )}
- {...props}
- >
- {children}
- </SheetPrimitive.Content>
- </SheetPortal>
- ));
- SheetContent.displayName = SheetPrimitive.Content.displayName;
- const SheetTitle = React.forwardRef<
- React.ComponentRef<typeof SheetPrimitive.Title>,
- React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
- >(({ className, ...props }, ref) => (
- <SheetPrimitive.Title
- ref={ref}
- className={cn("text-lg font-semibold text-foreground", className)}
- {...props}
- />
- ));
- SheetTitle.displayName = SheetPrimitive.Title.displayName;
- export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetTitle };
|