@aarhus-university/au-lib-react-components 9.11.18 → 9.12.1

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 (148) hide show
  1. package/.eslintrc +18 -18
  2. package/README.md +20 -20
  3. package/babel.config.js +6 -6
  4. package/build/dev.html +328 -328
  5. package/build/umd/all.css +2 -2
  6. package/build/umd/all.css.map +1 -1
  7. package/build/umd/all.js +1 -1
  8. package/build/umd/alphabox.js +1 -1
  9. package/build/umd/alphabox.js.map +1 -1
  10. package/build/umd/auAuth.js +1 -1
  11. package/build/umd/auAuth.js.map +1 -1
  12. package/build/umd/databox.js +2 -2
  13. package/build/umd/databox.js.LICENSE.txt +5 -5
  14. package/build/umd/databox.js.map +1 -1
  15. package/build/umd/diagramme.js +1 -1
  16. package/build/umd/flowbox.js +1 -1
  17. package/build/umd/flowbox.js.map +1 -1
  18. package/build/umd/news.js +1 -1
  19. package/build/umd/news.js.map +1 -1
  20. package/build/umd/universe.js +1 -1
  21. package/build/umd/universe.js.map +1 -1
  22. package/package.json +60 -60
  23. package/src/all.js +3 -3
  24. package/src/app.js +263 -263
  25. package/src/components/AUAlertComponent.js +158 -158
  26. package/src/components/AUAmountComponent.js +84 -84
  27. package/src/components/AUBannerComponent.js +99 -99
  28. package/src/components/AUCalendarComponent.js +393 -393
  29. package/src/components/AUCollapsibleComponent.js +173 -173
  30. package/src/components/AUDatepickerComponent.js +105 -105
  31. package/src/components/AUDiagrammeComponent.js +310 -310
  32. package/src/components/AUFilterCheckboxComponent.js +122 -122
  33. package/src/components/AUFocusComponent.js +55 -55
  34. package/src/components/AUModalComponent.js +94 -94
  35. package/src/components/AUPaginationComponent.js +103 -103
  36. package/src/components/AUSpinnerComponent.js +125 -125
  37. package/src/components/AutoSuggestComponent.js +157 -132
  38. package/src/components/alphabox/AlphaBoxComponent.js +145 -140
  39. package/src/components/alphabox/AlphaBoxContentComponent.js +136 -125
  40. package/src/components/context/AUUserContextComponent.js +91 -91
  41. package/src/components/context/ImpersonateComponent.js +54 -54
  42. package/src/components/databox/DataBoxAlphabetComponent.js +144 -144
  43. package/src/components/databox/DataBoxAssociationComponent.js +122 -122
  44. package/src/components/databox/DataBoxButtonComponent.js +153 -153
  45. package/src/components/databox/DataBoxComponent.js +297 -297
  46. package/src/components/databox/DataBoxGroupingComponent.js +62 -62
  47. package/src/components/databox/DataBoxSearchResultComponent.js +40 -40
  48. package/src/components/databox/DataBoxStackedAssociationComponent.js +58 -58
  49. package/src/components/databox/DataBoxSuggestionComponent.js +39 -39
  50. package/src/components/delphinus/AUAlertComponent.js +85 -85
  51. package/src/components/delphinus/AUCalendarComponent.js +487 -487
  52. package/src/components/delphinus/AUContentToggleComponent.js +32 -32
  53. package/src/components/delphinus/AUDatepickerComponent.js +164 -164
  54. package/src/components/delphinus/AULoginComponent.js +65 -65
  55. package/src/components/delphinus/AUModalComponent.js +94 -94
  56. package/src/components/delphinus/AUSpinnerComponent.js +114 -114
  57. package/src/components/delphinus/AUSubNavComponent.js +53 -53
  58. package/src/components/delphinus/AUTabbedContentComponent.js +150 -150
  59. package/src/components/delphinus/AUTableComponent.js +28 -28
  60. package/src/components/delphinus/AUToastComponent.js +91 -91
  61. package/src/components/delphinus/AUToolbarComponent.js +48 -48
  62. package/src/components/delphinus/hooks.js +28 -28
  63. package/src/components/flowbox/FlowBoxComponent.js +126 -126
  64. package/src/components/flowbox/FlowBoxPhoneComponent.js +106 -106
  65. package/src/components/form/AUMobilePrefixComponent.js +18 -18
  66. package/src/components/form/AUReceiptComponent.js +40 -40
  67. package/src/components/form/AUSubmitButtonContainerComponent.js +39 -39
  68. package/src/components/news/EventLayout1Component.js +94 -94
  69. package/src/components/news/EventLayout2Component.js +90 -90
  70. package/src/components/news/EventLayout3Component.js +68 -68
  71. package/src/components/news/NewsCategoriesComponent.js +21 -21
  72. package/src/components/news/NewsCollageBannerComponent.js +71 -71
  73. package/src/components/news/NewsCollageBannerRSSComponent.js +79 -79
  74. package/src/components/news/NewsColumnsComponent.js +125 -125
  75. package/src/components/news/NewsLanguageChangeComponent.js +74 -74
  76. package/src/components/news/NewsLayout1Component.js +80 -80
  77. package/src/components/news/NewsLayout2Component.js +80 -80
  78. package/src/components/news/NewsLayout3Component.js +81 -81
  79. package/src/components/news/NewsLayout4Component.js +80 -80
  80. package/src/components/news/NewsLayout5Component.js +61 -61
  81. package/src/components/news/NewsLayout6Component.js +55 -55
  82. package/src/components/news/NewsLayout7Component.js +58 -58
  83. package/src/components/news/NewsLayout8Component.js +57 -57
  84. package/src/components/news/NewsListComponent.js +291 -291
  85. package/src/components/news/NewsPopUpComponent.js +591 -591
  86. package/src/components/news/NewsRSSComponent.js +74 -74
  87. package/src/components/news/NewsSocialComponent.js +104 -104
  88. package/src/components/news/NewsSubHeaderComponent.js +19 -19
  89. package/src/components/password/AUChangePasswordComponent.js +190 -177
  90. package/src/components/password/AUCurrentPasswordComponent.js +72 -72
  91. package/src/components/password/AUNewPasswordComponent.js +143 -143
  92. package/src/components/password/AUPasswordActions.js +101 -101
  93. package/src/components/password/AUPasswordHooks.js +47 -47
  94. package/src/components/password/AUPasswordReducer.js +78 -78
  95. package/src/components/password/AUPasswordRequirementsComponent.js +29 -29
  96. package/src/components/profile/AUProfileActions.js +128 -128
  97. package/src/components/profile/AUProfileAvatar2016Component.js +99 -99
  98. package/src/components/profile/AUProfileAvatarComponent.js +83 -83
  99. package/src/components/profile/AUProfileAvatarV2Component.js +91 -91
  100. package/src/components/profile/AUProfileAvatarV3Component.js +80 -80
  101. package/src/components/profile/AUProfileContainerComponent.js +283 -283
  102. package/src/components/profile/AUProfileHooks.js +30 -30
  103. package/src/components/profile/AUProfileItemComponent.js +54 -54
  104. package/src/components/profile/AUProfileLanguageComponent.js +131 -131
  105. package/src/components/profile/AUProfileLoginComponent.js +41 -41
  106. package/src/components/profile/AUProfileMailComponent.js +307 -307
  107. package/src/components/profile/AUProfileMobileComponent.js +164 -164
  108. package/src/components/profile/AUProfileNameComponent.js +253 -253
  109. package/src/components/profile/AUProfileNextOfKinComponent.js +216 -216
  110. package/src/components/profile/AUProfileReducer.js +230 -230
  111. package/src/components/profile/AUProfileWidgetComponent.js +95 -95
  112. package/src/components/profile/AUProfileWidgetV2Component.js +116 -116
  113. package/src/components/profile/AUProfileWidgetV3Component.js +130 -130
  114. package/src/components/universe/StaffTopComponent.js +362 -362
  115. package/src/components/universe/StudentTopComponent.js +137 -137
  116. package/src/components/universe/UniverseContainerComponent.js +62 -62
  117. package/src/components/wrapping/AUEmbedComponent.js +47 -47
  118. package/src/config/webpack.dev.config.js +47 -47
  119. package/src/config/webpack.umd.config.js +86 -85
  120. package/src/index.js +6 -6
  121. package/src/lib/au-alphabox.js +102 -102
  122. package/src/lib/au-auth.js +227 -227
  123. package/src/lib/au-databox.js +403 -403
  124. package/src/lib/au-diagramme.js +87 -87
  125. package/src/lib/au-flowbox.js +95 -95
  126. package/src/lib/au-news.js +371 -371
  127. package/src/lib/helpers.js +222 -219
  128. package/src/lib/i18n.js +603 -601
  129. package/src/lib/menu.js +10 -10
  130. package/src/lib/tracking.js +65 -65
  131. package/src/lib/universe.js +9 -9
  132. package/src/lib/urlHandler.js +63 -63
  133. package/src/lib/validation.js +219 -181
  134. package/src/lib/wrapping.js +16 -16
  135. package/src/styles/_settings.scss +10 -10
  136. package/src/styles/alert.scss +39 -39
  137. package/src/styles/alphabox.scss +222 -208
  138. package/src/styles/app.scss +13 -13
  139. package/src/styles/autosuggest.scss +57 -57
  140. package/src/styles/calendar.scss +111 -111
  141. package/src/styles/databox.scss +563 -563
  142. package/src/styles/diagramme.scss +119 -119
  143. package/src/styles/filtercheckbox.scss +4 -4
  144. package/src/styles/flowbox.scss +72 -72
  145. package/src/styles/maps.scss +395 -395
  146. package/src/styles/modal.scss +34 -34
  147. package/src/styles/pagination.scss +10 -10
  148. package/src/styles/spinner.scss +30 -30
@@ -1,28 +1,28 @@
1
- /* eslint-disable import/prefer-default-export */
2
- import { useState, useEffect } from 'react';
3
- import { showModal, hideModal } from '@aarhus-university/au-designsystem-delphinus/source/js/components/modal-view';
4
-
5
- // eslint-disable-next-line max-len
6
- const useModal = (domId, initialState, showCondition = true, hideCondition = false, closeable = true) => {
7
- const [modal, setModal] = useState({ modal: initialState, sender: null });
8
-
9
- useEffect(() => {
10
- if (modal.modal && modal.sender && showCondition) {
11
- showModal(domId, modal.sender, () => {
12
- setModal({ modal: false, sender: null });
13
- }, closeable);
14
- }
15
-
16
- if (modal.modal && modal.sender && hideCondition) {
17
- hideModal(domId, modal.sender, () => {
18
- setModal({ modal: false, sender: null });
19
- });
20
- }
21
- });
22
-
23
- return [modal, setModal];
24
- };
25
-
26
- export {
27
- useModal,
28
- };
1
+ /* eslint-disable import/prefer-default-export */
2
+ import { useState, useEffect } from 'react';
3
+ import { showModal, hideModal } from '@aarhus-university/au-designsystem-delphinus/source/js/components/modal-view';
4
+
5
+ // eslint-disable-next-line max-len
6
+ const useModal = (domId, initialState, showCondition = true, hideCondition = false, closeable = true) => {
7
+ const [modal, setModal] = useState({ modal: initialState, sender: null });
8
+
9
+ useEffect(() => {
10
+ if (modal.modal && modal.sender && showCondition) {
11
+ showModal(domId, modal.sender, () => {
12
+ setModal({ modal: false, sender: null });
13
+ }, closeable);
14
+ }
15
+
16
+ if (modal.modal && modal.sender && hideCondition) {
17
+ hideModal(domId, modal.sender, () => {
18
+ setModal({ modal: false, sender: null });
19
+ });
20
+ }
21
+ });
22
+
23
+ return [modal, setModal];
24
+ };
25
+
26
+ export {
27
+ useModal,
28
+ };
@@ -1,126 +1,126 @@
1
- /* eslint-env browser */
2
- /* eslint jsx-a11y/click-events-have-key-events: 0 */
3
- /* eslint jsx-a11y/no-noninteractive-element-interactions: 0 */
4
- /* eslint jsx-a11y/control-has-associated-label: 0 */
5
- import React from 'react';
6
- import PropTypes from 'prop-types';
7
- import FlowBoxPhoneComponent from './FlowBoxPhoneComponent';
8
- import { flowboxLabels as labels } from '../../lib/i18n';
9
-
10
- class FlowBoxComponent extends React.Component {
11
- constructor(props) {
12
- super(props);
13
- const { box } = props;
14
- this.state = {
15
- node: box.item,
16
- };
17
-
18
- this.prevNode = this.prevNode.bind(this);
19
- this.nextNode = this.nextNode.bind(this);
20
- this.handleSelectChange = this.handleSelectChange.bind(this);
21
- }
22
-
23
- nextNode(child) {
24
- this.setState({
25
- node: child,
26
- });
27
- }
28
-
29
- prevNode(node) {
30
- this.setState({
31
- node: node.parent,
32
- });
33
- }
34
-
35
- handleSelectChange(event) {
36
- const { node } = this.state;
37
- const child = node.children.find((n) => n.name === event.target.value);
38
- this.setState({
39
- node: child,
40
- });
41
- }
42
-
43
- render() {
44
- const { node } = this.state;
45
- const { box, lang } = this.props;
46
- const { children } = node;
47
- return (
48
- <div>
49
- <h2 dangerouslySetInnerHTML={{ __html: `<span>${box.data.prepend} </span>${node.name}` }} />
50
- {(() => {
51
- if (box.config.render === 'select') {
52
- if (children.filter((x) => x.children.length > 0).length > 0) {
53
- return (
54
- <select onChange={this.handleSelectChange}>
55
- <option value="">{`${labels[lang].select}...`}</option>
56
- {children.map((c) => <option key={c.name} value={c.name}>{c.name}</option>)}
57
- </select>
58
- );
59
- }
60
- }
61
- return (
62
- <ul>
63
- {children.map(
64
- (c) => (
65
- <li key={c.name}>
66
- {(() => {
67
- if (c.children.length > 0) {
68
- return (
69
- <button
70
- type="button"
71
- onClick={() => {
72
- this.nextNode(c);
73
- }}
74
- dangerouslySetInnerHTML={{ __html: c.name }}
75
- />
76
- );
77
- }
78
- if (c.name.indexOf(' ') === -1 && window.renderVCard) { // Det skal vi så lige huske at sætte på medarbejderkontaktboksene!
79
- return <FlowBoxPhoneComponent phone={c.name} lang={lang} />;
80
- }
81
- return <span dangerouslySetInnerHTML={{ __html: c.name }} />;
82
- })()}
83
- </li>
84
- ),
85
- )}
86
- </ul>
87
- );
88
- })()}
89
- {(() => {
90
- if (node.parent != null) {
91
- return (
92
- <button
93
- type="button"
94
- className="button small"
95
- onClick={() => {
96
- this.prevNode(node);
97
- }}
98
- >
99
- {labels[lang].back}
100
- </button>
101
- );
102
- }
103
- return null;
104
- })()}
105
- </div>
106
- );
107
- }
108
- }
109
-
110
- FlowBoxComponent.propTypes = {
111
- box: PropTypes.shape({
112
- item: PropTypes.shape({
113
- name: PropTypes.string.isRequired,
114
- }).isRequired,
115
- data: PropTypes.shape({
116
- prepend: PropTypes.string.isRequired,
117
- }).isRequired,
118
- config: PropTypes.shape({
119
- render: PropTypes.string.isRequired,
120
- }).isRequired,
121
- }).isRequired,
122
- lang: PropTypes.string.isRequired,
123
- };
124
-
125
- FlowBoxComponent.displayName = 'FlowBoxComponent';
126
- export default FlowBoxComponent;
1
+ /* eslint-env browser */
2
+ /* eslint jsx-a11y/click-events-have-key-events: 0 */
3
+ /* eslint jsx-a11y/no-noninteractive-element-interactions: 0 */
4
+ /* eslint jsx-a11y/control-has-associated-label: 0 */
5
+ import React from 'react';
6
+ import PropTypes from 'prop-types';
7
+ import FlowBoxPhoneComponent from './FlowBoxPhoneComponent';
8
+ import { flowboxLabels as labels } from '../../lib/i18n';
9
+
10
+ class FlowBoxComponent extends React.Component {
11
+ constructor(props) {
12
+ super(props);
13
+ const { box } = props;
14
+ this.state = {
15
+ node: box.item,
16
+ };
17
+
18
+ this.prevNode = this.prevNode.bind(this);
19
+ this.nextNode = this.nextNode.bind(this);
20
+ this.handleSelectChange = this.handleSelectChange.bind(this);
21
+ }
22
+
23
+ nextNode(child) {
24
+ this.setState({
25
+ node: child,
26
+ });
27
+ }
28
+
29
+ prevNode(node) {
30
+ this.setState({
31
+ node: node.parent,
32
+ });
33
+ }
34
+
35
+ handleSelectChange(event) {
36
+ const { node } = this.state;
37
+ const child = node.children.find((n) => n.name === event.target.value);
38
+ this.setState({
39
+ node: child,
40
+ });
41
+ }
42
+
43
+ render() {
44
+ const { node } = this.state;
45
+ const { box, lang } = this.props;
46
+ const { children } = node;
47
+ return (
48
+ <div>
49
+ <h2 dangerouslySetInnerHTML={{ __html: `<span>${box.data.prepend} </span>${node.name}` }} />
50
+ {(() => {
51
+ if (box.config.render === 'select') {
52
+ if (children.filter((x) => x.children.length > 0).length > 0) {
53
+ return (
54
+ <select onChange={this.handleSelectChange}>
55
+ <option value="">{`${labels[lang].select}...`}</option>
56
+ {children.map((c) => <option key={c.name} value={c.name}>{c.name}</option>)}
57
+ </select>
58
+ );
59
+ }
60
+ }
61
+ return (
62
+ <ul>
63
+ {children.map(
64
+ (c) => (
65
+ <li key={c.name}>
66
+ {(() => {
67
+ if (c.children.length > 0) {
68
+ return (
69
+ <button
70
+ type="button"
71
+ onClick={() => {
72
+ this.nextNode(c);
73
+ }}
74
+ dangerouslySetInnerHTML={{ __html: c.name }}
75
+ />
76
+ );
77
+ }
78
+ if (c.name.indexOf(' ') === -1 && window.renderVCard) { // Det skal vi så lige huske at sætte på medarbejderkontaktboksene!
79
+ return <FlowBoxPhoneComponent phone={c.name} lang={lang} />;
80
+ }
81
+ return <span dangerouslySetInnerHTML={{ __html: c.name }} />;
82
+ })()}
83
+ </li>
84
+ ),
85
+ )}
86
+ </ul>
87
+ );
88
+ })()}
89
+ {(() => {
90
+ if (node.parent != null) {
91
+ return (
92
+ <button
93
+ type="button"
94
+ className="button small"
95
+ onClick={() => {
96
+ this.prevNode(node);
97
+ }}
98
+ >
99
+ {labels[lang].back}
100
+ </button>
101
+ );
102
+ }
103
+ return null;
104
+ })()}
105
+ </div>
106
+ );
107
+ }
108
+ }
109
+
110
+ FlowBoxComponent.propTypes = {
111
+ box: PropTypes.shape({
112
+ item: PropTypes.shape({
113
+ name: PropTypes.string.isRequired,
114
+ }).isRequired,
115
+ data: PropTypes.shape({
116
+ prepend: PropTypes.string.isRequired,
117
+ }).isRequired,
118
+ config: PropTypes.shape({
119
+ render: PropTypes.string.isRequired,
120
+ }).isRequired,
121
+ }).isRequired,
122
+ lang: PropTypes.string.isRequired,
123
+ };
124
+
125
+ FlowBoxComponent.displayName = 'FlowBoxComponent';
126
+ export default FlowBoxComponent;
@@ -1,106 +1,106 @@
1
- /* eslint-env browser */
2
- import React from 'react';
3
- import PropTypes from 'prop-types';
4
- import axios from 'axios';
5
- import AUSpinnerComponent from '../AUSpinnerComponent';
6
- import { flowboxLabels as labels } from '../../lib/i18n';
7
-
8
- class FlowBoxPhoneComponent extends React.Component {
9
- constructor(props) {
10
- super(props);
11
- this.state = {
12
- persons: [],
13
- };
14
- }
15
-
16
- componentDidMount() {
17
- const { phone } = this.props;
18
- const iPureUrl = `https://ipure.nfit.au.dk/searchPeople.php?mode=json&q=${phone}`;
19
- axios.get(iPureUrl).then((promise) => {
20
- const persons = promise.data;
21
- this.setState({
22
- persons,
23
- }, () => {
24
- if (typeof window.flowboxCallback !== 'undefined') {
25
- window.flowboxCallback.forEach((callback) => {
26
- if (callback.target === `p-${phone}`) {
27
- callback.func(persons);
28
- }
29
- });
30
- }
31
- });
32
- });
33
- }
34
-
35
- render() {
36
- const { persons } = this.state;
37
- const { lang, phone } = this.props;
38
-
39
- const renderVCard = persons.map((person) => {
40
- const { departments } = person;
41
- const email = departments.length > 0 ? departments[0].email : '';
42
- const renderDepartments = departments.map((department) => [
43
- <span key={0} className="org">{department.name}</span>,
44
- <br key={1} />,
45
- <span key={2}>{`${labels[lang].building} ${department.address.building.id}, ${labels[lang].office} ${department.address.building.room}`}</span>,
46
- <br key={3} />,
47
- <span key={4} className="adr">
48
- <span className="street-address">{department.address.street}</span>
49
- <span>, </span>
50
- <span className="postal-code">{department.address.zip}</span>
51
- <span className="localityName">{department.address.city}</span>
52
- </span>,
53
- <br key={5} />,
54
- <br key={6} />,
55
- <span key={7}>T: </span>,
56
- <span key={8} className="tel">{department.phone}</span>,
57
- <br key={9} />,
58
- <span key={10}>M: </span>,
59
- <span key={11} className="tel">{department.mobile}</span>,
60
- <br key={12} />,
61
- <span key={13}>E: </span>,
62
- <a key={14} className="email" href={`mailto:${department.email}`}>{department.email}</a>,
63
- <br key={15} />,
64
- ]);
65
- return (
66
- <div key={person.id} className="vcard">
67
- <h2 className="fn">
68
- <a className="url" href={`http://au.dk/${email}`}>{person.fullName}</a>
69
- </h2>
70
- <p>
71
- {(() => {
72
- if (person.photo) {
73
- return (
74
- <a className="photo" href={`http://au.dk/${email}`}>
75
- <img style={{ width: '70px', float: 'right', marginLeft: '1em' }} src={person.photo} alt={person.fullName} title={person.fullName} />
76
- </a>
77
- );
78
- }
79
- return null;
80
- })()}
81
- {renderDepartments}
82
- </p>
83
- </div>
84
- );
85
- });
86
-
87
- return (
88
- <AUSpinnerComponent
89
- loadingCondition={persons.length === 0}
90
- loaded={persons.length > 0}
91
- >
92
- <div id={`p-${phone}`}>
93
- {renderVCard}
94
- </div>
95
- </AUSpinnerComponent>
96
- );
97
- }
98
- }
99
-
100
- FlowBoxPhoneComponent.propTypes = {
101
- phone: PropTypes.string.isRequired,
102
- lang: PropTypes.string.isRequired,
103
- };
104
-
105
- FlowBoxPhoneComponent.displayName = 'FlowBoxPhoneComponent';
106
- export default FlowBoxPhoneComponent;
1
+ /* eslint-env browser */
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import axios from 'axios';
5
+ import AUSpinnerComponent from '../AUSpinnerComponent';
6
+ import { flowboxLabels as labels } from '../../lib/i18n';
7
+
8
+ class FlowBoxPhoneComponent extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this.state = {
12
+ persons: [],
13
+ };
14
+ }
15
+
16
+ componentDidMount() {
17
+ const { phone } = this.props;
18
+ const iPureUrl = `https://ipure.nfit.au.dk/searchPeople.php?mode=json&q=${phone}`;
19
+ axios.get(iPureUrl).then((promise) => {
20
+ const persons = promise.data;
21
+ this.setState({
22
+ persons,
23
+ }, () => {
24
+ if (typeof window.flowboxCallback !== 'undefined') {
25
+ window.flowboxCallback.forEach((callback) => {
26
+ if (callback.target === `p-${phone}`) {
27
+ callback.func(persons);
28
+ }
29
+ });
30
+ }
31
+ });
32
+ });
33
+ }
34
+
35
+ render() {
36
+ const { persons } = this.state;
37
+ const { lang, phone } = this.props;
38
+
39
+ const renderVCard = persons.map((person) => {
40
+ const { departments } = person;
41
+ const email = departments.length > 0 ? departments[0].email : '';
42
+ const renderDepartments = departments.map((department) => [
43
+ <span key={0} className="org">{department.name}</span>,
44
+ <br key={1} />,
45
+ <span key={2}>{`${labels[lang].building} ${department.address.building.id}, ${labels[lang].office} ${department.address.building.room}`}</span>,
46
+ <br key={3} />,
47
+ <span key={4} className="adr">
48
+ <span className="street-address">{department.address.street}</span>
49
+ <span>, </span>
50
+ <span className="postal-code">{department.address.zip}</span>
51
+ <span className="localityName">{department.address.city}</span>
52
+ </span>,
53
+ <br key={5} />,
54
+ <br key={6} />,
55
+ <span key={7}>T: </span>,
56
+ <span key={8} className="tel">{department.phone}</span>,
57
+ <br key={9} />,
58
+ <span key={10}>M: </span>,
59
+ <span key={11} className="tel">{department.mobile}</span>,
60
+ <br key={12} />,
61
+ <span key={13}>E: </span>,
62
+ <a key={14} className="email" href={`mailto:${department.email}`}>{department.email}</a>,
63
+ <br key={15} />,
64
+ ]);
65
+ return (
66
+ <div key={person.id} className="vcard">
67
+ <h2 className="fn">
68
+ <a className="url" href={`http://au.dk/${email}`}>{person.fullName}</a>
69
+ </h2>
70
+ <p>
71
+ {(() => {
72
+ if (person.photo) {
73
+ return (
74
+ <a className="photo" href={`http://au.dk/${email}`}>
75
+ <img style={{ width: '70px', float: 'right', marginLeft: '1em' }} src={person.photo} alt={person.fullName} title={person.fullName} />
76
+ </a>
77
+ );
78
+ }
79
+ return null;
80
+ })()}
81
+ {renderDepartments}
82
+ </p>
83
+ </div>
84
+ );
85
+ });
86
+
87
+ return (
88
+ <AUSpinnerComponent
89
+ loadingCondition={persons.length === 0}
90
+ loaded={persons.length > 0}
91
+ >
92
+ <div id={`p-${phone}`}>
93
+ {renderVCard}
94
+ </div>
95
+ </AUSpinnerComponent>
96
+ );
97
+ }
98
+ }
99
+
100
+ FlowBoxPhoneComponent.propTypes = {
101
+ phone: PropTypes.string.isRequired,
102
+ lang: PropTypes.string.isRequired,
103
+ };
104
+
105
+ FlowBoxPhoneComponent.displayName = 'FlowBoxPhoneComponent';
106
+ export default FlowBoxPhoneComponent;
@@ -1,18 +1,18 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- const AUMobilePrefixComponent = ({ countryCodes, important }) => {
5
- const renderCountryCodes = codes => codes.map(c => <option key={c.da} value={`+${c.code}`}>{`${c.da} (+${c.code})`}</option>);
6
- if (important) {
7
- return renderCountryCodes(countryCodes.filter(c => c.important));
8
- }
9
- return renderCountryCodes(countryCodes);
10
- };
11
-
12
- AUMobilePrefixComponent.propTypes = {
13
- countryCodes: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
14
- important: PropTypes.bool.isRequired,
15
- };
16
-
17
- AUMobilePrefixComponent.displayName = 'AUMobilePrefixComponent';
18
- export default AUMobilePrefixComponent;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const AUMobilePrefixComponent = ({ countryCodes, important }) => {
5
+ const renderCountryCodes = codes => codes.map(c => <option key={c.da} value={`+${c.code}`}>{`${c.da} (+${c.code})`}</option>);
6
+ if (important) {
7
+ return renderCountryCodes(countryCodes.filter(c => c.important));
8
+ }
9
+ return renderCountryCodes(countryCodes);
10
+ };
11
+
12
+ AUMobilePrefixComponent.propTypes = {
13
+ countryCodes: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
14
+ important: PropTypes.bool.isRequired,
15
+ };
16
+
17
+ AUMobilePrefixComponent.displayName = 'AUMobilePrefixComponent';
18
+ export default AUMobilePrefixComponent;
@@ -1,40 +1,40 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
-
4
- const AUReceiptComponent = ({
5
- receiptText,
6
- helpText,
7
- showGoTo,
8
- buttons,
9
- }) => {
10
- const renderButtons = buttons.map((btn) => <a key={btn.gotoLink} href={btn.gotoLink} className="button">{btn.gotoText}</a>);
11
- return (
12
- <div className="receipt">
13
- <div className="receipt__icon" data-icon="" />
14
- <h1 className="receipt__header" dangerouslySetInnerHTML={{ __html: receiptText }} />
15
- {helpText}
16
- {
17
- showGoTo && (
18
- <div className="receipt__post-action">
19
- {renderButtons}
20
- </div>
21
- )
22
- }
23
- </div>
24
- );
25
- };
26
-
27
- AUReceiptComponent.defaultProps = {
28
- showGoTo: true,
29
- helpText: null,
30
- buttons: [],
31
- };
32
-
33
- AUReceiptComponent.propTypes = {
34
- receiptText: PropTypes.string.isRequired,
35
- helpText: PropTypes.element,
36
- showGoTo: PropTypes.bool,
37
- buttons: PropTypes.arrayOf(PropTypes.shape({})),
38
- };
39
- AUReceiptComponent.displayName = 'AUReceiptComponent';
40
- export default AUReceiptComponent;
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const AUReceiptComponent = ({
5
+ receiptText,
6
+ helpText,
7
+ showGoTo,
8
+ buttons,
9
+ }) => {
10
+ const renderButtons = buttons.map((btn) => <a key={btn.gotoLink} href={btn.gotoLink} className="button">{btn.gotoText}</a>);
11
+ return (
12
+ <div className="receipt">
13
+ <div className="receipt__icon" data-icon="" />
14
+ <h1 className="receipt__header" dangerouslySetInnerHTML={{ __html: receiptText }} />
15
+ {helpText}
16
+ {
17
+ showGoTo && (
18
+ <div className="receipt__post-action">
19
+ {renderButtons}
20
+ </div>
21
+ )
22
+ }
23
+ </div>
24
+ );
25
+ };
26
+
27
+ AUReceiptComponent.defaultProps = {
28
+ showGoTo: true,
29
+ helpText: null,
30
+ buttons: [],
31
+ };
32
+
33
+ AUReceiptComponent.propTypes = {
34
+ receiptText: PropTypes.string.isRequired,
35
+ helpText: PropTypes.element,
36
+ showGoTo: PropTypes.bool,
37
+ buttons: PropTypes.arrayOf(PropTypes.shape({})),
38
+ };
39
+ AUReceiptComponent.displayName = 'AUReceiptComponent';
40
+ export default AUReceiptComponent;