"use client" import { useEffect } from 'react' import { X } from 'lucide-react' type DialogProps = { isOpen: boolean onClose: () => void title: string children: React.ReactNode } export function Dialog({ isOpen, onClose, title, children }: DialogProps) { // Close on Escape key useEffect(() => { if (!isOpen) return const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape') { onClose() } } document.addEventListener('keydown', handleEscape) return () => document.removeEventListener('keydown', handleEscape) }, [isOpen, onClose]) // Prevent body scroll when dialog is open useEffect(() => { if (isOpen) { document.body.style.overflow = 'hidden' } else { document.body.style.overflow = '' } return () => { document.body.style.overflow = '' } }, [isOpen]) if (!isOpen) return null return (
{/* Backdrop */}
{/* Dialog */}
{/* Header */}

{title}

{/* Content */}
{children}
) }