fix(ui-components): apply theme classes to Storybook preview body (#53974)

This commit is contained in:
Huyen Nguyen
2024-03-05 08:45:33 +01:00
committed by GitHub
parent 2f275b6808
commit e9f0fe6bfa
+9 -5
View File
@@ -41,9 +41,13 @@ function renderTheme(Story, context) {
// Use the value of the default background to prevent "undefined" className
const className = selectedBackgroundName || parameters.backgrounds.default;
return (
<div className={className}>
<Story />
</div>
);
if (className === 'light-palette') {
document.body.classList.remove('dark-palette');
document.body.classList.add('light-palette');
} else {
document.body.classList.remove('light-palette');
document.body.classList.add('dark-palette');
}
return <Story />;
}