1- import * as SheetPrimitive from "@radix-ui/react-dialog"
2- import { XIcon } from "lucide-react"
31import * as React from "react"
2+ import { XIcon } from "lucide-react"
3+ import { Dialog as SheetPrimitive } from "radix-ui"
44
55import { cn } from "@/lib/utils"
66
@@ -34,7 +34,7 @@ function SheetOverlay({
3434 < SheetPrimitive . Overlay
3535 data-slot = "sheet-overlay"
3636 className = { cn (
37- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade -in-0 fixed inset-0 z-50 bg-black/80 " ,
37+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate -in data-[state=open]:fade-in-0 " ,
3838 className
3939 ) }
4040 { ...props }
@@ -46,34 +46,38 @@ function SheetContent({
4646 className,
4747 children,
4848 side = "right" ,
49+ showCloseButton = true ,
4950 ...props
5051} : React . ComponentProps < typeof SheetPrimitive . Content > & {
5152 side ?: "top" | "right" | "bottom" | "left"
53+ showCloseButton ?: boolean
5254} ) {
5355 return (
5456 < SheetPortal >
5557 < SheetOverlay />
5658 < SheetPrimitive . Content
5759 data-slot = "sheet-content"
5860 className = { cn (
59- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500" ,
61+ "fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]: duration-300 data-[state=open]:animate-in data-[state=open]:duration-500" ,
6062 side === "right" &&
61- "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm" ,
63+ "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" ,
6264 side === "left" &&
63- "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm" ,
65+ "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" ,
6466 side === "top" &&
65- "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b " ,
67+ "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top" ,
6668 side === "bottom" &&
67- "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t " ,
69+ "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom" ,
6870 className
6971 ) }
7072 { ...props }
7173 >
7274 { children }
73- < SheetPrimitive . Close className = "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none" >
74- < XIcon className = "size-4" />
75- < span className = "sr-only" > Close</ span >
76- </ SheetPrimitive . Close >
75+ { showCloseButton && (
76+ < SheetPrimitive . Close className = "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary" >
77+ < XIcon className = "size-4" />
78+ < span className = "sr-only" > Close</ span >
79+ </ SheetPrimitive . Close >
80+ ) }
7781 </ SheetPrimitive . Content >
7882 </ SheetPortal >
7983 )
@@ -106,7 +110,7 @@ function SheetTitle({
106110 return (
107111 < SheetPrimitive . Title
108112 data-slot = "sheet-title"
109- className = { cn ( "text-foreground font-semibold" , className ) }
113+ className = { cn ( "font-semibold text-foreground " , className ) }
110114 { ...props }
111115 />
112116 )
@@ -119,7 +123,7 @@ function SheetDescription({
119123 return (
120124 < SheetPrimitive . Description
121125 data-slot = "sheet-description"
122- className = { cn ( "text-muted-foreground text-sm " , className ) }
126+ className = { cn ( "text-sm text-muted-foreground " , className ) }
123127 { ...props }
124128 />
125129 )
0 commit comments