'use client'; import { useState, useRef, useEffect } from 'react'; import type { AppIframeViewerProps } from '@/types/component-props'; export default function AppIframeViewer({ htmlContent, title, onLoadComplete, }: AppIframeViewerProps) { const [isLoading, setIsLoading] = useState(true); const iframeRef = useRef(null); useEffect(() => { if (iframeRef.current) { const iframe = iframeRef.current; const handleLoad = () => { setIsLoading(false); onLoadComplete?.(); }; iframe.addEventListener('load', handleLoad); return () => iframe.removeEventListener('load', handleLoad); } }, [onLoadComplete]); return (

{title}

{isLoading && ( Loading... )}
{isLoading && (
)}