Skip to content

Commit 39b6fbb

Browse files
feat(storybook): build project-level modes for viewports
1 parent c62650d commit 39b6fbb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.storybook/preview.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import i18n, { baseLocales } from "./i18next"
77

88
const extendedTheme = extendBaseTheme(theme)
99

10-
const chakraBreakpointArray = Object.entries(extendedTheme.breakpoints)
10+
export const chakraBreakpointArray = Object.entries(extendedTheme.breakpoints)
1111

1212
const preview: Preview = {
1313
globals: {
@@ -23,6 +23,22 @@ const preview: Preview = {
2323
date: /Date$/i,
2424
},
2525
},
26+
chromatic: {
27+
modes: {
28+
...chakraBreakpointArray.reduce<{ [x: string]: { viewport: string } }>(
29+
(arr, curr) => {
30+
const [token] = curr
31+
return {
32+
...arr,
33+
[token]: {
34+
viewport: token,
35+
},
36+
}
37+
},
38+
{}
39+
),
40+
},
41+
},
2642
backgrounds: {
2743
disable: true,
2844
},

0 commit comments

Comments
 (0)