import { useRef, useCallback, type ReactNode } from 'react'; import { useClickOutside } from '../../hooks/useClickOutside'; import { CloseIcon } from './icons'; import { IconButton } from './IconButton'; interface InfoPopupProps { title: string; children: ReactNode; onClose: () => void; sourceLink?: { label: string; onClick: () => void }; } export default function InfoPopup({ title, children, onClose, sourceLink }: InfoPopupProps) { const popupRef = useRef(null); const handleClose = useCallback(() => { onClose(); }, [onClose]); useClickOutside(popupRef, handleClose); return (

{title}

{children} {sourceLink && ( )}
); }