Skip to content

Commit 8dfa2af

Browse files
Melissa Thompsoncastastrophe
authored andcommitted
fix(storybook): body classes for story and docs pages (#2617)
1 parent eb5facd commit 8dfa2af

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.storybook/decorators/contextsWrapper.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const withContextWrapper = makeDecorator({
88
name: "withContextWrapper",
99
parameterName: "context",
1010
wrapper: (StoryFn, context) => {
11-
const { args, argTypes, viewMode } = context;
11+
const { args, argTypes, id, viewMode } = context;
1212

1313
const getDefaultValue = (type) => {
1414
if (!type) return null;
@@ -31,7 +31,13 @@ export const withContextWrapper = makeDecorator({
3131
const scales = ["medium", "large"];
3232

3333
useEffect(() => {
34-
const container = viewMode === "docs" && !window.isChromatic() ? document.querySelector('#root-inner') ?? document.body : document.body;
34+
const container =
35+
viewMode === "docs" &&
36+
!window.isChromatic() &&
37+
!id.includes('foundation')
38+
? document.querySelector('#root-inner') ?? document.body
39+
: document.body;
40+
3541
container.classList.toggle("spectrum", true);
3642

3743
container.classList.toggle("spectrum--express", isExpress);

0 commit comments

Comments
 (0)