import * as React from "react" import { useMediaQuery } from "@/hooks/use-media-query" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, } from "@/components/ui/drawer" interface ResponsiveDialogProps { open: boolean onOpenChange: (open: boolean) => void children: React.ReactNode title?: string description?: string footer?: React.ReactNode className?: string } export function ResponsiveDialog({ open, onOpenChange, children, title, description, footer, className, }: ResponsiveDialogProps) { const isDesktop = useMediaQuery("(min-width: 768px)") if (isDesktop) { return ( {(title || description) && ( {title && {title}} {description && {description}} )} {children} {footer} ) } return ( {(title || description) && ( {title && {title}} {description && {description}} )}
{children}
{footer && {footer}}
) }