mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
fix(ui-components): apply theme classes to Storybook preview body (#53974)
This commit is contained in:
@@ -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 />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user