Created
December 27, 2017 16:47
-
-
Save iamdanthedev/613750d0e60074a7103ce5c7c81f72c2 to your computer and use it in GitHub Desktop.
react storybook styled-components theme provider decorator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { StoryDecorator } from 'storybook__react'; | |
import { ThemeProvider } from 'styled-components'; | |
/** | |
* Storybook styled-components theme provider | |
*/ | |
export function withTheme(theme): StoryDecorator { | |
return function(render, context) { | |
return( | |
<ThemeProvider theme={ theme }> | |
{ render() } | |
</ThemeProvider> | |
); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment