From 092dc7fc49246580023a8b97101d51845c81bf04 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 31 Mar 2023 11:17:55 +0700 Subject: iframe content --- src/lib/content/components/PageContent.jsx | 2 +- src/lib/iframe/components/IframeContent.jsx | 30 ++++++++++++++++++++++++++ src/lib/invoice/utils/invoices.js | 4 ++-- src/lib/transaction/components/Transaction.jsx | 6 +++--- src/lib/transaction/utils/transactions.js | 4 ++-- 5 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 src/lib/iframe/components/IframeContent.jsx (limited to 'src/lib') diff --git a/src/lib/content/components/PageContent.jsx b/src/lib/content/components/PageContent.jsx index f7c2f467..bb44dd92 100644 --- a/src/lib/content/components/PageContent.jsx +++ b/src/lib/content/components/PageContent.jsx @@ -10,7 +10,7 @@ const PageContent = ({ path }) => { let parsedContent = content.data.content parsedContent = parsedContent.replaceAll( 'src="/web/image', - `src="${process.env.NEXT_PUBLIC_ODOO_HOST}/web/image` + `src="${process.env.NEXT_PUBLIC_ODOO_API_HOST}/web/image` ) const contentClassNames = ` prose diff --git a/src/lib/iframe/components/IframeContent.jsx b/src/lib/iframe/components/IframeContent.jsx new file mode 100644 index 00000000..52f2a26e --- /dev/null +++ b/src/lib/iframe/components/IframeContent.jsx @@ -0,0 +1,30 @@ +import { useEffect, useRef, useState } from 'react' + +const IframeContent = ({ url }) => { + const [iframeLoaded, setIframeLoaded] = useState(false) + const [iframe, setIframe] = useState(null) + const iframeRef = useRef(null) + + useEffect(() => { + if (iframeLoaded) { + setIframe({ + height: document.querySelector('main').offsetHeight + }) + } + }, [iframeLoaded]) + + return ( +
+