diff --git a/packages/studio-ui/src/components/IFramePortal.tsx b/packages/studio-ui/src/components/IFramePortal.tsx index c05b56d65..668764f75 100644 --- a/packages/studio-ui/src/components/IFramePortal.tsx +++ b/packages/studio-ui/src/components/IFramePortal.tsx @@ -1,16 +1,7 @@ import { createPortal } from "react-dom"; -import { - Dispatch, - PropsWithChildren, - RefObject, - SetStateAction, - useEffect, - useRef, - useState, -} from "react"; +import { Dispatch, PropsWithChildren, SetStateAction, useEffect } from "react"; import useStudioStore from "../store/useStudioStore"; import { twMerge } from "tailwind-merge"; -import { Viewport } from "./Viewport/defaults"; export default function IFramePortal( props: PropsWithChildren<{ @@ -19,18 +10,13 @@ export default function IFramePortal( setIframeEl: Dispatch>; }> ) { - const previewRef = useRef(null); const iframeDocument = props.iframeEl?.contentWindow?.document; - const [viewport] = useStudioStore((store) => [store.pagePreview.viewport]); useParentDocumentStyles(iframeDocument); - const iframeCSS = twMerge( - "mr-auto ml-auto", - viewport.css, - useCSS(viewport, previewRef) - ); + const viewportCss = useStudioStore((store) => store.pagePreview.viewport.css); + const iframeCSS = twMerge("mr-auto ml-auto", viewportCss); return ( -
+