Skip to content

Commit

Permalink
Turn off close button on announcement bar
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed May 21, 2023
1 parent d5baec1 commit 5cf7ad4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
24 changes: 13 additions & 11 deletions components/Announcement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Announcement.propTypes = {
hidden, enter showAnnouncements() into the devtools console.
*/

export default function Announcement({ id, headline, description, link }) {
export default function Announcement({ id, headline, description, link, showCloseButton = true}) {
const [closedAnnouncements, setClosedAnnouncements] = useLocalStorage(
"closed-announcements",
[]
);

const isClosed = closedAnnouncements.includes(id);
const isClosed = closedAnnouncements.includes(id) && showCloseButton;

const close = () => {
setClosedAnnouncements((closed) => [...closed, id]);
Expand All @@ -54,15 +54,17 @@ export default function Announcement({ id, headline, description, link }) {
<div className={styles.description}>{description}</div>
)}
</div>
<button
className={styles.closeButton}
onClick={(event) => {
event.preventDefault();
close();
}}
>
<i className="fas fa-times" />
</button>
{showCloseButton && (
<button
className={styles.closeButton}
onClick={(event) => {
event.preventDefault();
close();
}}
>
<i className="fas fa-times" />
</button>
)}
</div>

</Link>)
Expand Down
15 changes: 8 additions & 7 deletions public/content/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
headline="Join the Summer of Math Exposition!"
description="Create and discover new content, submit for a chance at prizes and a spot in a 3blue1brown video"
link="https://3blue1brown.substack.com/p/some3-begins"
showCloseButton={false}
/>


Expand All @@ -70,6 +71,13 @@

</Section>

<Section>

<iframe src="https://3blue1brown.substack.com/embed" width="480" height="180" />

</Section>


<Section width="narrow">

<Portrait image="images/home/patreon-logo.svg" />
Expand All @@ -96,10 +104,3 @@ This model allows for the lessons to remain free from brand integrations and spo
</Center>

</Section>

<Section>

<iframe src="https://3blue1brown.substack.com/embed" width="480" height="180" />

</Section>

0 comments on commit 5cf7ad4

Please sign in to comment.