Skip to content

Commit

Permalink
add default options for addon-viewports via parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Aug 21, 2024
1 parent f9d8ccf commit 1a59b66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 0 additions & 3 deletions code/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,6 @@ export const parameters = {
'slategray',
],
},
viewport: {
options: MINIMAL_VIEWPORTS,
},
themes: {
disable: true,
},
Expand Down
2 changes: 1 addition & 1 deletion code/addons/viewport/preview.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { globals } from './dist/preview';
export * from './dist/preview';
9 changes: 9 additions & 0 deletions code/addons/viewport/src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PARAM_KEY as KEY } from './constants';
import { MINIMAL_VIEWPORTS } from './defaults';
import type { GlobalState } from './types';

const modern: Record<string, GlobalState> = {
Expand All @@ -9,3 +10,11 @@ const modern: Record<string, GlobalState> = {
const legacy = { viewport: 'reset', viewportRotated: false };

export const initialGlobals = FEATURES?.viewportStoryGlobals ? modern : legacy;

export const parameters = FEATURES?.viewportStoryGlobals
? {
[KEY]: {
options: MINIMAL_VIEWPORTS,
},
}
: {};

0 comments on commit 1a59b66

Please sign in to comment.