-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yoannis Sánchez Soto
committed
Nov 16, 2024
1 parent
8440912
commit e7b3bc9
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable react-hooks/exhaustive-deps */ | ||
import { useEffect, useRef } from "react" | ||
|
||
export default function AdBanner(): JSX.Element { | ||
const banner = useRef<any>() | ||
|
||
const atOptions = { | ||
key: "ad8e08e8947b794a1a802eaab7d7cbf7", | ||
format: "iframe", | ||
height: 600, | ||
width: 160, | ||
params: {}, | ||
} | ||
useEffect(() => { | ||
if (banner.current && !banner.current.firstChild) { | ||
const conf = document.createElement("script") | ||
const script = document.createElement("script") | ||
script.type = "text/javascript" | ||
script.src = `//www.highperformancedformats.com/${atOptions.key}/invoke.js` | ||
conf.innerHTML = `atOptions = ${JSON.stringify(atOptions)}` | ||
|
||
banner.current.append(conf) | ||
banner.current.append(script) | ||
} | ||
}, [banner]) | ||
|
||
return ( | ||
<div | ||
className="mx-2 my-5 items-center justify-center border border-gray-200 text-center text-white" | ||
ref={banner} | ||
></div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters