Skip to content

Commit

Permalink
Fix wrong theme object and imports formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Philzen authored Dec 29, 2024
1 parent e066158 commit c907487
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react'
import { ChakraProvider, extendTheme, useColorMode } from '@chakra-ui/react'
import type { GlobalTypes } from '@storybook/csf'
import type { Preview, StoryContext, StoryFn } from '@storybook/react'

import theme from 'config/chakra.config'

const extendedTheme = extendTheme(theme)
Expand Down Expand Up @@ -31,7 +32,7 @@ const ColorModeSwitch = ({ colorMode }: { colorMode: 'light' | 'dark' }) => {
}

const withChakra = (Story: StoryFn, context: StoryContext) => {
theme.config.initialColorMode = context.globals.theme // avoids flash on reload for non-default color mode
extendedTheme.config.initialColorMode = context.globals.theme // avoids flash on reload for non-default color mode
return (
<ChakraProvider theme={extendedTheme}>
<ColorModeSwitch colorMode={context.globals.theme} />
Expand Down

0 comments on commit c907487

Please sign in to comment.