Skip to content

Commit

Permalink
Amend to StoryFn
Browse files Browse the repository at this point in the history
  • Loading branch information
kanatagu committed Nov 23, 2023
1 parent 7854640 commit da22299
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react'
import { ChakraProvider, useColorMode } from '@chakra-ui/react'
import { Story } from '@storybook/react'
import { StoryFn } from '@storybook/react'
import { customTheme } from '../app/theme'

type ColorModeProps = {
Expand All @@ -18,15 +18,13 @@ function ColorMode(props: ColorModeProps) {
return props.children
}

const withChakra = (Story: Story, context) => {
return (
<ChakraProvider theme={customTheme}>
<ColorMode colorMode={context.globals.colorMode}>
<Story />
</ColorMode>
</ChakraProvider>
)
}
const withChakra = (StoryFn: StoryFn, context) => (
<ChakraProvider theme={customTheme}>
<ColorMode colorMode={context.globals.colorMode}>
<StoryFn />
</ColorMode>
</ChakraProvider>
)

export const decorators = [withChakra]

Expand Down

0 comments on commit da22299

Please sign in to comment.