diff --git a/frontend/src/components/ResponsiveIframe.tsx b/frontend/src/components/ResponsiveIframe.tsx index 11e89480a..0f14d8dde 100644 --- a/frontend/src/components/ResponsiveIframe.tsx +++ b/frontend/src/components/ResponsiveIframe.tsx @@ -4,9 +4,13 @@ import { isPresent } from "utils/utilTypes"; interface ResponsiveIframeProps { url: string; + className?: string; } -const ResponsiveIframe: React.FC = ({ url }) => { +const ResponsiveIframe: React.FC = ({ + url, + className = "", +}) => { const containerRef = useRef(null); const [dimensions, setDimensions] = useState({ width: "100%", @@ -27,10 +31,13 @@ const ResponsiveIframe: React.FC = ({ url }) => { return () => { window.removeEventListener("resize", updateDimensions); }; - }, []); + }, [ + containerRef.current?.getBoundingClientRect().width, + containerRef.current?.getBoundingClientRect().height, + ]); return ( -
+