From dde6c19e2abf27b25899ef27def77788e29e8385 Mon Sep 17 00:00:00 2001 From: Melissa Thompson Date: Mon, 1 Apr 2024 10:00:19 -0400 Subject: [PATCH] fix(storybook): body classes for story and docs pages (#2617) --- .storybook/decorators/contextsWrapper.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.storybook/decorators/contextsWrapper.js b/.storybook/decorators/contextsWrapper.js index d66044e47e1..9c445d16e47 100644 --- a/.storybook/decorators/contextsWrapper.js +++ b/.storybook/decorators/contextsWrapper.js @@ -8,7 +8,7 @@ export const withContextWrapper = makeDecorator({ name: "withContextWrapper", parameterName: "context", wrapper: (StoryFn, context) => { - const { args, argTypes, viewMode } = context; + const { args, argTypes, id, viewMode } = context; const getDefaultValue = (type) => { if (!type) return null; @@ -31,7 +31,13 @@ export const withContextWrapper = makeDecorator({ const scales = ["medium", "large"]; useEffect(() => { - const container = viewMode === "docs" && !window.isChromatic() ? document.querySelector('#root-inner') ?? document.body : document.body; + const container = + viewMode === "docs" && + !window.isChromatic() && + !id.includes('foundation') + ? document.querySelector('#root-inner') ?? document.body + : document.body; + container.classList.toggle("spectrum", true); container.classList.toggle("spectrum--express", isExpress);