@kadconsulting/dry
Version:
KAD Reusable Component Library
11 lines • 461 B
JavaScript
import { ThemeTypes } from '../../components/ThemeProvider';
/**
* A utility function to infer the theme (i.e., 'light' or 'dark')
* from the Storybook background.
*/
export const inferThemeType = (context) => {
if (!context.globals?.backgrounds?.value)
return ThemeTypes.LIGHT;
return context.parameters.backgrounds.values.find(({ value }) => value === context.globals?.backgrounds?.value).name;
};
//# sourceMappingURL=inferThemeType.js.map