"use client";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import {
Drawer,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
} from "@/components/ui/drawer";
import { useIsMobile } from "@/hooks/use-mobile";
import { cn } from "@/lib/utils";
type Props = {
open: boolean;
onOpenChange: (open: boolean) => void;
title: React.ReactNode;
description?: React.ReactNode;
children: React.ReactNode;
footer?: React.ReactNode;
className?: string;
};
/**
* Masaüstünde Dialog, mobilde (neredeyse) tam ekran alttan açılan Drawer.
* Formlar bu bileşenle açılır (Bölüm 4: "formlar mobilde tam ekran Sheet/Drawer").
*/
export function ResponsiveDialog({
open,
onOpenChange,
title,
description,
children,
footer,
className,
}: Props) {
const isMobile = useIsMobile();
if (isMobile) {
return (
{title}
{description ? {description} : null}
{children}
{footer ? {footer} : null}
);
}
return (
);
}