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

[legacy-framework] Recipe: Styled Components #2087

Merged
merged 9 commits into from
Mar 8, 2021
Merged

[legacy-framework] Recipe: Styled Components #2087

merged 9 commits into from
Mar 8, 2021

Conversation

kevinlangleyjr
Copy link
Collaborator

What are the changes and their implications?

This PR adds a recipe to integrate styled-components.

Within the recipe, we're using the same method of adding a customized getInitialProps as the material-ui recipe, here.

I also think this would be greatly benefited by changing the logic to to check if the method already exists and modify it, instead of always adding it and assuming that it hasn't already been added.

But I also think it's a good idea to provide a recipe for this sooner rather than later. When we build out the logic to conditionally adjust the getInitialProps method, we can use the same logic here and in the material-ui recipe.

Checklist

  • Changes covered by tests (tests added if needed)
  • PR submitted to blitzjs.com for any user facing changes

@Skn0tt Skn0tt self-requested a review March 8, 2021 12:39
Copy link
Member

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

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

Hi @kevinlangleyjr! Nice work, I like it.

In Next.js's official styled-components example, styleSheet.seal() gets called:

https://github.com/vercel/next.js/blob/33255b7f4ed6dd2608d6a6590d137353b6f19f67/examples/with-styled-components/pages/_document.js#L27

Is there a reason this is not included in this recipe?

Also, babel-plugin-styled-components is installed but not added to babel.config.js. Take a look at how the emotion / reflexjs recipes do this, I think you can adapt their code.

@kevinlangleyjr
Copy link
Collaborator Author

Doh! You're right @Skn0tt - I forgot about the sheet.seal() call and adding the babel plugin, sorry about that.

My latest commits correctly add the try/finally, sheet.seal(), and the babel plugin.

Let me know if there is anything else needed to get this merged 🙂

@kevinlangleyjr kevinlangleyjr requested a review from Skn0tt March 8, 2021 13:51
@Skn0tt Skn0tt added the 0 - <(^_^)> - merge it! ✌️ Kodiak automerge label Mar 8, 2021
@Skn0tt
Copy link
Member

Skn0tt commented Mar 8, 2021

@allcontributors please add kevinlangleyjr for code

@allcontributors
Copy link

@Skn0tt

@kevinlangleyjr already contributed before to code

@kodiakhq kodiakhq bot merged commit 2cd377e into blitz-js:canary Mar 8, 2021
@kevinlangleyjr kevinlangleyjr deleted the recipe/styled-components branch March 8, 2021 21:35
@itsdillon itsdillon changed the title Recipe: Styled Components [legacy-framework] Recipe: Styled Components Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants