import { useEffect, useRef, type ReactNode } from 'react' import { X } from 'lucide-react' interface LibraryModalProps { open: boolean onClose: () => void title: string headerSlot?: ReactNode children: ReactNode } // Generic library dialog shell — no asset/recipe knowledge. A future regular-LoRA // library reuses it. export function LibraryModal({ open, onClose, title, headerSlot, children }: LibraryModalProps) { const ref = useRef(null) useEffect(() => { const el = ref.current if (!el) return if (open && !el.open) el.showModal() else if (!open && el.open) el.close() }, [open]) return ( element itself (content is the inner div). onClick={(e) => { if (e.target === ref.current) onClose() }} className="m-auto w-[min(960px,calc(100%-2rem))] max-h-[80vh] overflow-hidden rounded-2xl border border-zinc-800 bg-zinc-900 p-0 text-white backdrop:bg-black/60" > {/* Flex column so only the body scrolls — no hardcoded header-height calc. */}

{title}

{headerSlot}
{children}
) }