Skip to content

Commit

Permalink
Fix storybook styled-jsx example with styled-jsx 5 (#31357)
Browse files Browse the repository at this point in the history
## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

x-ref: vercel/styled-jsx#761

Since next.js is using styled-jsx v5 beta now, it requires wrapping a `StyleRegistry` component on the root top.
ref: [styled-jsx doc](https://github.com/vercel/styled-jsx/tree/beta#server-side-rendering)
  • Loading branch information
huozhi committed Nov 15, 2021
1 parent 61ca736 commit 0afc1d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions examples/with-storybook-styled-jsx-scss/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import { StyleRegistry } from 'styled-jsx'

export const decorators = [
(Story) => (
<StyleRegistry>
<Story />
</StyleRegistry>
),
]

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
}
2 changes: 1 addition & 1 deletion examples/with-storybook-styled-jsx-scss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build-storybook": "build-storybook --no-dll"
},
"dependencies": {
"next": "^10.0.0",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
Expand Down

0 comments on commit 0afc1d2

Please sign in to comment.