@aarhus-university/au-lib-react-components 10.20.5 → 10.20.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "@aarhus-university/au-lib-react-components",
4
- "version": "10.20.5",
4
+ "version": "10.20.7",
5
5
  "description": "Library for shared React components for various applications on au.dk",
6
6
  "scripts": {
7
7
  "test": "jest",
@@ -29,7 +29,7 @@ const globalLang = (items = ['da', 'en'], defaultValue = 'da') => ({
29
29
  },
30
30
  });
31
31
 
32
- const ThemeWrapper = ({ theme, children }) => {
32
+ const ThemeWrapper = ({ theme, children, withPageContentBlock }) => {
33
33
  useEffect(() => {
34
34
  const body = document.querySelector('body');
35
35
  if (body) {
@@ -38,19 +38,36 @@ const ThemeWrapper = ({ theme, children }) => {
38
38
  body.classList.add(`theme--${theme}`);
39
39
  }
40
40
  });
41
+
42
+ if (withPageContentBlock) {
43
+ return (
44
+ <StrictMode>
45
+ <div className="page">
46
+ <main className={`theme--${theme} page__content`}>
47
+ <div className="page__content__block">
48
+ {children}
49
+ </div>
50
+ </main>
51
+ </div>
52
+ </StrictMode>
53
+ );
54
+ }
55
+
41
56
  return (
42
57
  <StrictMode>
43
58
  <div className="page">
44
59
  <main className={`theme--${theme} page__content`}>
45
- <div className="page__content__block">
46
- {children}
47
- </div>
60
+ {children}
48
61
  </main>
49
62
  </div>
50
63
  </StrictMode>
51
64
  );
52
65
  }
53
66
 
67
+ ThemeWrapper.defaultProps = {
68
+ withPageContentBlock: true,
69
+ };
70
+
54
71
  const ThemeLanguageWrapper = ({
55
72
  theme,
56
73
  children,
@@ -58,6 +75,7 @@ const ThemeLanguageWrapper = ({
58
75
  importPromises,
59
76
  translationContext,
60
77
  lang,
78
+ withPageContentBlock,
61
79
  }) => {
62
80
  const translations = useTranslation<typeof defaultLabels>(defaultLabels, importPromises, lang);
63
81
  useEffect(() => {
@@ -68,14 +86,29 @@ const ThemeLanguageWrapper = ({
68
86
  body.classList.add(`theme--${theme}`);
69
87
  }
70
88
  });
89
+
90
+ if (withPageContentBlock) {
91
+ return (
92
+ <StrictMode>
93
+ <translationContext.Provider value={translations}>
94
+ <div className="page">
95
+ <main className={`theme--${theme} page__content`}>
96
+ <div className="page__content__block">
97
+ {children}
98
+ </div>
99
+ </main>
100
+ </div>
101
+ </translationContext.Provider>
102
+ </StrictMode>
103
+ );
104
+ }
105
+
71
106
  return (
72
107
  <StrictMode>
73
108
  <translationContext.Provider value={translations}>
74
109
  <div className="page">
75
110
  <main className={`theme--${theme} page__content`}>
76
- <div className="page__content__block">
77
- {children}
78
- </div>
111
+ {children}
79
112
  </main>
80
113
  </div>
81
114
  </translationContext.Provider>
@@ -83,6 +116,9 @@ const ThemeLanguageWrapper = ({
83
116
  );
84
117
  }
85
118
 
119
+ ThemeLanguageWrapper.defaultProps = {
120
+ withPageContentBlock: true,
121
+ };
86
122
 
87
123
  export {
88
124
  globalTheme,