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

add banner to community events page [fixes #11838] #12174

Merged
merged 7 commits into from
Feb 14, 2024
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
28 changes: 28 additions & 0 deletions src/components/DevconGrantsBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Emoji from "react-emoji-render"
import { Text } from "@chakra-ui/react"

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

interface IProps {
pathname: string
}

const DevconGrantsBanner: React.FC<IProps> = ({ pathname }) => {
if (pathname.includes("community") && pathname.includes("events")) {
return (
<DismissableBanner storageKey="devconGrants">
<Text m={0}>
The Road to Devcon Grants support Ethereum education initiatives in
and close to Southeast Asia <Emoji text="🌏🦄" />{" "}
Learn more{" "}
<Link to="https://esp.ethereum.foundation/devcon-grants">here.</Link>
</Text>
</DismissableBanner>
)
}

return null
}

export default DevconGrantsBanner
4 changes: 3 additions & 1 deletion src/layouts/Static.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { MdPageContent, StaticFrontmatter } from "@/lib/interfaces"
import Breadcrumbs from "@/components/Breadcrumbs"
import Callout from "@/components/Callout"
import Contributors from "@/components/Contributors"
import DevconGrantsBanner from "@/components/DevconGrantsBanner"
import EnergyConsumptionChart from "@/components/EnergyConsumptionChart"
import FeedbackCard from "@/components/FeedbackCard"
import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition"
Expand Down Expand Up @@ -91,12 +92,13 @@ export const StaticLayout = ({
lastUpdatedDate,
contentNotTranslated,
}: StaticLayoutProps) => {
const { locale } = useRouter()
const { locale, asPath } = useRouter()

const absoluteEditPath = getEditPath(slug)

return (
<Box w="full">
<DevconGrantsBanner pathname={asPath} />
<Flex
justifyContent="space-between"
w="full"
Expand Down
Loading