Docs/storybook improvements (#877)
* docs: use PageDecorator * docs: use decorators in TableHeader stories * docs: use theming parameter in App stories * docs: enable auto-generated docs for stories Closes #702
This commit is contained in:
30
front/src/testing/decorators/PageDecorator.tsx
Normal file
30
front/src/testing/decorators/PageDecorator.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import { HotkeysProvider } from 'react-hotkeys-hook';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { Decorator } from '@storybook/react';
|
||||
|
||||
import { ClientConfigProvider } from '../../modules/client-config/components/ClientConfigProvider';
|
||||
import { INITIAL_HOTKEYS_SCOPES } from '../../modules/ui/hotkey/constants';
|
||||
import { DefaultLayout } from '../../modules/ui/layout/components/DefaultLayout';
|
||||
import { UserProvider } from '../../modules/users/components/UserProvider';
|
||||
import { FullHeightStorybookLayout } from '../FullHeightStorybookLayout';
|
||||
|
||||
export type PageDecoratorArgs = { currentPath: string };
|
||||
|
||||
export const PageDecorator: Decorator<{ currentPath: string }> = (
|
||||
Story,
|
||||
{ args },
|
||||
) => (
|
||||
<UserProvider>
|
||||
<ClientConfigProvider>
|
||||
<HotkeysProvider initiallyActiveScopes={INITIAL_HOTKEYS_SCOPES}>
|
||||
<MemoryRouter initialEntries={[args.currentPath]}>
|
||||
<FullHeightStorybookLayout>
|
||||
<DefaultLayout>
|
||||
<Story />
|
||||
</DefaultLayout>
|
||||
</FullHeightStorybookLayout>
|
||||
</MemoryRouter>
|
||||
</HotkeysProvider>
|
||||
</ClientConfigProvider>
|
||||
</UserProvider>
|
||||
);
|
||||
Reference in New Issue
Block a user