import React, { useEffect } from 'react';
interface DialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
children: React.ReactNode;
}
export function Dialog({ open, onOpenChange, children }: DialogProps) {
useEffect(() => {
if (open) {
document.body.style.overflow = 'hidden';
} else {
document.body.style.overflow = 'unset';
}
return () => {
document.body.style.overflow = 'unset';
};
}, [open]);
if (!open) return null;
return (
onOpenChange(false)}
/>
{children}
);
}
interface DialogContentProps {
children: React.ReactNode;
className?: string;
}
export function DialogContent({ children, className = '' }: DialogContentProps) {
return (
{children}
);
}
interface DialogHeaderProps {
children: React.ReactNode;
className?: string;
}
export function DialogHeader({ children, className = '' }: DialogHeaderProps) {
return (
{children}
);
}
interface DialogTitleProps {
children: React.ReactNode;
className?: string;
}
export function DialogTitle({ children, className = '' }: DialogTitleProps) {
return (
{children}
);
}
interface DialogDescriptionProps {
children: React.ReactNode;
className?: string;
}
export function DialogDescription({ children, className = '' }: DialogDescriptionProps) {
return (
{children}
);
}
interface DialogFooterProps {
children: React.ReactNode;
className?: string;
}
export function DialogFooter({ children, className = '' }: DialogFooterProps) {
return (
{children}
);
}