diff --git a/web/src/pages/tetanes-web.tsx b/web/src/pages/tetanes-web.tsx index 7c63470..42b0439 100644 --- a/web/src/pages/tetanes-web.tsx +++ b/web/src/pages/tetanes-web.tsx @@ -2,8 +2,29 @@ import Layout from "components/layout"; import indexCopy from "data/index.json"; import tetanesCopy from "data/tetanes.json"; import Head from "next/head"; +import { useEffect, useRef } from "react"; export default function Tetanes() { + const ref = useRef(null); + + // Super hacky way to keep the iframe height in sync with its content + useEffect(() => { + let timer = setInterval(() => { + const iframe = ref.current; + if (iframe && iframe.contentWindow) { + const newHeight = + iframe.contentWindow.document.body.scrollHeight + 200 + "px"; + if (iframe.height !== newHeight) { + iframe.height = newHeight; + } + } + }, 1000); + + return () => { + clearInterval(timer); + }; + }); + return ( <> @@ -23,11 +44,11 @@ export default function Tetanes() {