build(#10336): isChromatic

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-04-02 21:30:43 +09:00
parent 388ecfb1ea
commit faf827a50a
No known key found for this signature in database
GPG key ID: 3E87B98A3F6BAB99
3 changed files with 5 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import { addons } from '@storybook/addons'; import { addons } from '@storybook/addons';
import { FORCE_REMOUNT } from '@storybook/core-events'; import { FORCE_REMOUNT } from '@storybook/core-events';
import { type Preview, setup } from '@storybook/vue3'; import { type Preview, setup } from '@storybook/vue3';
import isChromatic from 'chromatic/isChromatic';
import { initialize, mswDecorator } from 'msw-storybook-addon'; import { initialize, mswDecorator } from 'msw-storybook-addon';
import locale from './locale'; import locale from './locale';
import { commonHandlers, onUnhandledRequest } from './mocks'; import { commonHandlers, onUnhandledRequest } from './mocks';
@ -18,6 +19,8 @@ function loadTheme(applyTheme: typeof import('../src/scripts/theme')['applyTheme
const theme = themes[document.documentElement.dataset.misskeyTheme]; const theme = themes[document.documentElement.dataset.misskeyTheme];
if (theme) { if (theme) {
applyTheme(themes[document.documentElement.dataset.misskeyTheme]); applyTheme(themes[document.documentElement.dataset.misskeyTheme]);
} else if (isChromatic()) {
applyTheme(themes['l-light']);
} }
const observer = new MutationObserver((entries) => { const observer = new MutationObserver((entries) => {
for (const entry of entries) { for (const entry of entries) {

View file

@ -24,7 +24,7 @@ export const Default = {
}; };
}, },
args: { args: {
static: isChromatic, static: isChromatic(),
}, },
parameters: { parameters: {
layout: 'centered', layout: 'centered',

View file

@ -24,7 +24,7 @@ export const Default = {
}; };
}, },
args: { args: {
static: isChromatic, static: isChromatic(),
}, },
parameters: { parameters: {
layout: 'centered', layout: 'centered',