Skip to content

Commit df6e3c0

Browse files
authored
Temporary fix for S2 storybook crash when showing code in dark mode (#7135)
1 parent 25f304d commit df6e3c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.storybook-s2/preview.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const preview = {
2727
channel.on(DARK_MODE_EVENT_NAME, setDark);
2828
return () => channel.removeListener(DARK_MODE_EVENT_NAME, setDark);
2929
}, []);
30-
return <DocsContainer {...props} theme={{...(dark ? themes.dark : themes.light), appContentBg: 'var(--s2-container-bg)'}} />;
30+
var style = getComputedStyle(document.body)
31+
return <DocsContainer {...props} theme={{...(dark ? themes.dark : themes.light), appContentBg: style.getPropertyValue('--s2-container-bg').trim()}} />;
3132
},
3233
source: {
3334
// code: null, // Will disable code button, and show "No code available"
@@ -68,7 +69,7 @@ const preview = {
6869
storySort: {
6970
order: ['Intro', 'Style Macro', 'Workflow Icons', 'Illustrations', 'Migrating', 'Release Notes'],
7071
method: 'alphabetical'
71-
}
72+
}
7273
}
7374
},
7475
argTypes: {

0 commit comments

Comments
 (0)