Skip to content

Commit

Permalink
fix: resolves global styles not loading in storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitb35 committed Apr 11, 2024
1 parent 7d40828 commit aaf93c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import materialTheme from '../src/theme/themeStyles';
import { ThemeProvider } from '@storybook/theming';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n';
import { useEffect } from 'react';
import globalStyles from '../src/theme/theme';
import { lazy, useEffect } from 'react';
import { useTheme } from '../src/theme/themeContext';

// import { ThemeProvider } from 'emotion-theming';
Expand All @@ -16,6 +15,9 @@ import { useTheme } from '../src/theme/themeContext';
* Read more about them at:
* https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators
*/

const globalStyles = lazy(() => import('../src/theme/theme'));

export const decorators = [
(Story, context) => {
const { locale } = context.globals;
Expand Down
1 change: 1 addition & 0 deletions src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const getGlobalStyles = async () => {
}
} catch (err) {
console.log('Error in fetchConfig for getGlobalStyles', err);
return null;
}
};

Expand Down

0 comments on commit aaf93c5

Please sign in to comment.