diff --git a/packages/website/src/__tests__/__snapshots__/pages.spec.tsx.snap b/packages/website/src/__tests__/__snapshots__/pages.spec.tsx.snap index 33d5945..4b5048e 100644 --- a/packages/website/src/__tests__/__snapshots__/pages.spec.tsx.snap +++ b/packages/website/src/__tests__/__snapshots__/pages.spec.tsx.snap @@ -3,10 +3,10 @@ exports[`Pages About should render the page 1`] = `
@@ -502,10 +502,10 @@ exports[`Pages App should render the page 1`] = ` exports[`Pages Contributors should render the page 1`] = `
@@ -537,10 +537,10 @@ exports[`Pages Contributors should render the page 1`] = ` exports[`Pages Index should render the page 1`] = `
diff --git a/packages/website/src/components/CarbonAd/__tests__/__snapshots__/carbonAd.spec.tsx.snap b/packages/website/src/components/CarbonAd/__tests__/__snapshots__/carbonAd.spec.tsx.snap index 2542e67..5c8e30d 100644 --- a/packages/website/src/components/CarbonAd/__tests__/__snapshots__/carbonAd.spec.tsx.snap +++ b/packages/website/src/components/CarbonAd/__tests__/__snapshots__/carbonAd.spec.tsx.snap @@ -2,10 +2,10 @@ exports[`CarbonAd should render the component 1`] = `
`; diff --git a/packages/website/src/components/CarbonAd/index.tsx b/packages/website/src/components/CarbonAd/index.tsx index d0addb8..8593fc6 100644 --- a/packages/website/src/components/CarbonAd/index.tsx +++ b/packages/website/src/components/CarbonAd/index.tsx @@ -1,10 +1,15 @@ -import { useRef, useEffect } from 'react' +import { useRef, useEffect, useState } from 'react' const CarbonAd = () => { const adsContainer = useRef(null) + const [isMounted, setIsMounted] = useState(false) useEffect(() => { - if (adsContainer.current) { + setIsMounted(true) + }, []) + + useEffect(() => { + if (adsContainer.current && isMounted) { const carbonAdsScript = document.createElement('script') carbonAdsScript.src = @@ -14,7 +19,7 @@ const CarbonAd = () => { adsContainer.current.appendChild(carbonAdsScript) } - }, [adsContainer]) + }, [adsContainer, isMounted]) return (
@@ -89,11 +94,15 @@ const CarbonAd = () => { } .carbon-container { - min-height: 90px; + height: 100px; } `} -
+ {isMounted ? ( +
+ ) : ( +
+ )}
) }