Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | import * as React from "react"; import * as DialogPrimitive from "@radix-ui/react-dialog"; import { cva, type VariantProps } from "class-variance-authority"; import { X } from "lucide-react"; import { ui } from "@/config/theme"; import { cn } from "@/lib/utils"; export const Sheet = DialogPrimitive.Root; export const SheetTrigger = DialogPrimitive.Trigger; export const SheetClose = DialogPrimitive.Close; const sheetVariants = cva( ui("sheetContent"), { variants: { side: { left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", }, }, defaultVariants: { side: "left", }, }, ); export const SheetContent = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Content>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & VariantProps<typeof sheetVariants> >(({ side = "left", className, children, ...props }, ref) => ( <DialogPrimitive.Portal> <DialogPrimitive.Overlay className={cn( ui("overlayLight"), "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", )} /> <DialogPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}> {children} <DialogPrimitive.Close className={ui("iconClose")}> <X className="h-4 w-4" /> <span className="sr-only">Close</span> </DialogPrimitive.Close> </DialogPrimitive.Content> </DialogPrimitive.Portal> )); SheetContent.displayName = "SheetContent"; function SheetHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) { return <div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />; } const SheetTitle = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Title>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> >(({ className, ...props }, ref) => ( <DialogPrimitive.Title ref={ref} className={cn("text-lg font-semibold text-foreground", className)} {...props} /> )); SheetTitle.displayName = DialogPrimitive.Title.displayName; const SheetDescription = React.forwardRef< React.ElementRef<typeof DialogPrimitive.Description>, React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> >(({ className, ...props }, ref) => ( <DialogPrimitive.Description ref={ref} className={cn(ui("typographyMuted"), className)} {...props} /> )); SheetDescription.displayName = DialogPrimitive.Description.displayName; export { SheetDescription, SheetHeader, SheetTitle }; |