Skip to content

Instantly share code, notes, and snippets.

@iamdanthedev
Created December 27, 2017 16:47
Show Gist options
  • Save iamdanthedev/613750d0e60074a7103ce5c7c81f72c2 to your computer and use it in GitHub Desktop.
Save iamdanthedev/613750d0e60074a7103ce5c7c81f72c2 to your computer and use it in GitHub Desktop.
react storybook styled-components theme provider decorator
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