@aarhus-university/au-lib-react-components 10.18.1 → 10.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/stories/lib/helpers.tsx +25 -1
package/package.json
CHANGED
package/stories/lib/helpers.tsx
CHANGED
|
@@ -29,7 +29,29 @@ const globalLang = (items = ['da', 'en'], defaultValue = 'da') => ({
|
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
const ThemeWrapper = ({
|
|
32
|
+
const ThemeWrapper = ({ theme, children }) => {
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const body = document.querySelector('body');
|
|
35
|
+
if (body) {
|
|
36
|
+
body.classList.remove('theme--normal');
|
|
37
|
+
body.classList.remove('theme--dark');
|
|
38
|
+
body.classList.add(`theme--${theme}`);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return (
|
|
42
|
+
<StrictMode>
|
|
43
|
+
<main className={`theme--${theme}`}>
|
|
44
|
+
<div className="page">
|
|
45
|
+
<div className="page__content__block">
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</main>
|
|
50
|
+
</StrictMode>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const ThemeLanguageWrapper = ({
|
|
33
55
|
theme,
|
|
34
56
|
children,
|
|
35
57
|
defaultLabels,
|
|
@@ -60,8 +82,10 @@ const ThemeWrapper = ({
|
|
|
60
82
|
);
|
|
61
83
|
}
|
|
62
84
|
|
|
85
|
+
|
|
63
86
|
export {
|
|
64
87
|
globalTheme,
|
|
65
88
|
globalLang,
|
|
66
89
|
ThemeWrapper,
|
|
90
|
+
ThemeLanguageWrapper,
|
|
67
91
|
};
|