0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 18:07:17 +01:00
posthog/.storybook/decorators/withFeatureFlags.tsx
Thomas Obermüller 0b25f54e86
test(storybook): add more insight card examples (#15906)
* add global withFeatureFlags story decorator

* add more examples for insight cards

* Update UI snapshots for `chromium` (2)

* use cached results for all dashboard placements

* Update UI snapshots for `chromium` (2)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-08 21:02:46 +00:00

23 lines
568 B
TypeScript

import { useFeatureFlags } from '~/mocks/browser'
import type { DecoratorFn } from '@storybook/react'
/** Global story decorator that allows setting feature flags.
*
* ```ts
* export default {
* title: 'My story',
* component: MyComponent,
* parameters: {
* featureFlags: ['hogql'], // add flags here
* },
* } as ComponentMeta<typeof MyComponent>
* ```
*/
export const withFeatureFlags: DecoratorFn = (Story, { parameters }) => {
if (parameters.featureFlags) {
useFeatureFlags(parameters.featureFlags)
}
return <Story />
}