diff --git a/components/HorizontalAdvertisement.tsx b/components/HorizontalAdvertisement.tsx new file mode 100644 index 0000000..d45585a --- /dev/null +++ b/components/HorizontalAdvertisement.tsx @@ -0,0 +1,26 @@ +import Image from "next/image"; +import Link from "next/link"; +import horizontalAdvertisements from "../horizontalAdvertisements"; +import styles from "../styles/Advertisement.module.css"; + +const HorizontalAdvertisement = (props: { index: number , section_id: number}) => { + let index = props.index % horizontalAdvertisements.length; + let section_id = props.section_id; + + if (section_id != 0 && section_id != 2) { + return ( + +
+ {horizontalAdvertisements[index].name +
+ + ); + } +}; + +export default HorizontalAdvertisement; diff --git a/horizontalAdvertisements.ts b/horizontalAdvertisements.ts new file mode 100644 index 0000000..9898dd6 --- /dev/null +++ b/horizontalAdvertisements.ts @@ -0,0 +1,8 @@ +const horizontalAdvertisements = [ + { + name: "placeholder", + image_src: "/images/ads/horizontal_ad_placeholder.jpg", + url: "..", + }, +]; +export default horizontalAdvertisements; diff --git a/pages/article/[article_slug].tsx b/pages/article/[article_slug].tsx index fde1e6c..baa1b1f 100644 --- a/pages/article/[article_slug].tsx +++ b/pages/article/[article_slug].tsx @@ -13,6 +13,7 @@ import ShareButton from "../../components/ShareButton"; import Link from "next/link"; import generate_contributors_jsx from "../../components/GenerateContributorsJSX"; import { generateMetaTags } from "../../utils/generateMetaTags"; +import HorizontalAdvertisement from "../../components/HorizontalAdvertisement"; interface Props { article: ReceivedArticle; @@ -160,7 +161,12 @@ function Article(props: Props) { {/* */} -
+
+ +
); diff --git a/public/images/ads/horizontal_ad_placeholder.jpg b/public/images/ads/horizontal_ad_placeholder.jpg new file mode 100644 index 0000000..b094356 Binary files /dev/null and b/public/images/ads/horizontal_ad_placeholder.jpg differ