mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 05:51:48 +08:00
Adjust the styled-component get theme snippet
This commit is contained in:
parent
8ffcdda6c9
commit
047c28afab
@ -2,7 +2,13 @@
|
|||||||
// .storybook/preview.js
|
// .storybook/preview.js
|
||||||
|
|
||||||
import { ThemeProvider } from 'styled-components';
|
import { ThemeProvider } from 'styled-components';
|
||||||
import { StoryContext, StoryGetter, StoryWrapper } from '@storybook/addons';
|
|
||||||
|
import { MyThemes } from '../my-theme-folder/my-theme-file'
|
||||||
|
|
||||||
|
// Function to obtain the intented theme
|
||||||
|
const getTheme= (themeName)=>{
|
||||||
|
return MyThemes[themeName]
|
||||||
|
}
|
||||||
|
|
||||||
const withThemeProvider=(Story,context)=>{
|
const withThemeProvider=(Story,context)=>{
|
||||||
const theme = getTheme(context.globals.theme);
|
const theme = getTheme(context.globals.theme);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user