From 46e77352679bf29307193a35c953f03c4a4ad1db 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 cea100fd699..a24d57b552f 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);