-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement banner ads for articles (#66)
* Rename advertisements to MixedAdvertisements * Add Banner Ads that show up occasionally on top of article * Disable ads on humor and opinions articles as per charter * Slightly nerf ad chances
- Loading branch information
Showing
9 changed files
with
97 additions
and
35 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,26 @@ | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import banner_advertisements from "./BannerAdvertisements"; | ||
import styles from "../styles/Advertisement.module.css"; | ||
|
||
const BannerAdvertisement = (props: { index: number; show_ad: boolean }) => { | ||
let index = props.index % banner_advertisements.length; | ||
|
||
return ( | ||
<Link | ||
href={banner_advertisements[index].url} | ||
style={{ display: props.show_ad ? "block" : "none" }} | ||
> | ||
<div id={styles.parent_div}> | ||
<Image | ||
id={styles.image} | ||
src={banner_advertisements[index].image_src} | ||
fill | ||
alt={banner_advertisements[index].name + " ad"} | ||
/> | ||
</div> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default BannerAdvertisement; |
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,8 @@ | ||
const BannerAdvertisements = [ | ||
{ | ||
name: "Prompt College Application and Essay Coaching", | ||
image_src: "/images/ads/prompt_banner.png", | ||
url: "https://www.myprompt.com/", | ||
}, | ||
]; | ||
export default BannerAdvertisements; |
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,23 @@ | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import mixed_advertisements from "./MixedAdvertisements"; | ||
import styles from "../styles/Advertisement.module.css"; | ||
|
||
const MixedAdvertisement = (props: { index: number }) => { | ||
let index = props.index % mixed_advertisements.length; | ||
|
||
return ( | ||
<Link href={mixed_advertisements[index].url}> | ||
<div id={styles.parent_div}> | ||
<Image | ||
id={styles.image} | ||
src={mixed_advertisements[index].image_src} | ||
fill | ||
alt={mixed_advertisements[index].name + " ad"} | ||
/> | ||
</div> | ||
</Link> | ||
); | ||
}; | ||
|
||
export default MixedAdvertisement; |
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
This file was deleted.
Oops, something went wrong.
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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