Skip to content

Commit

Permalink
Add text banner component and use it for elect on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
leomet07 committed Nov 4, 2024
1 parent f003477 commit ad3c639
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
18 changes: 18 additions & 0 deletions advertisements/BannerText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Image from "next/image";
import Link from "next/link";
import styles from "../styles/Advertisement.module.css";

const BannerText = (props: { text: string; url: string; }) => {

return (
<Link
href={props.url}
>
<div className={styles.banner_text_parent}>
<h1>{props.text}</h1>
</div>
</Link>
);
};

export default BannerText;
2 changes: 2 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { get_articles_by_query } from "../db";
import { ReceivedArticle } from "../ts_types/db_types";

import MixedArticleDisplay from "../components/MixedArticleDisplay";
import BannerText from "../advertisements/BannerText";
interface Props {
articles: [ReceivedArticle];
}
Expand All @@ -24,6 +25,7 @@ async function fetch_addtional_articles(skip?: number, max?: number) {
function Home(props: Props) {
return (
<main id={styles.main}>
<BannerText text="Read The Spectator's special issue covering all levels of the 2024 election!" url="/volume/115/issue/0" />
<MixedArticleDisplay
articles={props.articles}
display_department={true}
Expand Down
23 changes: 23 additions & 0 deletions styles/Advertisement.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,26 @@
position: relative !important;
height: unset !important;
}

.banner_text_parent {
padding: 1rem;
margin-bottom: 1rem;
width: 100%;

background-color: var(--accent);
color: var(--primary-immutable);
border-radius: 5px;

text-align: center;
text-decoration: underline;
}

@media screen and (max-width: 1000px) {
.banner_text_parent {
padding-inline: 0.5rem;
}

.banner_text_parent h1 {
font-size: 1.5rem;
}
}

0 comments on commit ad3c639

Please sign in to comment.