Skip to content

Commit

Permalink
Ad ads banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoannis Sánchez Soto committed Nov 16, 2024
1 parent 8440912 commit e7b3bc9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
33 changes: 33 additions & 0 deletions components/ads/ad-banner.tsx
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>
)
}
3 changes: 3 additions & 0 deletions components/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { Progress } from "@/components/ui/progress"
import { Icons } from "@/components/icons"
import { Loader } from "@/components/loader"

import AdBanner from "./ads/ad-banner"
import ImageSettings from "./settings/ImageSettings"
import { ThemeToggle } from "./theme-toggle"

Expand Down Expand Up @@ -404,6 +405,8 @@ export const Editor = () => {
Select an image to edit
</p>
)}

<AdBanner></AdBanner>
</div>

{/* Image Queue */}
Expand Down

0 comments on commit e7b3bc9

Please sign in to comment.