Skip to content

Commit

Permalink
storybook-emotion: Fix issue with GlobalStyles added after component …
Browse files Browse the repository at this point in the history
…styles
  • Loading branch information
ben-rogerson committed Jan 13, 2021
1 parent 69ed474 commit 14ed140
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions storybook-emotion/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React from 'react'
import { GlobalStyles, theme } from 'twin.macro'
import { CacheProvider } from '@emotion/react'
import createCache from '@emotion/cache'

const cache = createCache({ prepend: true, key: 'twin' })

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand All @@ -17,10 +21,9 @@ export const parameters = {

export const decorators = [
Story => (
<div>
{/* */}
<CacheProvider value={cache}>
<GlobalStyles />
<Story />
</div>
</CacheProvider>
),
]

0 comments on commit 14ed140

Please sign in to comment.