import React, { ReactNode } from 'react';
import { Modal } from './Modal';
import { useModal } from '../context/ModalContext';
import { ModalConfig } from '../core/types';

interface ModalWithContent extends ModalConfig {
    content: ReactNode;
}

export const ModalRenderer: React.FC = () => {
    const { modals } = useModal();

    return (
        <>
            {modals.map((modal) => (
                <Modal
                    key={modal.id}
                    {...modal as ModalWithContent}
                />
            ))}
        </>
    );
}; 