@aarhus-university/au-lib-react-components 10.6.0 → 10.9.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.
Files changed (97) hide show
  1. package/.eslintrc.js +34 -34
  2. package/.storybook/main.js +20 -7
  3. package/.storybook/preview.js +10 -10
  4. package/README.md +19 -19
  5. package/__tests__/jest/AUButtonComponent.test.tsx +165 -163
  6. package/__tests__/jest/AUErrorComponent.test.tsx +142 -0
  7. package/__tests__/jest/AUModalComponent.test.tsx +186 -0
  8. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -0
  9. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  10. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -0
  11. package/__tests__/jest/helpers.test.ts +15 -15
  12. package/__tests__/jest/setupTests.ts +2 -2
  13. package/babel.config.js +8 -8
  14. package/build/umd/universe.js.map +1 -1
  15. package/package.json +108 -107
  16. package/src/components/AUAlertComponent.tsx +70 -70
  17. package/src/components/AUAutoSuggestComponent.js +158 -158
  18. package/src/components/AUButtonComponent.tsx +83 -77
  19. package/src/components/AUCalendarComponent.tsx +493 -493
  20. package/src/components/AUContentToggleComponent.tsx +33 -33
  21. package/src/components/AUDatepickerComponent.tsx +117 -117
  22. package/src/components/AUErrorComponent.tsx +78 -0
  23. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  24. package/src/components/AUModalComponent.tsx +64 -80
  25. package/src/components/AUNotificationComponent.tsx +42 -0
  26. package/src/components/AUReceiptComponent.tsx +33 -33
  27. package/src/components/AUSpinnerComponent.tsx +33 -33
  28. package/src/components/AUSubNavComponent.tsx +48 -48
  29. package/src/components/AUSubmitButtonContainerComponent.tsx +31 -31
  30. package/src/components/AUTabbedContentComponent.tsx +145 -145
  31. package/src/components/AUTableComponent.tsx +24 -24
  32. package/src/components/AUToastComponent.tsx +103 -103
  33. package/src/components/AUToolbarComponent.tsx +52 -45
  34. package/src/components/profile/AUProfileActions.js +128 -128
  35. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  36. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  37. package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -42
  38. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  39. package/src/components/profile/AUProfileHooks.js +30 -30
  40. package/src/components/profile/AUProfileItemComponent.js +54 -54
  41. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  42. package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
  43. package/src/components/profile/AUProfileMailComponent.js +307 -307
  44. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  45. package/src/components/profile/AUProfileNameComponent.js +253 -253
  46. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  47. package/src/components/profile/AUProfileReducer.js +230 -230
  48. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  49. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  50. package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -122
  51. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  52. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  53. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  54. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  55. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  56. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  57. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  58. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  59. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  60. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  61. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  62. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  63. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  64. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  65. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  66. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  67. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  68. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  69. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  70. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  71. package/src/layout-2016/lib/all.js +3 -3
  72. package/src/layout-2016/lib/au-alphabox.js +100 -100
  73. package/src/layout-2016/lib/au-databox.js +400 -400
  74. package/src/layout-2016/lib/au-diagramme.js +85 -85
  75. package/src/layout-2016/lib/au-flowbox.js +93 -93
  76. package/src/layout-2016/lib/universe.js +9 -9
  77. package/src/lib/helpers.ts +194 -194
  78. package/src/lib/hooks.ts +37 -33
  79. package/src/lib/i18n.ts +600 -600
  80. package/src/lib/tracking.ts +69 -69
  81. package/src/lib/wrapping.ts +21 -21
  82. package/src/styles/_settings.scss +10 -10
  83. package/src/styles/alphabox.scss +222 -222
  84. package/src/styles/app.scss +7 -7
  85. package/src/styles/autosuggest.scss +57 -57
  86. package/src/styles/databox.scss +563 -563
  87. package/src/styles/diagramme.scss +119 -119
  88. package/src/styles/flowbox.scss +72 -72
  89. package/src/styles/maps.scss +395 -395
  90. package/stories/AUButtonComponent.stories.tsx +85 -85
  91. package/stories/AUErrorComponent.stories.tsx +117 -0
  92. package/stories/AUModalComponent.stories.tsx +92 -0
  93. package/stories/AUNotificationComponent.stories.tsx +116 -0
  94. package/stories/AUSpinnerComponent.stories.tsx +41 -41
  95. package/stories/AUToolbarComponent.stories.tsx +96 -0
  96. package/tsconfig.json +46 -46
  97. package/webpack.config.js +89 -89
@@ -1,363 +1,363 @@
1
- /* eslint-disable jsx-a11y/interactive-supports-focus */
2
- /* eslint-disable jsx-a11y/click-events-have-key-events */
3
- /* eslint-disable jsx-a11y/control-has-associated-label */
4
- /* eslint-env browser */
5
- /* eslint max-len: 0 */
6
- import React from 'react';
7
- import ReactDOM from 'react-dom';
8
- import PropTypes from 'prop-types';
9
- import AUCollapsibleComponent from '../common/AUCollapsibleComponent';
10
- import AUProfileLoginComponent from '../../../components/profile/AUProfileLoginComponent';
11
- import AUProfileAvatar2016Component from '../profile/AUProfileAvatar2016Component';
12
- import { getCookie, setCookie } from '../../../lib/helpers';
13
-
14
- const parseBurgerLinks = (elements) => {
15
- const links = [];
16
- elements.forEach((e) => {
17
- const link = e.querySelector('a');
18
- links.push({
19
- url: link.getAttribute('href'),
20
- title: link.innerText,
21
- className: e.getAttribute('class'),
22
- });
23
- });
24
- return links;
25
- };
26
-
27
- const parseSystemLinks = (elements) => {
28
- const systems = [];
29
- elements.forEach((e) => {
30
- const div = e.querySelector('div');
31
- const header = div.querySelector('h3').innerText;
32
- const text = div.querySelector('p').innerText;
33
- const actions = div.querySelectorAll('ul > li > a');
34
- const system = {
35
- header,
36
- text,
37
- actions: [],
38
- };
39
- actions.forEach((a) => {
40
- system.actions.push({
41
- url: a.getAttribute('href'),
42
- title: a.innerText,
43
- });
44
- });
45
- systems.push(system);
46
- });
47
- return systems;
48
- };
49
-
50
- class StaffTopComponent extends React.Component {
51
- constructor(props) {
52
- super(props);
53
-
54
- this.state = {
55
- active: 0,
56
- burgerLinks: [],
57
- systemLinks: [],
58
- loggedIn: false,
59
- showHelp: false,
60
- };
61
- }
62
-
63
- componentDidMount() {
64
- const { promiseHandler, user, onLoad } = this.props;
65
- document.getElementById('fade').addEventListener('click', () => {
66
- this.setState({
67
- active: 0,
68
- });
69
- });
70
-
71
- promiseHandler((data) => {
72
- const container = document.createElement('div');
73
- container.innerHTML = data;
74
- const burgerLinks = container.querySelectorAll('ul.burger-links > li');
75
- const systemLinks = container.querySelectorAll('ul.systems > li');
76
- this.setState({
77
- burgerLinks: parseBurgerLinks(burgerLinks),
78
- systemLinks: parseSystemLinks(systemLinks),
79
- });
80
- });
81
-
82
- const visible = document.querySelector('body').classList.contains('login');
83
-
84
- if (visible) {
85
- fetch(`${window.profileApiUri}/v1/person/isauthenticated`, {
86
- method: 'GET',
87
- credentials: 'include',
88
- })
89
- .then((response) => response.json())
90
- .then((json) => {
91
- this.setState({
92
- loggedIn: json.isAuthenticated,
93
- }, () => {
94
- onLoad({ ...user, ...{ auId: json.auId } });
95
- });
96
- }).catch((err) => {
97
- // eslint-disable-next-line no-console
98
- console.log(err);
99
- });
100
- }
101
- }
102
-
103
- componentDidUpdate() {
104
- const { active } = this.state;
105
- const fade = document.getElementById('fade');
106
- if (active > 0) {
107
- fade.style.display = 'block';
108
- } else {
109
- fade.style.display = 'none';
110
- }
111
- fade.style.opacity = 0;
112
- if (active === 2 && typeof window.findWidgetInit !== 'undefined') {
113
- window.findWidgetInit('.universe-utility .find-container');
114
- }
115
- if (active === 3) {
116
- AU.alphabox.init();
117
- }
118
- }
119
-
120
- render() {
121
- const {
122
- lang,
123
- user,
124
- onLoad,
125
- universeLabels,
126
- profileLabels,
127
- } = this.props;
128
- const {
129
- active,
130
- burgerLinks,
131
- systemLinks,
132
- loggedIn,
133
- showHelp,
134
- } = this.state;
135
-
136
- const helpCookie = getCookie('mystaff-help');
137
- const visible = document.querySelector('body').classList.contains('login');
138
- const help = !helpCookie && !loggedIn && document.querySelector('body').classList.contains('help');
139
-
140
- const renderBurgerLinks = burgerLinks.map(
141
- (u) => (
142
- <li key={u.title} className={u.className}>
143
- <a href={u.url}>
144
- {u.title}
145
- </a>
146
- </li>
147
- ),
148
- );
149
-
150
- const renderSystemLinks = systemLinks.map(
151
- (s) => (
152
- <li key={s.header}>
153
- <AUCollapsibleComponent
154
- collapsed
155
- header={s.header}
156
- level={3}
157
- >
158
- <div>
159
- <p>
160
- {s.text}
161
- </p>
162
- <ul className="resetlist">
163
- {s.actions.map(
164
- (a) => (
165
- <li key={a.url}>
166
- <a href={a.url}>{a.title}</a>
167
- </li>
168
- ),
169
- )}
170
- </ul>
171
- </div>
172
- </AUCollapsibleComponent>
173
- </li>
174
- ),
175
- );
176
-
177
- return [
178
- <div key="header" className="large-12 medium-12 small-12 columns">
179
- <div>
180
- <h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].staffTitleLink }} />
181
- <div className={active === 4 ? 'avatar active' : 'avatar'}>
182
- {
183
- visible && (
184
- <>
185
- <AUProfileLoginComponent
186
- text={profileLabels[lang].myProfile}
187
- loggedIn={loggedIn}
188
- loginUri={`${window.profileApiUri}/auth/login?redirectUri=${window.location.href}`}
189
- >
190
- <AUProfileAvatar2016Component
191
- lang={lang}
192
- user={user}
193
- settings={[
194
- {
195
- url: `${window.profileApiUri}/${lang}/profile`,
196
- text: profileLabels[lang].headerContainer,
197
- },
198
- {
199
- url: `${window.profileApiUri}/${lang}/password`,
200
- text: profileLabels[lang].headerPassword,
201
- },
202
- {
203
- url: `${window.profileApiUri}/${lang}/holiday`,
204
- text: profileLabels[lang].headerVacationAbsence,
205
- },
206
- ]}
207
- profileLabels={profileLabels}
208
- toggled={active === 4}
209
- onToggle={() => {
210
- this.setState((prevState) => ({
211
- active: prevState.active === 4 ? 0 : 4,
212
- }));
213
- }}
214
- onLoad={onLoad}
215
- logoutUri={`${window.profileApiUri}/auth/logout?redirectUri=${window.location.href}`}
216
- />
217
- </AUProfileLoginComponent>
218
- {
219
- help && (
220
- <>
221
- <button
222
- type="button"
223
- className="btn-help"
224
- aria-label="Hjælp / help"
225
- onClick={() => {
226
- this.setState({
227
- showHelp: true,
228
- });
229
- }}
230
- >
231
-
232
- </button>
233
- {
234
- showHelp && (
235
- ReactDOM.createPortal(
236
- <div className="help-modal">
237
- <h2>{profileLabels[lang].helpModalHeader}</h2>
238
- <p>
239
- {profileLabels[lang].helpModalText}
240
- </p>
241
- <button
242
- type="button"
243
- className="button bg-staff"
244
- onClick={() => {
245
- setCookie('mystaff-help', true, null, 365, ';path=/;domain=medarbejdere.au.dk');
246
- this.setState({
247
- showHelp: false,
248
- });
249
- }}
250
- >
251
- {profileLabels[lang].helpModalBtn}
252
- </button>
253
- </div>,
254
- document.querySelector('.main'),
255
- 'modal',
256
- )
257
- )
258
- }
259
- </>
260
- )
261
- }
262
- </>
263
- )
264
- }
265
- </div>
266
- {
267
- showHelp && (
268
- <div
269
- key="overlay"
270
- className="help-modal-overlay"
271
- role="button"
272
- onClick={() => {
273
- this.setState({
274
- showHelp: false,
275
- });
276
- }}
277
- />
278
- )
279
- }
280
- <ul className="resetlist universe-icons">
281
- <li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
282
- <li className={active === 1 ? 'active' : null}>
283
- <button
284
- type="button"
285
- className="btn-system"
286
- onClick={() => {
287
- this.setState((prevState) => ({
288
- active: prevState.active === 1 ? 0 : 1,
289
- }));
290
- }}
291
- >
292
- System
293
- </button>
294
- </li>
295
- <li className={active === 2 ? 'active' : null}>
296
- <button
297
- type="button"
298
- className="btn-find"
299
- onClick={() => {
300
- this.setState((prevState) => ({
301
- active: prevState.active === 2 ? 0 : 2,
302
- }));
303
- }}
304
- >
305
- Find
306
- </button>
307
- </li>
308
- <li className={active === 3 ? 'active' : null}>
309
- <button
310
- type="button"
311
- className="btn-menu"
312
- onClick={() => {
313
- this.setState((prevState) => ({
314
- active: prevState.active === 3 ? 0 : 3,
315
- }));
316
- }}
317
- >
318
- Menu
319
- </button>
320
- </li>
321
- </ul>
322
- </div>
323
- </div>,
324
- <div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
325
- <div className="universe-utility-links">
326
- <ul className="resetlist">
327
- {renderSystemLinks}
328
- </ul>
329
- </div>
330
- </div>,
331
- <div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
332
- <div className="find-container au-map" />
333
- </div>,
334
- <div key={3} className={`universe-utility${active === 3 ? ' active' : ''}`}>
335
- <div className="au_alphabox" id="au_alphabox_staff_utility" />
336
- <div className="universe-utility-links">
337
- <ul className="resetlist">
338
- {renderBurgerLinks}
339
- </ul>
340
- </div>
341
- </div>,
342
- ];
343
- }
344
- }
345
-
346
- /*
347
- StaffTopComponent.defaultProps = {
348
- onLogin: () => { },
349
- };
350
- */
351
-
352
- StaffTopComponent.propTypes = {
353
- lang: PropTypes.string.isRequired,
354
- user: PropTypes.shape({
355
- }).isRequired,
356
- promiseHandler: PropTypes.func.isRequired,
357
- onLoad: PropTypes.func.isRequired,
358
- universeLabels: PropTypes.shape({}).isRequired,
359
- profileLabels: PropTypes.shape({}).isRequired,
360
- };
361
-
362
- StaffTopComponent.displayName = 'StaffTopComponent';
363
- export default StaffTopComponent;
1
+ /* eslint-disable jsx-a11y/interactive-supports-focus */
2
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
3
+ /* eslint-disable jsx-a11y/control-has-associated-label */
4
+ /* eslint-env browser */
5
+ /* eslint max-len: 0 */
6
+ import React from 'react';
7
+ import ReactDOM from 'react-dom';
8
+ import PropTypes from 'prop-types';
9
+ import AUCollapsibleComponent from '../common/AUCollapsibleComponent';
10
+ import AUProfileLoginComponent from '../../../components/profile/AUProfileLoginComponent';
11
+ import AUProfileAvatar2016Component from '../profile/AUProfileAvatar2016Component';
12
+ import { getCookie, setCookie } from '../../../lib/helpers';
13
+
14
+ const parseBurgerLinks = (elements) => {
15
+ const links = [];
16
+ elements.forEach((e) => {
17
+ const link = e.querySelector('a');
18
+ links.push({
19
+ url: link.getAttribute('href'),
20
+ title: link.innerText,
21
+ className: e.getAttribute('class'),
22
+ });
23
+ });
24
+ return links;
25
+ };
26
+
27
+ const parseSystemLinks = (elements) => {
28
+ const systems = [];
29
+ elements.forEach((e) => {
30
+ const div = e.querySelector('div');
31
+ const header = div.querySelector('h3').innerText;
32
+ const text = div.querySelector('p').innerText;
33
+ const actions = div.querySelectorAll('ul > li > a');
34
+ const system = {
35
+ header,
36
+ text,
37
+ actions: [],
38
+ };
39
+ actions.forEach((a) => {
40
+ system.actions.push({
41
+ url: a.getAttribute('href'),
42
+ title: a.innerText,
43
+ });
44
+ });
45
+ systems.push(system);
46
+ });
47
+ return systems;
48
+ };
49
+
50
+ class StaffTopComponent extends React.Component {
51
+ constructor(props) {
52
+ super(props);
53
+
54
+ this.state = {
55
+ active: 0,
56
+ burgerLinks: [],
57
+ systemLinks: [],
58
+ loggedIn: false,
59
+ showHelp: false,
60
+ };
61
+ }
62
+
63
+ componentDidMount() {
64
+ const { promiseHandler, user, onLoad } = this.props;
65
+ document.getElementById('fade').addEventListener('click', () => {
66
+ this.setState({
67
+ active: 0,
68
+ });
69
+ });
70
+
71
+ promiseHandler((data) => {
72
+ const container = document.createElement('div');
73
+ container.innerHTML = data;
74
+ const burgerLinks = container.querySelectorAll('ul.burger-links > li');
75
+ const systemLinks = container.querySelectorAll('ul.systems > li');
76
+ this.setState({
77
+ burgerLinks: parseBurgerLinks(burgerLinks),
78
+ systemLinks: parseSystemLinks(systemLinks),
79
+ });
80
+ });
81
+
82
+ const visible = document.querySelector('body').classList.contains('login');
83
+
84
+ if (visible) {
85
+ fetch(`${window.profileApiUri}/v1/person/isauthenticated`, {
86
+ method: 'GET',
87
+ credentials: 'include',
88
+ })
89
+ .then((response) => response.json())
90
+ .then((json) => {
91
+ this.setState({
92
+ loggedIn: json.isAuthenticated,
93
+ }, () => {
94
+ onLoad({ ...user, ...{ auId: json.auId } });
95
+ });
96
+ }).catch((err) => {
97
+ // eslint-disable-next-line no-console
98
+ console.log(err);
99
+ });
100
+ }
101
+ }
102
+
103
+ componentDidUpdate() {
104
+ const { active } = this.state;
105
+ const fade = document.getElementById('fade');
106
+ if (active > 0) {
107
+ fade.style.display = 'block';
108
+ } else {
109
+ fade.style.display = 'none';
110
+ }
111
+ fade.style.opacity = 0;
112
+ if (active === 2 && typeof window.findWidgetInit !== 'undefined') {
113
+ window.findWidgetInit('.universe-utility .find-container');
114
+ }
115
+ if (active === 3) {
116
+ AU.alphabox.init();
117
+ }
118
+ }
119
+
120
+ render() {
121
+ const {
122
+ lang,
123
+ user,
124
+ onLoad,
125
+ universeLabels,
126
+ profileLabels,
127
+ } = this.props;
128
+ const {
129
+ active,
130
+ burgerLinks,
131
+ systemLinks,
132
+ loggedIn,
133
+ showHelp,
134
+ } = this.state;
135
+
136
+ const helpCookie = getCookie('mystaff-help');
137
+ const visible = document.querySelector('body').classList.contains('login');
138
+ const help = !helpCookie && !loggedIn && document.querySelector('body').classList.contains('help');
139
+
140
+ const renderBurgerLinks = burgerLinks.map(
141
+ (u) => (
142
+ <li key={u.title} className={u.className}>
143
+ <a href={u.url}>
144
+ {u.title}
145
+ </a>
146
+ </li>
147
+ ),
148
+ );
149
+
150
+ const renderSystemLinks = systemLinks.map(
151
+ (s) => (
152
+ <li key={s.header}>
153
+ <AUCollapsibleComponent
154
+ collapsed
155
+ header={s.header}
156
+ level={3}
157
+ >
158
+ <div>
159
+ <p>
160
+ {s.text}
161
+ </p>
162
+ <ul className="resetlist">
163
+ {s.actions.map(
164
+ (a) => (
165
+ <li key={a.url}>
166
+ <a href={a.url}>{a.title}</a>
167
+ </li>
168
+ ),
169
+ )}
170
+ </ul>
171
+ </div>
172
+ </AUCollapsibleComponent>
173
+ </li>
174
+ ),
175
+ );
176
+
177
+ return [
178
+ <div key="header" className="large-12 medium-12 small-12 columns">
179
+ <div>
180
+ <h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].staffTitleLink }} />
181
+ <div className={active === 4 ? 'avatar active' : 'avatar'}>
182
+ {
183
+ visible && (
184
+ <>
185
+ <AUProfileLoginComponent
186
+ text={profileLabels[lang].myProfile}
187
+ loggedIn={loggedIn}
188
+ loginUri={`${window.profileApiUri}/auth/login?redirectUri=${window.location.href}`}
189
+ >
190
+ <AUProfileAvatar2016Component
191
+ lang={lang}
192
+ user={user}
193
+ settings={[
194
+ {
195
+ url: `${window.profileApiUri}/${lang}/profile`,
196
+ text: profileLabels[lang].headerContainer,
197
+ },
198
+ {
199
+ url: `${window.profileApiUri}/${lang}/password`,
200
+ text: profileLabels[lang].headerPassword,
201
+ },
202
+ {
203
+ url: `${window.profileApiUri}/${lang}/holiday`,
204
+ text: profileLabels[lang].headerVacationAbsence,
205
+ },
206
+ ]}
207
+ profileLabels={profileLabels}
208
+ toggled={active === 4}
209
+ onToggle={() => {
210
+ this.setState((prevState) => ({
211
+ active: prevState.active === 4 ? 0 : 4,
212
+ }));
213
+ }}
214
+ onLoad={onLoad}
215
+ logoutUri={`${window.profileApiUri}/auth/logout?redirectUri=${window.location.href}`}
216
+ />
217
+ </AUProfileLoginComponent>
218
+ {
219
+ help && (
220
+ <>
221
+ <button
222
+ type="button"
223
+ className="btn-help"
224
+ aria-label="Hjælp / help"
225
+ onClick={() => {
226
+ this.setState({
227
+ showHelp: true,
228
+ });
229
+ }}
230
+ >
231
+
232
+ </button>
233
+ {
234
+ showHelp && (
235
+ ReactDOM.createPortal(
236
+ <div className="help-modal">
237
+ <h2>{profileLabels[lang].helpModalHeader}</h2>
238
+ <p>
239
+ {profileLabels[lang].helpModalText}
240
+ </p>
241
+ <button
242
+ type="button"
243
+ className="button bg-staff"
244
+ onClick={() => {
245
+ setCookie('mystaff-help', true, null, 365, ';path=/;domain=medarbejdere.au.dk');
246
+ this.setState({
247
+ showHelp: false,
248
+ });
249
+ }}
250
+ >
251
+ {profileLabels[lang].helpModalBtn}
252
+ </button>
253
+ </div>,
254
+ document.querySelector('.main'),
255
+ 'modal',
256
+ )
257
+ )
258
+ }
259
+ </>
260
+ )
261
+ }
262
+ </>
263
+ )
264
+ }
265
+ </div>
266
+ {
267
+ showHelp && (
268
+ <div
269
+ key="overlay"
270
+ className="help-modal-overlay"
271
+ role="button"
272
+ onClick={() => {
273
+ this.setState({
274
+ showHelp: false,
275
+ });
276
+ }}
277
+ />
278
+ )
279
+ }
280
+ <ul className="resetlist universe-icons">
281
+ <li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
282
+ <li className={active === 1 ? 'active' : null}>
283
+ <button
284
+ type="button"
285
+ className="btn-system"
286
+ onClick={() => {
287
+ this.setState((prevState) => ({
288
+ active: prevState.active === 1 ? 0 : 1,
289
+ }));
290
+ }}
291
+ >
292
+ System
293
+ </button>
294
+ </li>
295
+ <li className={active === 2 ? 'active' : null}>
296
+ <button
297
+ type="button"
298
+ className="btn-find"
299
+ onClick={() => {
300
+ this.setState((prevState) => ({
301
+ active: prevState.active === 2 ? 0 : 2,
302
+ }));
303
+ }}
304
+ >
305
+ Find
306
+ </button>
307
+ </li>
308
+ <li className={active === 3 ? 'active' : null}>
309
+ <button
310
+ type="button"
311
+ className="btn-menu"
312
+ onClick={() => {
313
+ this.setState((prevState) => ({
314
+ active: prevState.active === 3 ? 0 : 3,
315
+ }));
316
+ }}
317
+ >
318
+ Menu
319
+ </button>
320
+ </li>
321
+ </ul>
322
+ </div>
323
+ </div>,
324
+ <div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
325
+ <div className="universe-utility-links">
326
+ <ul className="resetlist">
327
+ {renderSystemLinks}
328
+ </ul>
329
+ </div>
330
+ </div>,
331
+ <div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
332
+ <div className="find-container au-map" />
333
+ </div>,
334
+ <div key={3} className={`universe-utility${active === 3 ? ' active' : ''}`}>
335
+ <div className="au_alphabox" id="au_alphabox_staff_utility" />
336
+ <div className="universe-utility-links">
337
+ <ul className="resetlist">
338
+ {renderBurgerLinks}
339
+ </ul>
340
+ </div>
341
+ </div>,
342
+ ];
343
+ }
344
+ }
345
+
346
+ /*
347
+ StaffTopComponent.defaultProps = {
348
+ onLogin: () => { },
349
+ };
350
+ */
351
+
352
+ StaffTopComponent.propTypes = {
353
+ lang: PropTypes.string.isRequired,
354
+ user: PropTypes.shape({
355
+ }).isRequired,
356
+ promiseHandler: PropTypes.func.isRequired,
357
+ onLoad: PropTypes.func.isRequired,
358
+ universeLabels: PropTypes.shape({}).isRequired,
359
+ profileLabels: PropTypes.shape({}).isRequired,
360
+ };
361
+
362
+ StaffTopComponent.displayName = 'StaffTopComponent';
363
+ export default StaffTopComponent;