| 45 | } |
| 46 | |
| 47 | function DialogContent({ |
| 48 | className, |
| 49 | children, |
| 50 | showCloseButton = false, |
| 51 | ...props |
| 52 | }: React.ComponentProps<typeof DialogPrimitive.Content> & { |
| 53 | showCloseButton?: boolean; |
| 54 | }) { |
| 55 | // Not using DialogPortal because it's breaking useRef's for some reason |
| 56 | return ( |
| 57 | <div data-slot="dialog-portal"> |
| 58 | <DialogOverlay /> |
| 59 | <DialogPrimitive.Content |
| 60 | data-slot="dialog-content" |
| 61 | className={cn( |
| 62 | 'max-h-screen overflow-y-auto overflow-x-hidden', // Ensure the dialog is scrollable if it exceeds the screen height |
| 63 | 'mt-auto', // Add margin-top: auto for all screen sizes |
| 64 | 'focus:outline-none focus:ring-0 transition-none', |
| 65 | 'border bg-def-100 shadow-lg sm:rounded-lg md:max-h-[90vh]', |
| 66 | 'bg-def-100 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg [&>*]:min-w-0', |
| 67 | className, |
| 68 | )} |
| 69 | {...props} |
| 70 | > |
| 71 | {children} |
| 72 | {showCloseButton && ( |
| 73 | <DialogPrimitive.Close |
| 74 | data-slot="dialog-close" |
| 75 | className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4" |
| 76 | > |
| 77 | <XIcon /> |
| 78 | <span className="sr-only">Close</span> |
| 79 | </DialogPrimitive.Close> |
| 80 | )} |
| 81 | </DialogPrimitive.Content> |
| 82 | </div> |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) { |
| 87 | return ( |