@aarhus-university/au-lib-react-components 10.3.3 → 10.6.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/.eslintrc.js +34 -44
- package/.storybook/main.js +8 -0
- package/{types/common/payloads.d.ts → .storybook/preview-head.html} +0 -0
- package/.storybook/preview.js +11 -0
- package/README.md +19 -19
- package/__tests__/jest/AUButtonComponent.test.tsx +163 -0
- package/__tests__/jest/AUSpinnerComponent.test.tsx +57 -0
- package/__tests__/jest/helpers.test.ts +15 -0
- package/__tests__/jest/setupTests.ts +2 -0
- package/babel.config.js +8 -7
- package/build/umd/all.css +2 -2
- package/build/umd/all.js +1 -1
- package/build/umd/alphabox.js +1 -1
- package/build/umd/alphabox.js.map +1 -1
- package/build/umd/databox.js +1 -1
- package/build/umd/databox.js.map +1 -1
- package/build/umd/diagramme.js +1 -1
- package/build/umd/diagramme.js.map +1 -1
- package/build/umd/flowbox.js +1 -1
- package/build/umd/flowbox.js.map +1 -1
- package/build/umd/universe.js +1 -1
- package/build/umd/universe.js.map +1 -1
- package/package.json +107 -66
- package/src/components/AUAlertComponent.tsx +70 -70
- package/src/components/AUAutoSuggestComponent.js +158 -158
- package/src/components/AUButtonComponent.tsx +77 -0
- package/src/components/AUCalendarComponent.tsx +493 -493
- package/src/components/AUContentToggleComponent.tsx +33 -33
- package/src/components/AUDatepickerComponent.tsx +117 -117
- package/src/components/AUMobilePrefixComponent.tsx +15 -15
- package/src/components/AUModalComponent.tsx +80 -80
- package/src/components/AUReceiptComponent.tsx +33 -33
- package/src/components/AUSpinnerComponent.tsx +33 -91
- package/src/components/AUSubNavComponent.tsx +48 -48
- package/src/components/AUSubmitButtonContainerComponent.tsx +31 -31
- package/src/components/AUTabbedContentComponent.tsx +145 -145
- package/src/components/AUTableComponent.tsx +24 -24
- package/src/components/AUToastComponent.tsx +103 -103
- package/src/components/AUToolbarComponent.tsx +45 -45
- package/src/components/profile/AUProfileActions.js +128 -128
- package/src/components/profile/AUProfileAvatarComponent.js +83 -83
- package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
- package/src/components/profile/AUProfileAvatarV3Component.tsx +42 -42
- package/src/components/profile/AUProfileContainerComponent.js +283 -283
- package/src/components/profile/AUProfileHooks.js +30 -30
- package/src/components/profile/AUProfileItemComponent.js +54 -54
- package/src/components/profile/AUProfileLanguageComponent.js +131 -131
- package/src/components/profile/AUProfileLoginComponent.tsx +26 -26
- package/src/components/profile/AUProfileMailComponent.js +307 -307
- package/src/components/profile/AUProfileMobileComponent.js +164 -164
- package/src/components/profile/AUProfileNameComponent.js +253 -253
- package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
- package/src/components/profile/AUProfileReducer.js +230 -230
- package/src/components/profile/AUProfileWidgetComponent.js +95 -95
- package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
- package/src/components/profile/AUProfileWidgetV3Component.tsx +122 -122
- package/src/components/wrapping/AUEmbedComponent.js +47 -47
- package/src/layout-2016/components/alphabox/AlphaBoxComponent.js +143 -143
- package/src/layout-2016/components/alphabox/AlphaBoxContentComponent.js +136 -136
- package/src/layout-2016/components/common/AUCollapsibleComponent.js +152 -152
- package/src/layout-2016/components/common/AUSpinnerComponent.js +103 -103
- package/src/layout-2016/components/databox/DataBoxAlphabetComponent.js +144 -144
- package/src/layout-2016/components/databox/DataBoxAssociationComponent.js +122 -122
- package/src/layout-2016/components/databox/DataBoxButtonComponent.js +157 -157
- package/src/layout-2016/components/databox/DataBoxComponent.js +297 -297
- package/src/layout-2016/components/databox/DataBoxGroupingComponent.js +64 -64
- package/src/layout-2016/components/databox/DataBoxSearchResultComponent.js +36 -36
- package/src/layout-2016/components/databox/DataBoxStackedAssociationComponent.js +54 -54
- package/src/layout-2016/components/databox/DataBoxSuggestionComponent.js +39 -39
- package/src/layout-2016/components/diagramme/AUDiagrammeComponent.js +309 -309
- package/src/layout-2016/components/flowbox/FlowBoxComponent.js +126 -126
- package/src/layout-2016/components/flowbox/FlowBoxPhoneComponent.js +104 -104
- package/src/layout-2016/components/profile/AUProfileAvatar2016Component.js +103 -103
- package/src/layout-2016/components/universe/StaffTopComponent.js +363 -363
- package/src/layout-2016/components/universe/StudentTopComponent.js +137 -137
- package/src/layout-2016/components/universe/UniverseContainerComponent.js +65 -65
- package/src/layout-2016/lib/all.js +3 -3
- package/src/layout-2016/lib/au-alphabox.js +100 -100
- package/src/layout-2016/lib/au-databox.js +400 -400
- package/src/layout-2016/lib/au-diagramme.js +85 -85
- package/src/layout-2016/lib/au-flowbox.js +93 -93
- package/src/layout-2016/lib/universe.js +9 -9
- package/src/lib/helpers.ts +194 -194
- package/src/lib/hooks.ts +33 -33
- package/src/lib/i18n.ts +600 -600
- package/src/lib/tracking.ts +69 -69
- package/src/lib/wrapping.ts +21 -21
- package/src/styles/_settings.scss +10 -10
- package/src/styles/alphabox.scss +222 -222
- package/src/styles/app.scss +7 -7
- package/src/styles/autosuggest.scss +57 -57
- package/src/styles/databox.scss +563 -563
- package/src/styles/diagramme.scss +119 -119
- package/src/styles/flowbox.scss +72 -72
- package/src/styles/maps.scss +395 -395
- package/stories/AUButtonComponent.stories.tsx +86 -0
- package/stories/AUSpinnerComponent.stories.tsx +41 -0
- package/stories/assets/code-brackets.svg +1 -0
- package/stories/assets/colors.svg +1 -0
- package/stories/assets/comments.svg +1 -0
- package/stories/assets/direction.svg +1 -0
- package/stories/assets/flow.svg +1 -0
- package/stories/assets/plugin.svg +1 -0
- package/stories/assets/repo.svg +1 -0
- package/stories/assets/stackalt.svg +1 -0
- package/tsconfig.json +46 -46
- package/webpack.config.js +89 -89
- package/types/common/delphinus-duplicates.d.ts +0 -40
- package/types/common/interfaces/gui.d.ts +0 -52
- package/types/common/interfaces/model.d.ts +0 -29
- package/types/common/main.d.ts +0 -6
- package/types/common/package.json +0 -5
- package/types/common/props.d.ts +0 -166
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
const parseBurgerLinks = (elements) => {
|
|
6
|
-
const links = [];
|
|
7
|
-
elements.forEach((e) => {
|
|
8
|
-
const link = e.querySelector('a');
|
|
9
|
-
links.push({
|
|
10
|
-
url: link.getAttribute('href'),
|
|
11
|
-
title: link.innerText,
|
|
12
|
-
className: e.getAttribute('class'),
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
return links;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
class StudentTopComponent extends React.Component {
|
|
19
|
-
constructor(props) {
|
|
20
|
-
super(props);
|
|
21
|
-
|
|
22
|
-
this.state = {
|
|
23
|
-
active: 0,
|
|
24
|
-
burgerLinks: [],
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
componentDidMount() {
|
|
29
|
-
const { promiseHandler } = this.props;
|
|
30
|
-
document.getElementById('fade').addEventListener('click', () => {
|
|
31
|
-
this.setState({
|
|
32
|
-
active: 0,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
promiseHandler((data) => {
|
|
37
|
-
const container = document.createElement('div');
|
|
38
|
-
container.innerHTML = data;
|
|
39
|
-
const burgerLinks = container.querySelectorAll('ul.burger-links > li');
|
|
40
|
-
this.setState({
|
|
41
|
-
burgerLinks: parseBurgerLinks(burgerLinks),
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
componentDidUpdate() {
|
|
47
|
-
const { active } = this.state;
|
|
48
|
-
const fade = document.getElementById('fade');
|
|
49
|
-
if (active > 0) {
|
|
50
|
-
fade.style.display = 'block';
|
|
51
|
-
} else {
|
|
52
|
-
fade.style.display = 'none';
|
|
53
|
-
}
|
|
54
|
-
fade.style.opacity = 0;
|
|
55
|
-
if (active === 1 && typeof window.findWidgetInit !== 'undefined') {
|
|
56
|
-
window.findWidgetInit('.universe-utility .find-container');
|
|
57
|
-
}
|
|
58
|
-
if (active === 2) {
|
|
59
|
-
AU.alphabox.init();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
render() {
|
|
64
|
-
const { lang, universeLabels } = this.props;
|
|
65
|
-
const { active, burgerLinks } = this.state;
|
|
66
|
-
|
|
67
|
-
const renderBurgerLinks = burgerLinks.map(
|
|
68
|
-
(u) => (
|
|
69
|
-
<li key={u.title} className={u.className}>
|
|
70
|
-
<a href={u.url}>
|
|
71
|
-
{u.title}
|
|
72
|
-
</a>
|
|
73
|
-
</li>
|
|
74
|
-
),
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
return [
|
|
78
|
-
<div key="header" className="large-12 medium-12 small-12 columns">
|
|
79
|
-
<div>
|
|
80
|
-
<h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].studentTitleLink }} />
|
|
81
|
-
<ul className="resetlist universe-icons">
|
|
82
|
-
<li className="mitstudie">
|
|
83
|
-
<a href={universeLabels[lang].mitstudieUrl}>{universeLabels[lang].mitstudieText}</a>
|
|
84
|
-
</li>
|
|
85
|
-
<li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
|
|
86
|
-
<li className={active === 1 ? 'active' : null}>
|
|
87
|
-
<button
|
|
88
|
-
type="button"
|
|
89
|
-
className="btn-find"
|
|
90
|
-
onClick={() => {
|
|
91
|
-
this.setState((prevState) => ({
|
|
92
|
-
active: prevState.active === 1 ? 0 : 1,
|
|
93
|
-
}));
|
|
94
|
-
}}
|
|
95
|
-
>
|
|
96
|
-
Find
|
|
97
|
-
</button>
|
|
98
|
-
</li>
|
|
99
|
-
<li className={active === 2 ? 'active' : null}>
|
|
100
|
-
<button
|
|
101
|
-
type="button"
|
|
102
|
-
className="btn-menu"
|
|
103
|
-
onClick={() => {
|
|
104
|
-
this.setState((prevState) => ({
|
|
105
|
-
active: prevState.active === 2 ? 0 : 2,
|
|
106
|
-
}));
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
Menu
|
|
110
|
-
</button>
|
|
111
|
-
</li>
|
|
112
|
-
</ul>
|
|
113
|
-
</div>
|
|
114
|
-
</div>,
|
|
115
|
-
<div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
|
|
116
|
-
<div className="find-container au-map" />
|
|
117
|
-
</div>,
|
|
118
|
-
<div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
|
|
119
|
-
<div className="au_alphabox" id="au_alphabox_student_utility" />
|
|
120
|
-
<div className="universe-utility-links">
|
|
121
|
-
<ul className="resetlist">
|
|
122
|
-
{renderBurgerLinks}
|
|
123
|
-
</ul>
|
|
124
|
-
</div>
|
|
125
|
-
</div>,
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
StudentTopComponent.propTypes = {
|
|
131
|
-
lang: PropTypes.string.isRequired,
|
|
132
|
-
promiseHandler: PropTypes.func.isRequired,
|
|
133
|
-
universeLabels: PropTypes.shape({}).isRequired,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
StudentTopComponent.displayName = 'StudentTopComponent';
|
|
137
|
-
export default StudentTopComponent;
|
|
1
|
+
/* eslint-env browser */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
|
|
5
|
+
const parseBurgerLinks = (elements) => {
|
|
6
|
+
const links = [];
|
|
7
|
+
elements.forEach((e) => {
|
|
8
|
+
const link = e.querySelector('a');
|
|
9
|
+
links.push({
|
|
10
|
+
url: link.getAttribute('href'),
|
|
11
|
+
title: link.innerText,
|
|
12
|
+
className: e.getAttribute('class'),
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return links;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
class StudentTopComponent extends React.Component {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
|
|
22
|
+
this.state = {
|
|
23
|
+
active: 0,
|
|
24
|
+
burgerLinks: [],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
const { promiseHandler } = this.props;
|
|
30
|
+
document.getElementById('fade').addEventListener('click', () => {
|
|
31
|
+
this.setState({
|
|
32
|
+
active: 0,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
promiseHandler((data) => {
|
|
37
|
+
const container = document.createElement('div');
|
|
38
|
+
container.innerHTML = data;
|
|
39
|
+
const burgerLinks = container.querySelectorAll('ul.burger-links > li');
|
|
40
|
+
this.setState({
|
|
41
|
+
burgerLinks: parseBurgerLinks(burgerLinks),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
componentDidUpdate() {
|
|
47
|
+
const { active } = this.state;
|
|
48
|
+
const fade = document.getElementById('fade');
|
|
49
|
+
if (active > 0) {
|
|
50
|
+
fade.style.display = 'block';
|
|
51
|
+
} else {
|
|
52
|
+
fade.style.display = 'none';
|
|
53
|
+
}
|
|
54
|
+
fade.style.opacity = 0;
|
|
55
|
+
if (active === 1 && typeof window.findWidgetInit !== 'undefined') {
|
|
56
|
+
window.findWidgetInit('.universe-utility .find-container');
|
|
57
|
+
}
|
|
58
|
+
if (active === 2) {
|
|
59
|
+
AU.alphabox.init();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
render() {
|
|
64
|
+
const { lang, universeLabels } = this.props;
|
|
65
|
+
const { active, burgerLinks } = this.state;
|
|
66
|
+
|
|
67
|
+
const renderBurgerLinks = burgerLinks.map(
|
|
68
|
+
(u) => (
|
|
69
|
+
<li key={u.title} className={u.className}>
|
|
70
|
+
<a href={u.url}>
|
|
71
|
+
{u.title}
|
|
72
|
+
</a>
|
|
73
|
+
</li>
|
|
74
|
+
),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
return [
|
|
78
|
+
<div key="header" className="large-12 medium-12 small-12 columns">
|
|
79
|
+
<div>
|
|
80
|
+
<h2 className="universe-home" dangerouslySetInnerHTML={{ __html: universeLabels[lang].studentTitleLink }} />
|
|
81
|
+
<ul className="resetlist universe-icons">
|
|
82
|
+
<li className="mitstudie">
|
|
83
|
+
<a href={universeLabels[lang].mitstudieUrl}>{universeLabels[lang].mitstudieText}</a>
|
|
84
|
+
</li>
|
|
85
|
+
<li className="au" dangerouslySetInnerHTML={{ __html: universeLabels[lang].mainPageLink }} />
|
|
86
|
+
<li className={active === 1 ? 'active' : null}>
|
|
87
|
+
<button
|
|
88
|
+
type="button"
|
|
89
|
+
className="btn-find"
|
|
90
|
+
onClick={() => {
|
|
91
|
+
this.setState((prevState) => ({
|
|
92
|
+
active: prevState.active === 1 ? 0 : 1,
|
|
93
|
+
}));
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
Find
|
|
97
|
+
</button>
|
|
98
|
+
</li>
|
|
99
|
+
<li className={active === 2 ? 'active' : null}>
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
className="btn-menu"
|
|
103
|
+
onClick={() => {
|
|
104
|
+
this.setState((prevState) => ({
|
|
105
|
+
active: prevState.active === 2 ? 0 : 2,
|
|
106
|
+
}));
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
Menu
|
|
110
|
+
</button>
|
|
111
|
+
</li>
|
|
112
|
+
</ul>
|
|
113
|
+
</div>
|
|
114
|
+
</div>,
|
|
115
|
+
<div key={1} className={`universe-utility${active === 1 ? ' active' : ''}`}>
|
|
116
|
+
<div className="find-container au-map" />
|
|
117
|
+
</div>,
|
|
118
|
+
<div key={2} className={`universe-utility${active === 2 ? ' active' : ''}`}>
|
|
119
|
+
<div className="au_alphabox" id="au_alphabox_student_utility" />
|
|
120
|
+
<div className="universe-utility-links">
|
|
121
|
+
<ul className="resetlist">
|
|
122
|
+
{renderBurgerLinks}
|
|
123
|
+
</ul>
|
|
124
|
+
</div>
|
|
125
|
+
</div>,
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
StudentTopComponent.propTypes = {
|
|
131
|
+
lang: PropTypes.string.isRequired,
|
|
132
|
+
promiseHandler: PropTypes.func.isRequired,
|
|
133
|
+
universeLabels: PropTypes.shape({}).isRequired,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
StudentTopComponent.displayName = 'StudentTopComponent';
|
|
137
|
+
export default StudentTopComponent;
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/* eslint-env browser */
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { universeLabels, profileLabels } from '../../../lib/i18n';
|
|
4
|
-
import StaffTopComponent from './StaffTopComponent';
|
|
5
|
-
import StudentTopComponent from './StudentTopComponent';
|
|
6
|
-
|
|
7
|
-
const UniverseContainerComponent = () => {
|
|
8
|
-
const [user, setUser] = useState({
|
|
9
|
-
chosenFirstNames: '',
|
|
10
|
-
chosenLastName: '',
|
|
11
|
-
preferredLanguage: '',
|
|
12
|
-
auId: 0,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const { auAuth } = window;
|
|
16
|
-
const lang = document.querySelector('html').getAttribute('lang');
|
|
17
|
-
const body = document.querySelector('body');
|
|
18
|
-
const staffClass = 'staff';
|
|
19
|
-
const studentClass = 'student';
|
|
20
|
-
const { universeGlobalContentPath } = window;
|
|
21
|
-
let universe = <div />;
|
|
22
|
-
if (body.classList.contains(staffClass)) {
|
|
23
|
-
universe = (
|
|
24
|
-
<StaffTopComponent
|
|
25
|
-
lang={lang}
|
|
26
|
-
user={user}
|
|
27
|
-
promiseHandler={(callback) => {
|
|
28
|
-
fetch(universeGlobalContentPath).then(
|
|
29
|
-
(promise) => promise.json(),
|
|
30
|
-
).then(
|
|
31
|
-
(data) => callback(data),
|
|
32
|
-
);
|
|
33
|
-
}}
|
|
34
|
-
onLoad={(context) => {
|
|
35
|
-
setUser(context);
|
|
36
|
-
}}
|
|
37
|
-
auAuth={auAuth}
|
|
38
|
-
universeLabels={universeLabels}
|
|
39
|
-
profileLabels={profileLabels}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
if (body.classList.contains(studentClass)) {
|
|
44
|
-
universe = (
|
|
45
|
-
<StudentTopComponent
|
|
46
|
-
lang={lang}
|
|
47
|
-
user={user}
|
|
48
|
-
promiseHandler={(callback) => {
|
|
49
|
-
fetch(universeGlobalContentPath).then(
|
|
50
|
-
(promise) => promise.json(),
|
|
51
|
-
).then(
|
|
52
|
-
(data) => callback(data),
|
|
53
|
-
);
|
|
54
|
-
}}
|
|
55
|
-
universeLabels={universeLabels}
|
|
56
|
-
profileLabels={profileLabels}
|
|
57
|
-
/>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return universe;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
UniverseContainerComponent.displayName = 'UniverseContainerComponent';
|
|
65
|
-
export default UniverseContainerComponent;
|
|
1
|
+
/* eslint-env browser */
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { universeLabels, profileLabels } from '../../../lib/i18n';
|
|
4
|
+
import StaffTopComponent from './StaffTopComponent';
|
|
5
|
+
import StudentTopComponent from './StudentTopComponent';
|
|
6
|
+
|
|
7
|
+
const UniverseContainerComponent = () => {
|
|
8
|
+
const [user, setUser] = useState({
|
|
9
|
+
chosenFirstNames: '',
|
|
10
|
+
chosenLastName: '',
|
|
11
|
+
preferredLanguage: '',
|
|
12
|
+
auId: 0,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { auAuth } = window;
|
|
16
|
+
const lang = document.querySelector('html').getAttribute('lang');
|
|
17
|
+
const body = document.querySelector('body');
|
|
18
|
+
const staffClass = 'staff';
|
|
19
|
+
const studentClass = 'student';
|
|
20
|
+
const { universeGlobalContentPath } = window;
|
|
21
|
+
let universe = <div />;
|
|
22
|
+
if (body.classList.contains(staffClass)) {
|
|
23
|
+
universe = (
|
|
24
|
+
<StaffTopComponent
|
|
25
|
+
lang={lang}
|
|
26
|
+
user={user}
|
|
27
|
+
promiseHandler={(callback) => {
|
|
28
|
+
fetch(universeGlobalContentPath).then(
|
|
29
|
+
(promise) => promise.json(),
|
|
30
|
+
).then(
|
|
31
|
+
(data) => callback(data),
|
|
32
|
+
);
|
|
33
|
+
}}
|
|
34
|
+
onLoad={(context) => {
|
|
35
|
+
setUser(context);
|
|
36
|
+
}}
|
|
37
|
+
auAuth={auAuth}
|
|
38
|
+
universeLabels={universeLabels}
|
|
39
|
+
profileLabels={profileLabels}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
if (body.classList.contains(studentClass)) {
|
|
44
|
+
universe = (
|
|
45
|
+
<StudentTopComponent
|
|
46
|
+
lang={lang}
|
|
47
|
+
user={user}
|
|
48
|
+
promiseHandler={(callback) => {
|
|
49
|
+
fetch(universeGlobalContentPath).then(
|
|
50
|
+
(promise) => promise.json(),
|
|
51
|
+
).then(
|
|
52
|
+
(data) => callback(data),
|
|
53
|
+
);
|
|
54
|
+
}}
|
|
55
|
+
universeLabels={universeLabels}
|
|
56
|
+
profileLabels={profileLabels}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return universe;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
UniverseContainerComponent.displayName = 'UniverseContainerComponent';
|
|
65
|
+
export default UniverseContainerComponent;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import '../../styles/app.scss';
|
|
2
|
-
import './au-databox';
|
|
3
|
-
import './au-alphabox';
|
|
1
|
+
import '../../styles/app.scss';
|
|
2
|
+
import './au-databox';
|
|
3
|
+
import './au-alphabox';
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
/* eslint no-prototype-builtins: 0 */
|
|
2
|
-
/* eslint no-restricted-syntax: 0 */
|
|
3
|
-
/* eslint no-unused-vars: 0 */
|
|
4
|
-
/* eslint-env browser */
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import ReactDOM from 'react-dom';
|
|
7
|
-
import AlphaBoxComponent from '../components/alphabox/AlphaBoxComponent';
|
|
8
|
-
|
|
9
|
-
const defaultOptions = {
|
|
10
|
-
config: {
|
|
11
|
-
title: '',
|
|
12
|
-
url: '',
|
|
13
|
-
description: '',
|
|
14
|
-
container: '.au_alphabox',
|
|
15
|
-
tracking: '/virtual/alphabox/',
|
|
16
|
-
links: [
|
|
17
|
-
{ title: 'Link 1', url: 'http://www.au.dk' },
|
|
18
|
-
{ title: 'Link 2', url: 'http://www.au.dk' },
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
search: {
|
|
22
|
-
minLength: 1,
|
|
23
|
-
placeHolder: '',
|
|
24
|
-
},
|
|
25
|
-
background: {
|
|
26
|
-
color: '#003e5c',
|
|
27
|
-
linkColor: '#379fcb',
|
|
28
|
-
},
|
|
29
|
-
data: {
|
|
30
|
-
mode: 'json',
|
|
31
|
-
itemsOnly: false,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
class AUAlphabox {
|
|
36
|
-
constructor(boxes) {
|
|
37
|
-
this.boxes = boxes;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static mergeOptions(_box) {
|
|
41
|
-
const box = _box;
|
|
42
|
-
if (!box.hasOwnProperty('config')) {
|
|
43
|
-
box.config = {};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
for (const conf in defaultOptions.config) {
|
|
47
|
-
if (!box.config.hasOwnProperty(conf)) {
|
|
48
|
-
box.config[conf] = defaultOptions.config[conf];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!box.hasOwnProperty('background')) {
|
|
53
|
-
box.background = {};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
for (const bg in defaultOptions.background) {
|
|
57
|
-
if (!box.background.hasOwnProperty(bg)) {
|
|
58
|
-
box.background[bg] = defaultOptions.background[bg];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!box.hasOwnProperty('search')) {
|
|
63
|
-
box.search = {};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
for (const sch in defaultOptions.search) {
|
|
67
|
-
if (!box.search.hasOwnProperty(sch)) {
|
|
68
|
-
box.search[sch] = defaultOptions.search[sch];
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (!box.hasOwnProperty('data')) {
|
|
73
|
-
box.data = {};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
for (const data in defaultOptions.data) {
|
|
77
|
-
if (!box.data.hasOwnProperty(data)) {
|
|
78
|
-
box.data[data] = defaultOptions.data[data];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
init() {
|
|
84
|
-
for (let i = 0; i < this.boxes.length; i += 1) {
|
|
85
|
-
const box = this.boxes[i];
|
|
86
|
-
if (!box.loaded) {
|
|
87
|
-
box.id = i;
|
|
88
|
-
AUAlphabox.mergeOptions(box);
|
|
89
|
-
const mountNode = document.querySelector(box.config.container);
|
|
90
|
-
const visible = mountNode && getComputedStyle(mountNode).visibility !== 'hidden';
|
|
91
|
-
if (visible) {
|
|
92
|
-
ReactDOM.render(<AlphaBoxComponent box={box} />, mountNode);
|
|
93
|
-
box.loaded = true;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
window.AUAlphabox = AUAlphabox;
|
|
1
|
+
/* eslint no-prototype-builtins: 0 */
|
|
2
|
+
/* eslint no-restricted-syntax: 0 */
|
|
3
|
+
/* eslint no-unused-vars: 0 */
|
|
4
|
+
/* eslint-env browser */
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import AlphaBoxComponent from '../components/alphabox/AlphaBoxComponent';
|
|
8
|
+
|
|
9
|
+
const defaultOptions = {
|
|
10
|
+
config: {
|
|
11
|
+
title: '',
|
|
12
|
+
url: '',
|
|
13
|
+
description: '',
|
|
14
|
+
container: '.au_alphabox',
|
|
15
|
+
tracking: '/virtual/alphabox/',
|
|
16
|
+
links: [
|
|
17
|
+
{ title: 'Link 1', url: 'http://www.au.dk' },
|
|
18
|
+
{ title: 'Link 2', url: 'http://www.au.dk' },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
search: {
|
|
22
|
+
minLength: 1,
|
|
23
|
+
placeHolder: '',
|
|
24
|
+
},
|
|
25
|
+
background: {
|
|
26
|
+
color: '#003e5c',
|
|
27
|
+
linkColor: '#379fcb',
|
|
28
|
+
},
|
|
29
|
+
data: {
|
|
30
|
+
mode: 'json',
|
|
31
|
+
itemsOnly: false,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
class AUAlphabox {
|
|
36
|
+
constructor(boxes) {
|
|
37
|
+
this.boxes = boxes;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static mergeOptions(_box) {
|
|
41
|
+
const box = _box;
|
|
42
|
+
if (!box.hasOwnProperty('config')) {
|
|
43
|
+
box.config = {};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const conf in defaultOptions.config) {
|
|
47
|
+
if (!box.config.hasOwnProperty(conf)) {
|
|
48
|
+
box.config[conf] = defaultOptions.config[conf];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!box.hasOwnProperty('background')) {
|
|
53
|
+
box.background = {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (const bg in defaultOptions.background) {
|
|
57
|
+
if (!box.background.hasOwnProperty(bg)) {
|
|
58
|
+
box.background[bg] = defaultOptions.background[bg];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!box.hasOwnProperty('search')) {
|
|
63
|
+
box.search = {};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
for (const sch in defaultOptions.search) {
|
|
67
|
+
if (!box.search.hasOwnProperty(sch)) {
|
|
68
|
+
box.search[sch] = defaultOptions.search[sch];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!box.hasOwnProperty('data')) {
|
|
73
|
+
box.data = {};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
for (const data in defaultOptions.data) {
|
|
77
|
+
if (!box.data.hasOwnProperty(data)) {
|
|
78
|
+
box.data[data] = defaultOptions.data[data];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
init() {
|
|
84
|
+
for (let i = 0; i < this.boxes.length; i += 1) {
|
|
85
|
+
const box = this.boxes[i];
|
|
86
|
+
if (!box.loaded) {
|
|
87
|
+
box.id = i;
|
|
88
|
+
AUAlphabox.mergeOptions(box);
|
|
89
|
+
const mountNode = document.querySelector(box.config.container);
|
|
90
|
+
const visible = mountNode && getComputedStyle(mountNode).visibility !== 'hidden';
|
|
91
|
+
if (visible) {
|
|
92
|
+
ReactDOM.render(<AlphaBoxComponent box={box} />, mountNode);
|
|
93
|
+
box.loaded = true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
window.AUAlphabox = AUAlphabox;
|