Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added banner on community page #11319

Merged
merged 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@
"fromPath": "/staking/withdraws",
"toPath": "/en/staking/withdrawals/"
},
{
"fromPath": "/*/writing-cohort",
"toPath": "https://ethereumwriterscohort.carrd.co/"
},
{
"fromPath": "/*/staking/withdraws",
"toPath": "/:splat/staking/withdrawals/"
Expand Down
33 changes: 33 additions & 0 deletions src/components/Banners/Implementations/WritersCohortBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react"
import { Text } from "@chakra-ui/react"

import DismissableBanner from "../DismissableBanner"
import Link from "../../Link"

interface IProps {
pathname: string
}

const WritersCohortBanner: React.FC<IProps> = ({ pathname }) => {
if (
pathname.includes("contributing") ||
pathname.includes("community") ||
pathname === "/"
) {
return (
<DismissableBanner storageKey="writersCohort">
<Text m={0}>
🎉 Join the 2nd edition of ethereum.org's Writers Cohort, starting
October 20th.{" "}
<Link to="https://ethereumwriterscohort.carrd.co/">
Sign up here!
</Link>
</Text>
</DismissableBanner>
)
}

return null
}

export default WritersCohortBanner
3 changes: 3 additions & 0 deletions src/pages/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import PageMetadata from "../components/PageMetadata"
import Translation from "../components/Translation"
import PageHero from "../components/PageHero"
import FeedbackCard from "../components/FeedbackCard"

import WritersCohortBanner from "../components/Banners/Implementations/WritersCohortBanner"
import GatsbyImage from "../components/GatsbyImage"
import OldHeading from "../components/OldHeading"

Expand Down Expand Up @@ -209,6 +211,7 @@ const CommunityPage = ({
title={t("page-community-meta-title")}
description={t("page-community-meta-description")}
/>
<WritersCohortBanner pathname={location.pathname} />
<PageHero isReverse content={heroContent} />
<Divider />
<Flex
Expand Down
4 changes: 4 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import Translation from "../components/Translation"
import TitleCardList, { ITitleCardItem } from "../components/TitleCardList"
import Text from "../components/OldText"
import GatsbyImage from "../components/GatsbyImage"
import WritersCohortBanner from "../components/Banners/Implementations/WritersCohortBanner"

import { isLangRightToLeft } from "../utils/translations"
import { getImage } from "../utils/image"

Expand Down Expand Up @@ -178,6 +180,7 @@ const PageHeader = () => (
const HomePage = ({
data,
pageContext: { language = "en" },
location,
}: PageProps<Queries.IndexPageQuery, Context>) => {
const { t } = useTranslation()
const [isModalOpen, setModalOpen] = useState(false)
Expand Down Expand Up @@ -280,6 +283,7 @@ const HomePage = ({

return (
<Flex flexDirection="column" alignItems="center" dir={dir} width="full">
<WritersCohortBanner pathname={location.pathname} />
<PageMetadata
title={t("page-index-meta-title")}
description={t("page-index-meta-description")}
Expand Down
3 changes: 3 additions & 0 deletions src/templates/static.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { Item as ItemTableOfContents } from "../components/TableOfContents/utils
import Text from "../components/OldText"
import GlossaryDefinition from "../components/Glossary/GlossaryDefinition"
import GlossaryTooltip from "../components/Glossary/GlossaryTooltip"
import WritersCohortBanner from "../components/Banners/Implementations/WritersCohortBanner"
import MdLink from "../components/MdLink"
import OldHeading from "../components/OldHeading"

Expand Down Expand Up @@ -253,6 +254,8 @@ const StaticPage = ({
translationString={postMergeBannerTranslationString!}
/>
)}

<WritersCohortBanner pathname={location.pathname} />
<Flex
justifyContent="space-between"
w="full"
Expand Down