@aarhus-university/au-lib-react-components 11.3.1 → 11.3.3

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 (96) hide show
  1. package/.eslintrc.js +34 -34
  2. package/.storybook/main.js +20 -20
  3. package/.storybook/preview.js +17 -17
  4. package/README.md +19 -19
  5. package/__tests__/jest/AUButtonComponent.test.tsx +165 -165
  6. package/__tests__/jest/AUErrorComponent.test.tsx +142 -142
  7. package/__tests__/jest/AUModalComponent.test.tsx +186 -186
  8. package/__tests__/jest/AUNotificationComponent.test.tsx +115 -115
  9. package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -57
  10. package/__tests__/jest/AUToolbarComponent.test.tsx +46 -46
  11. package/__tests__/jest/context.test.ts +25 -25
  12. package/__tests__/jest/helpers.test.ts +15 -15
  13. package/__tests__/jest/setupTests.ts +2 -2
  14. package/babel.config.js +8 -8
  15. package/build/umd/all.css +2 -2
  16. package/build/umd/all.js +1 -1
  17. package/build/umd/alphabox.js +1 -1
  18. package/build/umd/databox.js +1 -1
  19. package/build/umd/diagramme.js +1 -1
  20. package/build/umd/flowbox.js +1 -1
  21. package/build/umd/universe.js +1 -1
  22. package/build-storybook.log +367 -367
  23. package/package.json +114 -114
  24. package/src/components/AUAlertComponent.tsx +70 -70
  25. package/src/components/AUAutoSuggestComponent.js +158 -158
  26. package/src/components/AUButtonComponent.tsx +84 -84
  27. package/src/components/AUCalendarComponent.tsx +493 -493
  28. package/src/components/AUContentToggleComponent.tsx +47 -47
  29. package/src/components/AUDatepickerComponent.tsx +121 -121
  30. package/src/components/AUErrorComponent.tsx +78 -78
  31. package/src/components/AUMobilePrefixComponent.tsx +15 -15
  32. package/src/components/AUModalComponent.tsx +68 -68
  33. package/src/components/AUNotificationComponent.tsx +43 -43
  34. package/src/components/AUReceiptComponent.tsx +33 -33
  35. package/src/components/AUSpinnerComponent.tsx +36 -36
  36. package/src/components/AUStepComponent.tsx +47 -41
  37. package/src/components/AUSubNavComponent.tsx +48 -48
  38. package/src/components/AUSubmitButtonContainerComponent.tsx +29 -29
  39. package/src/components/AUTabbedContentComponent.tsx +145 -145
  40. package/src/components/AUTableComponent.tsx +24 -24
  41. package/src/components/AUToastComponent.tsx +104 -104
  42. package/src/components/AUToolbarComponent.tsx +101 -101
  43. package/src/components/AUTruncatorComponent.tsx +129 -129
  44. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  45. package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
  46. package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
  47. package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
  48. package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
  49. package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
  50. package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
  51. package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
  52. package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
  53. package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
  54. package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
  55. package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
  56. package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
  57. package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
  58. package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
  59. package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
  60. package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
  61. package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
  62. package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
  63. package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
  64. package/src/layout-2016/lib/all.js +3 -3
  65. package/src/layout-2016/lib/au-alphabox.js +100 -100
  66. package/src/layout-2016/lib/au-databox.js +400 -400
  67. package/src/layout-2016/lib/au-diagramme.js +85 -85
  68. package/src/layout-2016/lib/au-flowbox.js +93 -93
  69. package/src/layout-2016/lib/universe.js +9 -9
  70. package/src/lib/context.tsx +51 -50
  71. package/src/lib/dates.ts +50 -50
  72. package/src/lib/helpers.ts +208 -208
  73. package/src/lib/hooks.ts +75 -75
  74. package/src/lib/i18n.ts +600 -600
  75. package/src/lib/portals.tsx +119 -103
  76. package/src/lib/tracking.ts +69 -69
  77. package/src/lib/wrapping.ts +21 -21
  78. package/src/styles/_settings.scss +10 -10
  79. package/src/styles/alphabox.scss +222 -222
  80. package/src/styles/app.scss +7 -7
  81. package/src/styles/autosuggest.scss +57 -57
  82. package/src/styles/databox.scss +563 -563
  83. package/src/styles/diagramme.scss +119 -119
  84. package/src/styles/flowbox.scss +72 -72
  85. package/src/styles/maps.scss +395 -395
  86. package/stories/AUButtonComponent.stories.tsx +127 -127
  87. package/stories/AUContentToggleComponent.stories.tsx +63 -63
  88. package/stories/AUErrorComponent.stories.tsx +98 -98
  89. package/stories/AUModalComponent.stories.tsx +83 -83
  90. package/stories/AUNotificationComponent.stories.tsx +116 -116
  91. package/stories/AUSpinnerComponent.stories.tsx +41 -41
  92. package/stories/AUStepComponent.stories.tsx +40 -40
  93. package/stories/AUToolbarComponent.stories.tsx +326 -326
  94. package/stories/lib/helpers.tsx +128 -128
  95. package/tsconfig.json +46 -46
  96. 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;