mirror of
https://github.com/PostHog/posthog.git
synced 2024-11-28 09:16:49 +01:00
14 lines
368 B
TypeScript
14 lines
368 B
TypeScript
import type { Decorator } from '@storybook/react'
|
|
|
|
/** Global story decorator that is used by the theming control to
|
|
* switch between themes.
|
|
*/
|
|
export const withTheme: Decorator = (Story, context) => {
|
|
const theme = context.globals.theme
|
|
|
|
// set the theme
|
|
document.body.setAttribute('theme', theme === 'dark' ? 'dark' : 'light')
|
|
|
|
return <Story />
|
|
}
|