@ndla/ui 3.0.8 → 3.0.12

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/lib/index.d.ts CHANGED
@@ -46,3 +46,4 @@ export { default as ResourceGroup } from './ResourceGroup';
46
46
  export { default as LayoutItem, OneColumn, PageContainer, Content } from './Layout';
47
47
  export { SubjectAbout, SubjectArchive, SubjectCarousel, SubjectChildContent, SubjectContent, SubjectFilter, SubjectFlexChild, SubjectFlexWrapper, SubjectHeader, SubjectLinks, SubjectNewContent, SubjectSecondaryContent, SubjectSectionTitle, SubjectShortcuts, SubjectSidebarWrapper, SubjectSocialContent, SubjectSocialSection, SubjectTopics, SubjectBanner, } from './Subject';
48
48
  export { default as ContentCard } from './ContentCard';
49
+ export { default as MatomoTracker } from './Matomo';
package/lib/index.js CHANGED
@@ -103,7 +103,8 @@ var _exportNames = {
103
103
  SubjectSocialSection: true,
104
104
  SubjectTopics: true,
105
105
  SubjectBanner: true,
106
- ContentCard: true
106
+ ContentCard: true,
107
+ MatomoTracker: true
107
108
  };
108
109
  Object.defineProperty(exports, "ArticleByline", {
109
110
  enumerable: true,
@@ -693,6 +694,12 @@ Object.defineProperty(exports, "ContentCard", {
693
694
  return _ContentCard["default"];
694
695
  }
695
696
  });
697
+ Object.defineProperty(exports, "MatomoTracker", {
698
+ enumerable: true,
699
+ get: function get() {
700
+ return _Matomo["default"];
701
+ }
702
+ });
696
703
 
697
704
  var _indexJavascript = require("./index-javascript");
698
705
 
@@ -781,6 +788,8 @@ var _Subject = require("./Subject");
781
788
 
782
789
  var _ContentCard = _interopRequireDefault(require("./ContentCard"));
783
790
 
791
+ var _Matomo = _interopRequireDefault(require("./Matomo"));
792
+
784
793
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
785
794
 
786
795
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
@@ -17,6 +17,10 @@ declare const messages: {
17
17
  user: {
18
18
  loggedInAs: string;
19
19
  loggedInAsButton: string;
20
+ role: {
21
+ employee: string;
22
+ student: string;
23
+ };
20
24
  buttonLogIn: string;
21
25
  buttonLogOut: string;
22
26
  generalFooter: string;
@@ -145,6 +149,7 @@ declare const messages: {
145
149
  all: string;
146
150
  hits: string;
147
151
  showingSearchPhrase: string;
152
+ showingCompetenceGoalSearchPhrase: string;
148
153
  searchPhraseSuggestion: string;
149
154
  notionLabels: string;
150
155
  notionsHeading: string;
@@ -202,6 +207,7 @@ declare const messages: {
202
207
  };
203
208
  welcomePage: {
204
209
  search: string;
210
+ searchDisclaimer: string;
205
211
  resetSearch: string;
206
212
  closeSearch: string;
207
213
  searchAllInfo: string;
@@ -322,11 +328,8 @@ declare const messages: {
322
328
  };
323
329
  };
324
330
  article: {
325
- author: string;
326
- published: string;
327
331
  edition: string;
328
332
  publisher: string;
329
- created: string;
330
333
  lastUpdated: string;
331
334
  closeLabel: string;
332
335
  useContent: string;
@@ -134,6 +134,7 @@ var messages = _objectSpread(_objectSpread({
134
134
  all: 'All',
135
135
  hits: '{{count}} hits',
136
136
  showingSearchPhrase: 'Showing results for:',
137
+ showingCompetenceGoalSearchPhrase: 'Showing results for competence goals {text}',
137
138
  searchPhraseSuggestion: 'Search instead for:',
138
139
  notionLabels: 'Used in',
139
140
  notionsHeading: 'Begrepsforklaring',
@@ -191,6 +192,7 @@ var messages = _objectSpread(_objectSpread({
191
192
  },
192
193
  welcomePage: {
193
194
  search: 'Search',
195
+ searchDisclaimer: 'We are constantly working to improve ourselves! If you have comments to the search, please use the «spør NDLA» function in the bottom right corner.',
194
196
  resetSearch: 'Empty search',
195
197
  closeSearch: 'Close search',
196
198
  searchAllInfo: 'View all results',
@@ -287,11 +289,8 @@ var messages = _objectSpread(_objectSpread({
287
289
  }
288
290
  },
289
291
  article: {
290
- author: 'Author',
291
- published: 'Published',
292
292
  edition: 'Edition',
293
293
  publisher: 'Publisher',
294
- created: 'Created',
295
294
  lastUpdated: 'Last updated',
296
295
  closeLabel: 'Close',
297
296
  useContent: 'Cite or use',
@@ -804,6 +803,10 @@ var messages = _objectSpread(_objectSpread({
804
803
  user: {
805
804
  loggedInAs: 'You are logged in as {{role}}.',
806
805
  loggedInAsButton: 'You are logged in as {{role}}',
806
+ role: {
807
+ employee: 'Teacher',
808
+ student: 'Student'
809
+ },
807
810
  buttonLogIn: 'Log in with Feide',
808
811
  buttonLogOut: 'Log out',
809
812
  generalFooter: 'Some resources may only be accessed by teachers who are logged in.',
@@ -17,6 +17,10 @@ declare const messages: {
17
17
  user: {
18
18
  loggedInAs: string;
19
19
  loggedInAsButton: string;
20
+ role: {
21
+ employee: string;
22
+ student: string;
23
+ };
20
24
  buttonLogIn: string;
21
25
  buttonLogOut: string;
22
26
  generalFooter: string;
@@ -676,6 +680,7 @@ declare const messages: {
676
680
  createLearningPathButtonText: string;
677
681
  lastUpdated: string;
678
682
  youAreInALearningPath: string;
683
+ readTime: string;
679
684
  readTimeHour: string;
680
685
  readTimeHour_plurals: string;
681
686
  readTimeMinutesShort: string;
@@ -641,6 +641,7 @@ var messages = _objectSpread(_objectSpread({
641
641
  createLearningPathButtonText: 'Gå til stier',
642
642
  lastUpdated: 'Sist oppdatert',
643
643
  youAreInALearningPath: 'Du er nå inne i en læringssti',
644
+ readTime: '{{hours}} Skoletimer = {{minutes}} min',
644
645
  readTimeHour: 'time',
645
646
  readTimeHour_plurals: 'timer',
646
647
  readTimeMinutesShort: 'min',
@@ -802,6 +803,10 @@ var messages = _objectSpread(_objectSpread({
802
803
  user: {
803
804
  loggedInAs: 'Du er pålogget som {{role}}.',
804
805
  loggedInAsButton: 'Du er pålogget som {{role}}',
806
+ role: {
807
+ employee: 'Lærer',
808
+ student: 'Elev'
809
+ },
805
810
  buttonLogIn: 'Logg inn med Feide',
806
811
  buttonLogOut: 'Logg ut',
807
812
  generalFooter: 'Enkelte ressurser er bare tilgjengelige for påloggede lærere.',
@@ -17,6 +17,10 @@ declare const messages: {
17
17
  user: {
18
18
  loggedInAs: string;
19
19
  loggedInAsButton: string;
20
+ role: {
21
+ employee: string;
22
+ student: string;
23
+ };
20
24
  buttonLogIn: string;
21
25
  buttonLogOut: string;
22
26
  generalFooter: string;
@@ -145,6 +149,7 @@ declare const messages: {
145
149
  all: string;
146
150
  hits: string;
147
151
  showingSearchPhrase: string;
152
+ showingCompetenceGoalSearchPhrase: string;
148
153
  searchPhraseSuggestion: string;
149
154
  notionLabels: string;
150
155
  notionsHeading: string;
@@ -134,6 +134,7 @@ var messages = _objectSpread(_objectSpread({
134
134
  all: 'Alle',
135
135
  hits: '{{count}} Treff',
136
136
  showingSearchPhrase: 'Viser resultat for',
137
+ showingCompetenceGoalSearchPhrase: 'Viser resultat for kompetansemål {text}',
137
138
  searchPhraseSuggestion: 'Søk i staden for',
138
139
  notionLabels: 'Brukes i',
139
140
  notionsHeading: 'Begrepsforklaring',
@@ -802,6 +803,10 @@ var messages = _objectSpread(_objectSpread({
802
803
  user: {
803
804
  loggedInAs: 'Du er pålogga som {{role}}.',
804
805
  loggedInAsButton: 'Du er pålogga som {{role}}',
806
+ role: {
807
+ employee: 'Lærer',
808
+ student: 'Elev'
809
+ },
805
810
  buttonLogIn: 'Logg inn med Feide',
806
811
  buttonLogOut: 'Logg ut',
807
812
  generalFooter: 'Enkelte ressursar er berre tilgjengelege for pålogga lærarar.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "3.0.8",
3
+ "version": "3.0.12",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,18 +31,18 @@
31
31
  "types"
32
32
  ],
33
33
  "dependencies": {
34
- "@ndla/button": "^1.0.5",
35
- "@ndla/carousel": "^1.0.5",
34
+ "@ndla/button": "^1.0.6",
35
+ "@ndla/carousel": "^1.0.6",
36
36
  "@ndla/core": "^0.7.2",
37
- "@ndla/hooks": "^1.0.3",
38
- "@ndla/icons": "^1.3.0",
39
- "@ndla/licenses": "^1.0.6",
40
- "@ndla/modal": "^1.1.8",
41
- "@ndla/safelink": "^1.0.4",
37
+ "@ndla/hooks": "^1.0.6",
38
+ "@ndla/icons": "^1.3.1",
39
+ "@ndla/licenses": "^1.0.7",
40
+ "@ndla/modal": "^1.1.11",
41
+ "@ndla/safelink": "^1.0.5",
42
42
  "@ndla/switch": "^0.0.32",
43
- "@ndla/tabs": "^1.0.5",
43
+ "@ndla/tabs": "^1.0.8",
44
44
  "@ndla/tooltip": "^0.2.46",
45
- "@ndla/util": "^1.0.3",
45
+ "@ndla/util": "^2.0.0",
46
46
  "@reach/menu-button": "^0.12.1",
47
47
  "@reach/slider": "^0.12.1",
48
48
  "@types/hoist-non-react-statics": "^3.3.1",
@@ -92,5 +92,5 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "gitHead": "d1ecd5ff599a20928025056e7946c4adea3ad685"
95
+ "gitHead": "358121e2526a252d2b53f010e4b38c17040872dc"
96
96
  }
@@ -64,7 +64,7 @@ type Props = {
64
64
  };
65
65
 
66
66
  const ArticleByline = ({
67
- authors,
67
+ authors = [],
68
68
  suppliers,
69
69
  license,
70
70
  licenseBox,
@@ -95,16 +95,17 @@ const ArticleByline = ({
95
95
  return contributorsArray.join('');
96
96
  };
97
97
  const licenseRights = getLicenseByAbbreviation(license, locale).rights;
98
-
99
98
  return (
100
99
  <Wrapper>
101
100
  <div>
102
101
  {t('article.lastUpdated')} {published}
103
102
  </div>
104
- {authors && (
103
+ {(authors.length > 0 || licenseRights.length > 0) && (
105
104
  <TextWrapper>
106
105
  <LicenseByline licenseRights={licenseRights}>
107
- <AuthorsWrapper>{t('article.authorsLabel', { names: renderContributors(authors) })}</AuthorsWrapper>
106
+ {authors.length > 0 && (
107
+ <AuthorsWrapper>{t('article.authorsLabel', { names: renderContributors(authors) })}</AuthorsWrapper>
108
+ )}
108
109
  </LicenseByline>
109
110
  </TextWrapper>
110
111
  )}
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright (c) 2021-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import React from 'react';
10
+
11
+ interface Props {
12
+ trackerUrl: string;
13
+ siteId: string;
14
+ }
15
+
16
+ export const MatomoTracker = ({ trackerUrl, siteId }: Props) => {
17
+ return (
18
+ <script
19
+ dangerouslySetInnerHTML={{
20
+ __html: `
21
+ var _paq = window._paq = window._paq || [];
22
+ _paq.push(['trackPageView']);
23
+ _paq.push(['enableLinkTracking']);
24
+ (function() {
25
+ var u="${trackerUrl}";
26
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
27
+ _paq.push(['setSiteId', '${siteId}']);
28
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
29
+ g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
30
+ })();`,
31
+ }}
32
+ />
33
+ );
34
+ };
35
+
36
+ export default MatomoTracker;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2021-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import MatomoTracker from './MatomoTracker';
10
+
11
+ export default MatomoTracker;
@@ -1,4 +1,4 @@
1
- import React, { ReactChildren } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import styled from '@emotion/styled';
4
4
  import { breakpoints, fonts, mq } from '@ndla/core';
@@ -87,7 +87,7 @@ const Illustration = styled.div`
87
87
 
88
88
  type Props = {
89
89
  cards: ListItemProps[];
90
- children: ReactChildren;
90
+ children: ReactNode;
91
91
  totalCardCount: number;
92
92
  hideCards?: boolean;
93
93
  };
package/src/index.ts CHANGED
@@ -135,3 +135,4 @@ export {
135
135
  } from './Subject';
136
136
 
137
137
  export { default as ContentCard } from './ContentCard';
138
+ export { default as MatomoTracker } from './Matomo';
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) 2021-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import { validateTranslationFiles } from '@ndla/util';
10
+ import messagesNB from '../messages-nb';
11
+ import messagesNN from '../messages-nn';
12
+ import messagesEN from '../messages-en';
13
+
14
+ test('That all translations has all language keys', () => {
15
+ const anyMissing = validateTranslationFiles(
16
+ [
17
+ {
18
+ languageName: 'Norsk bokmål',
19
+ translationObject: messagesNB,
20
+ },
21
+ {
22
+ languageName: 'Norsk nynorsk',
23
+ translationObject: messagesNN,
24
+ },
25
+ {
26
+ languageName: 'English',
27
+ translationObject: messagesEN,
28
+ },
29
+ ],
30
+ 'only-on-error',
31
+ );
32
+
33
+ expect(anyMissing).toBe(false);
34
+ });
@@ -131,6 +131,7 @@ const messages = {
131
131
  all: 'All',
132
132
  hits: '{{count}} hits',
133
133
  showingSearchPhrase: 'Showing results for:',
134
+ showingCompetenceGoalSearchPhrase: 'Showing results for competence goals {text}',
134
135
  searchPhraseSuggestion: 'Search instead for:',
135
136
  notionLabels: 'Used in',
136
137
  notionsHeading: 'Begrepsforklaring',
@@ -189,6 +190,8 @@ const messages = {
189
190
  },
190
191
  welcomePage: {
191
192
  search: 'Search',
193
+ searchDisclaimer:
194
+ 'We are constantly working to improve ourselves! If you have comments to the search, please use the «spør NDLA» function in the bottom right corner.',
192
195
  resetSearch: 'Empty search',
193
196
  closeSearch: 'Close search',
194
197
  searchAllInfo: 'View all results',
@@ -310,11 +313,8 @@ const messages = {
310
313
  },
311
314
  },
312
315
  article: {
313
- author: 'Author',
314
- published: 'Published',
315
316
  edition: 'Edition',
316
317
  publisher: 'Publisher',
317
- created: 'Created',
318
318
  lastUpdated: 'Last updated',
319
319
  closeLabel: 'Close',
320
320
  useContent: 'Cite or use',
@@ -832,6 +832,10 @@ const messages = {
832
832
  user: {
833
833
  loggedInAs: 'You are logged in as {{role}}.',
834
834
  loggedInAsButton: 'You are logged in as {{role}}',
835
+ role: {
836
+ employee: 'Teacher',
837
+ student: 'Student',
838
+ },
835
839
  buttonLogIn: 'Log in with Feide',
836
840
  buttonLogOut: 'Log out',
837
841
  generalFooter: 'Some resources may only be accessed by teachers who are logged in.',
@@ -669,6 +669,7 @@ const messages = {
669
669
  createLearningPathButtonText: 'Gå til stier',
670
670
  lastUpdated: 'Sist oppdatert',
671
671
  youAreInALearningPath: 'Du er nå inne i en læringssti',
672
+ readTime: '{{hours}} Skoletimer = {{minutes}} min',
672
673
  readTimeHour: 'time',
673
674
  readTimeHour_plurals: 'timer',
674
675
  readTimeMinutesShort: 'min',
@@ -830,6 +831,10 @@ const messages = {
830
831
  user: {
831
832
  loggedInAs: 'Du er pålogget som {{role}}.',
832
833
  loggedInAsButton: 'Du er pålogget som {{role}}',
834
+ role: {
835
+ employee: 'Lærer',
836
+ student: 'Elev',
837
+ },
833
838
  buttonLogIn: 'Logg inn med Feide',
834
839
  buttonLogOut: 'Logg ut',
835
840
  generalFooter: 'Enkelte ressurser er bare tilgjengelige for påloggede lærere.',
@@ -131,6 +131,7 @@ const messages = {
131
131
  all: 'Alle',
132
132
  hits: '{{count}} Treff',
133
133
  showingSearchPhrase: 'Viser resultat for',
134
+ showingCompetenceGoalSearchPhrase: 'Viser resultat for kompetansemål {text}',
134
135
  searchPhraseSuggestion: 'Søk i staden for',
135
136
  notionLabels: 'Brukes i',
136
137
  notionsHeading: 'Begrepsforklaring',
@@ -831,6 +832,10 @@ const messages = {
831
832
  user: {
832
833
  loggedInAs: 'Du er pålogga som {{role}}.',
833
834
  loggedInAsButton: 'Du er pålogga som {{role}}',
835
+ role: {
836
+ employee: 'Lærer',
837
+ student: 'Elev',
838
+ },
834
839
  buttonLogIn: 'Logg inn med Feide',
835
840
  buttonLogOut: 'Logg ut',
836
841
  generalFooter: 'Enkelte ressursar er berre tilgjengelege for pålogga lærarar.',