Skip to content

Commit

Permalink
test(storybook): stories for the details sidebar (#102)
Browse files Browse the repository at this point in the history
Add stories for details sidebar components. Mock data selection API requests with MSW. Add some mock features and API responses in `src/mocks`.
  • Loading branch information
eatyourgreens authored Aug 13, 2024
1 parent 1be87ec commit c3547f6
Show file tree
Hide file tree
Showing 16 changed files with 2,051 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ const config: StorybookConfig = {
name: '@storybook/react-vite',
options: {},
},
staticDirs: ['../public'],
};
export default config;
9 changes: 9 additions & 0 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import * as React from 'react';
import type { Preview } from '@storybook/react';
import { initialize, mswLoader } from 'msw-storybook-addon';
import { atom, RecoilRoot } from 'recoil';
import { useSyncRecoilState } from '../src/lib/recoil/sync-state';
import { viewStateEffect } from '../src/app/state/view';
import { useStateEffect } from '../src/lib/recoil/state-effects/use-state-effect';

/*
* Initializes MSW
* See https://github.com/mswjs/msw-storybook-addon#configuring-msw
* to learn how to customize it
*/
initialize();

const mockViewState = atom({
key: 'mockViewState',
default: 'exposure',
Expand Down Expand Up @@ -34,6 +42,7 @@ const preview: Preview = {
</RecoilRoot>
),
],
loaders: [mswLoader],
};

export default preview;
Loading

0 comments on commit c3547f6

Please sign in to comment.