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

Writing cohort banner #10078

Merged
merged 6 commits into from
Apr 27, 2023
Merged

Writing cohort banner #10078

merged 6 commits into from
Apr 27, 2023

Conversation

corwintines
Copy link
Member

Description

  • Adds a DismissableBanner to promote the ethereum.org writing cohort

@gatsby-cloud
Copy link

gatsby-cloud bot commented Apr 26, 2023

✅ ethereum-org-website-dev deploy preview ready

Copy link
Member

@pettinarip pettinarip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I left a comment for improvement.

const WritersCohortBanner = () => {
if (
typeof window !== `undefined` &&
window.location.pathname.includes("contributing")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For SSR purposes, a better way of getting the pathname is from Gatsby itself (or specifically from reach router which is what they use underneath).

// every page or template receives a `location` prop
const StaticPage = ({ data, location }) => {
  ...
}

// then you can pass that prop down to the components
<WritersCohortBanner pathname={location.pathname} />

This way you abstract yourself from the window object and you can render the same thing server and client side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, changed this PR over to this just now.

@github-actions github-actions bot added the content 🖋️ This involves copy additions or edits label Apr 27, 2023
Co-authored-by: Pablo Pettinari <pettinarip@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 🖋️ This involves copy additions or edits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants