Skip to content

Commit

Permalink
Merge pull request #147 from savindi7/update-icons-and-theme
Browse files Browse the repository at this point in the history
chore(react): fix theme in component stories
  • Loading branch information
savindi7 authored Jun 25, 2023
2 parents 9d6cbd1 + ea95036 commit 3de8442
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/react/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -16,7 +16,7 @@
* under the License.
*/

import {PropsWithChildren} from 'react';
import {PropsWithChildren, useEffect} from 'react';
import {addParameters, Story, StoryContext} from '@storybook/react';
import {DocsContainer, DocsContainerProps, DocsPage} from '@storybook/addon-docs';
import {
Expand All @@ -33,9 +33,14 @@ import {extendTheme} from '../src/theme';
*
* @param Story - Story component.
* @param context - Story context.
* @returns Stroy wrapped in providers.
* @returns Story wrapped in providers.
*/
const withProviders = (Story: Story, context: StoryContext) => {
// Set 'oxygen-mode' to the Storybook theme
useEffect(() => {
localStorage.setItem('oxygen-mode', JSON.parse(localStorage.getItem('sb-addon-themes-3'))?.current);
}, []);

return (
<ThemeProvider
theme={extendTheme({
Expand Down

0 comments on commit 3de8442

Please sign in to comment.