Skip to content

Commit

Permalink
fix(storybook): body classes for story and docs pages (#2617)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdt2 authored and castastrophe committed Apr 1, 2024
1 parent e700715 commit 810fa5e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .storybook/decorators/contextsWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 810fa5e

Please sign in to comment.