Skip to content

Commit

Permalink
🐛 easier mode disable
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed Oct 11, 2023
1 parent 86b513c commit e6ac335
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .storybook/modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import { primerThemes } from './primer-preview';
const defaultThemes = ['light', 'dark'];

export const defaultModes = {};
export const defaultModesDisabled = {};
export const githubModes = {};

for (const key of Object.keys(customViewports)) {
defaultModes[key] = {
viewport: key,
};
defaultModesDisabled[key] = {
disabled: true,
};
githubModes[key] = {
viewport: key,
};
Expand All @@ -23,6 +27,9 @@ for (const key of Object.keys(customViewports)) {
viewport: key,
theme: theme,
};
defaultModesDisabled[`${theme} ${key}`] = {
disabled: true,
};
};
for (const theme of primerThemes) {
githubModes[`primer ${theme.value} ${key}`] = {
Expand Down
9 changes: 3 additions & 6 deletions src/github/user/user.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { parseFetchedUser } from './content';
import { parseFetchedRepo } from '../repository/content.js';
import { getElements, ensureElements } from './user.shared-spec';
import { primerThemes } from '../../../.storybook/primer-preview.js';
import { defaultModesDisabled } from '../../../.storybook/modes.js';

import '.';

Expand Down Expand Up @@ -193,9 +194,7 @@ export const Themes = {
parameters: {
chromatic: {
modes: {
containerMin1: { disable: true },
containerMin2: { disable: true },
containerMin3: { disable: true },
...defaultModesDisabled
}
},
},
Expand All @@ -209,9 +208,7 @@ export const ThemesWithOverrides = {
parameters: {
chromatic: {
modes: {
containerMin1: { disable: true },
containerMin2: { disable: true },
containerMin3: { disable: true },
...defaultModesDisabled
}
},
},
Expand Down

0 comments on commit e6ac335

Please sign in to comment.