generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 39
/
preview.js
59 lines (51 loc) · 1.23 KB
/
preview.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { initializeWorker, mswDecorator } from "msw-storybook-addon";
import { CacheProvider } from "rest-hooks";
import { BrowserRouter } from "react-router-dom";
import { HelmetProvider } from "react-helmet-async";
import MockDate from "mockdate";
import "../src/content/generated/global.out.css";
// mock all dates in stories to make sure we don't run into date-related inconsistencies
MockDate.set("2023-01-01");
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
options: {
storySort: {
method: "alphabetical",
order: [],
},
},
};
initializeWorker();
function withRestHooksCacheProvider(Story) {
return (
<CacheProvider>
<Story />
</CacheProvider>
);
}
function withRouter(Story) {
return (
<BrowserRouter>
<Story />
</BrowserRouter>
);
}
function withHelmet(Story) {
return (
<HelmetProvider>
<Story />
</HelmetProvider>
);
}
export const decorators = [
withHelmet,
withRouter,
withRestHooksCacheProvider,
mswDecorator,
];