@ndla/ui 13.1.1 → 13.2.2

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 (42) hide show
  1. package/es/Article/Article.js +1 -1
  2. package/es/Article/ArticleHeaderWrapper.js +4 -4
  3. package/es/Frontpage/FrontpageAllSubjects.js +8 -8
  4. package/es/Notion/ConceptNotion.js +26 -1
  5. package/es/Notion/FigureNotion.js +28 -20
  6. package/es/Notion/NotionVisualElement.js +3 -2
  7. package/es/SearchTypeResult/SearchViewType.js +5 -5
  8. package/es/locale/messages-en.js +4 -4
  9. package/es/locale/messages-nb.js +4 -4
  10. package/es/locale/messages-nn.js +4 -4
  11. package/es/locale/messages-se.js +4 -4
  12. package/es/locale/messages-sma.js +4 -4
  13. package/lib/Article/Article.d.ts +2 -2
  14. package/lib/Article/Article.js +1 -1
  15. package/lib/Article/ArticleHeaderWrapper.d.ts +1 -1
  16. package/lib/Article/ArticleHeaderWrapper.js +4 -4
  17. package/lib/Frontpage/FrontpageAllSubjects.js +8 -8
  18. package/lib/Notion/ConceptNotion.js +26 -2
  19. package/lib/Notion/FigureNotion.d.ts +1 -1
  20. package/lib/Notion/FigureNotion.js +26 -19
  21. package/lib/Notion/NotionVisualElement.js +3 -2
  22. package/lib/SearchTypeResult/SearchViewType.js +5 -5
  23. package/lib/locale/messages-en.js +4 -4
  24. package/lib/locale/messages-nb.js +4 -4
  25. package/lib/locale/messages-nn.js +4 -4
  26. package/lib/locale/messages-se.js +4 -4
  27. package/lib/locale/messages-sma.js +4 -4
  28. package/lib/types.d.ts +1 -1
  29. package/package.json +3 -3
  30. package/src/Article/Article.tsx +2 -1
  31. package/src/Article/ArticleHeaderWrapper.tsx +1 -0
  32. package/src/Frontpage/FrontpageAllSubjects.tsx +1 -1
  33. package/src/Notion/ConceptNotion.tsx +18 -2
  34. package/src/Notion/FigureNotion.tsx +16 -15
  35. package/src/Notion/NotionVisualElement.tsx +1 -1
  36. package/src/SearchTypeResult/SearchViewType.tsx +1 -1
  37. package/src/locale/messages-en.ts +4 -4
  38. package/src/locale/messages-nb.ts +4 -4
  39. package/src/locale/messages-nn.ts +4 -4
  40. package/src/locale/messages-se.ts +4 -4
  41. package/src/locale/messages-sma.ts +4 -4
  42. package/src/types.ts +1 -1
@@ -12,6 +12,7 @@ import { initArticleScripts } from '@ndla/article-scripts';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { breakpoints, mq, spacing } from '@ndla/core';
14
14
  import { parseMarkdown } from '@ndla/util';
15
+ import { getLicenseCredits } from '@ndla/licenses';
15
16
  import Notion, { NotionDialogContent, NotionDialogText, NotionDialogLicenses } from '@ndla/notion';
16
17
  import { Notion as UINotion } from '.';
17
18
  import { NotionImage } from './NotionImage';
@@ -57,6 +58,12 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, fig
57
58
  const visualElementId = `visual-element-${concept.id}`;
58
59
  const { t } = useTranslation();
59
60
 
61
+ const { creators, rightsholders, processors } = getLicenseCredits(concept.copyright);
62
+
63
+ const authors = (creators.length || rightsholders.length ? [...creators, ...rightsholders] : [...processors]).map(
64
+ (author) => author.name,
65
+ );
66
+
60
67
  useEffect(() => {
61
68
  if (!disableScripts) {
62
69
  initArticleScripts();
@@ -67,6 +74,7 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, fig
67
74
  <FigureNotion
68
75
  resizeIframe
69
76
  id={figureId}
77
+ title={concept.title}
70
78
  figureId={visualElementId}
71
79
  copyright={concept.copyright}
72
80
  licenseString={concept.copyright?.license?.license ?? ''}
@@ -94,7 +102,11 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, fig
94
102
  ) : undefined}
95
103
  <NotionDialogText>{parseMarkdown(concept.text, 'body')}</NotionDialogText>
96
104
  </NotionDialogContent>
97
- <NotionDialogLicenses license={concept.copyright?.license?.license ?? ''} source={concept.source} />
105
+ <NotionDialogLicenses
106
+ authors={authors}
107
+ license={concept.copyright?.license?.license ?? ''}
108
+ source={concept.source}
109
+ />
98
110
  </>
99
111
  }>
100
112
  {concept.visualElement.image && (
@@ -129,7 +141,11 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, fig
129
141
 
130
142
  <NotionDialogText>{parseMarkdown(concept.text, 'body')}</NotionDialogText>
131
143
  </NotionDialogContent>
132
- <NotionDialogLicenses license={concept.copyright?.license?.license ?? ''} source={concept.source} />
144
+ <NotionDialogLicenses
145
+ authors={authors}
146
+ license={concept.copyright?.license?.license ?? ''}
147
+ source={concept.source}
148
+ />
133
149
  </>
134
150
  }>
135
151
  {concept.image && (
@@ -7,7 +7,7 @@
7
7
 
8
8
  import styled from '@emotion/styled';
9
9
  import { colors, spacing } from '@ndla/core';
10
- import { getGroupedContributorDescriptionList, getLicenseByAbbreviation } from '@ndla/licenses';
10
+ import { getGroupedContributorDescriptionList, getLicenseByAbbreviation, getLicenseCredits } from '@ndla/licenses';
11
11
  import React, { ReactNode } from 'react';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { Figure, FigureCaption, FigureLicenseDialog, FigureType } from '../Figure';
@@ -23,7 +23,7 @@ interface Props {
23
23
  figureId: string;
24
24
  children: ReactNode | ((params: { typeClass: string }) => ReactNode);
25
25
  id: string;
26
- title?: string;
26
+ title: string;
27
27
  copyright?: Partial<Copyright>;
28
28
  licenseString: string;
29
29
  type: 'video' | 'h5p' | 'image' | 'concept' | 'other';
@@ -47,15 +47,15 @@ const FigureNotion = ({
47
47
  }: Props) => {
48
48
  const { t, i18n } = useTranslation();
49
49
  const license = getLicenseByAbbreviation(licenseString, i18n.language);
50
- const { creators, processors, rightsholders } = copyright ?? {};
51
- const contributors = getGroupedContributorDescriptionList(
52
- {
53
- creators: creators ?? [],
54
- processors: processors ?? [],
55
- rightsholders: rightsholders ?? [],
56
- },
57
- i18n.language,
58
- ).map((i) => ({ name: i.description, type: i.label }));
50
+ const licenseCredits = getLicenseCredits(copyright);
51
+ const { creators, rightsholders, processors } = licenseCredits;
52
+
53
+ const authors = creators.length || rightsholders.length ? [...creators, ...rightsholders] : [...processors];
54
+
55
+ const groupedAuthors = getGroupedContributorDescriptionList(licenseCredits, i18n.language).map((item) => ({
56
+ name: item.description,
57
+ type: item.label,
58
+ }));
59
59
 
60
60
  return (
61
61
  <Figure resizeIframe={resizeIframe} id={figureId} type={figureType || 'full-column'}>
@@ -68,23 +68,24 @@ const FigureNotion = ({
68
68
  figureId={figureId}
69
69
  id={id}
70
70
  reuseLabel={t(`${type}.reuse`)}
71
- authors={contributors}
71
+ authors={authors}
72
72
  licenseRights={license.rights}
73
73
  hideIconsAndAuthors={hideIconsAndAuthors}>
74
74
  <FigureLicenseDialog
75
75
  id={id}
76
- authors={contributors}
76
+ authors={groupedAuthors}
77
77
  locale={i18n.language}
78
78
  title={title}
79
79
  origin={copyright?.origin}
80
80
  license={license}
81
81
  messages={{
82
82
  close: t('close'),
83
- rulesForUse: t('license.concept.rules'),
83
+ rulesForUse: t(`license.${type}.rules`),
84
84
  source: t('source'),
85
85
  learnAboutLicenses: t('license.learnMore'),
86
86
  title: t('title'),
87
- }}></FigureLicenseDialog>
87
+ }}
88
+ />
88
89
  </FigureCaption>
89
90
  ) : (
90
91
  <BottomBorder />
@@ -68,7 +68,7 @@ const NotionVisualElement = ({ visualElement, id, figureId }: Props) => {
68
68
  {visualElement.image?.src ? (
69
69
  <img src={visualElement.image?.src} alt={visualElement.image.alt} />
70
70
  ) : (
71
- <StyledIframe type={type} src={visualElement.url} title={visualElement.title} />
71
+ <StyledIframe allowFullScreen type={type} src={visualElement.url} title={visualElement.title} />
72
72
  )}
73
73
  </FigureNotion>
74
74
  );
@@ -16,7 +16,7 @@ import { useTranslation } from 'react-i18next';
16
16
 
17
17
  const Wrapper = styled.div`
18
18
  display: inline-flex;
19
- justify-content: center;
19
+ justify-content: right;
20
20
  align-items: center;
21
21
  flex: 1;
22
22
  ${mq.range({ until: breakpoints.tablet })} {
@@ -757,15 +757,15 @@ const messages = {
757
757
  },
758
758
  blogPosts: {
759
759
  blog1: {
760
- text: 'Nye fag NDLA',
761
- externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
760
+ text: 'Forslag til årsplaner fra NDLA',
761
+ externalLink: 'https://blogg.ndla.no/2021/08/forslag-til-arsplaner-hos-ndla/',
762
762
  linkText: 'Fagblogg',
763
763
  license: 'CC-BY-SA-4.0',
764
764
  licenseAuthor: 'Vibeke Klungland',
765
765
  },
766
766
  blog2: {
767
- text: 'Aktiviser elevane med digitale verktøy',
768
- externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
767
+ text: 'Huskeliste for kontaktlærere',
768
+ externalLink: 'https://blogg.ndla.no/2019/08/huskeliste-for-kontaktlaerere/',
769
769
  linkText: 'Fagblogg',
770
770
  license: 'CC-BY-SA-4.0',
771
771
  licenseAuthor: 'Tom Knudsen',
@@ -755,15 +755,15 @@ const messages = {
755
755
  },
756
756
  blogPosts: {
757
757
  blog1: {
758
- text: 'Nye fag NDLA',
759
- externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
758
+ text: 'Forslag til årsplaner fra NDLA',
759
+ externalLink: 'https://blogg.ndla.no/2021/08/forslag-til-arsplaner-hos-ndla/',
760
760
  linkText: 'Fagblogg',
761
761
  license: 'CC-BY-SA-4.0',
762
762
  licenseAuthor: 'Vibeke Klungland',
763
763
  },
764
764
  blog2: {
765
- text: 'Aktiviser elevene med digitale verktøy',
766
- externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
765
+ text: 'Huskeliste for kontaktlærere',
766
+ externalLink: 'https://blogg.ndla.no/2019/08/huskeliste-for-kontaktlaerere/',
767
767
  linkText: 'Fagblogg',
768
768
  license: 'CC-BY-SA-4.0',
769
769
  licenseAuthor: 'Tom Knudsen',
@@ -756,15 +756,15 @@ const messages = {
756
756
  },
757
757
  blogPosts: {
758
758
  blog1: {
759
- text: 'Nye fag NDLA',
760
- externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
759
+ text: 'Forslag til årsplaner fra NDLA',
760
+ externalLink: 'https://blogg.ndla.no/2021/08/forslag-til-arsplaner-hos-ndla/',
761
761
  linkText: 'Fagblogg',
762
762
  license: 'CC-BY-SA-4.0',
763
763
  licenseAuthor: 'Vibeke Klungland',
764
764
  },
765
765
  blog2: {
766
- text: 'Aktiviser elevane med digitale verktøy',
767
- externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
766
+ text: 'Huskeliste for kontaktlærere',
767
+ externalLink: 'https://blogg.ndla.no/2019/08/huskeliste-for-kontaktlaerere/',
768
768
  linkText: 'Fagblogg',
769
769
  license: 'CC-BY-SA-4.0',
770
770
  licenseAuthor: 'Tom Knudsen',
@@ -755,15 +755,15 @@ const messages = {
755
755
  },
756
756
  blogPosts: {
757
757
  blog1: {
758
- text: 'Nye fag NDLA',
759
- externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
758
+ text: 'Forslag til årsplaner fra NDLA',
759
+ externalLink: 'https://blogg.ndla.no/2021/08/forslag-til-arsplaner-hos-ndla/',
760
760
  linkText: 'Fagblogg',
761
761
  license: 'CC-BY-SA-4.0',
762
762
  licenseAuthor: 'Vibeke Klungland',
763
763
  },
764
764
  blog2: {
765
- text: 'Aktiviser elevene med digitale verktøy',
766
- externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
765
+ text: 'Huskeliste for kontaktlærere',
766
+ externalLink: 'https://blogg.ndla.no/2019/08/huskeliste-for-kontaktlaerere/',
767
767
  linkText: 'Fagblogg',
768
768
  license: 'CC-BY-SA-4.0',
769
769
  licenseAuthor: 'Tom Knudsen',
@@ -755,15 +755,15 @@ const messages = {
755
755
  },
756
756
  blogPosts: {
757
757
  blog1: {
758
- text: 'Nye fag NDLA',
759
- externalLink: 'https://blogg.ndla.no/2021/12/nye-fag-pa-ndla/',
758
+ text: 'Forslag til årsplaner fra NDLA',
759
+ externalLink: 'https://blogg.ndla.no/2021/08/forslag-til-arsplaner-hos-ndla/',
760
760
  linkText: 'Fagblogg',
761
761
  license: 'CC-BY-SA-4.0',
762
762
  licenseAuthor: 'Vibeke Klungland',
763
763
  },
764
764
  blog2: {
765
- text: 'Aktiviser elevene med digitale verktøy',
766
- externalLink: 'https://blogg.ndla.no/2021/09/aktiviser-elevane-med-digitale-verktoy/',
765
+ text: 'Huskeliste for kontaktlærere',
766
+ externalLink: 'https://blogg.ndla.no/2019/08/huskeliste-for-kontaktlaerere/',
767
767
  linkText: 'Fagblogg',
768
768
  license: 'CC-BY-SA-4.0',
769
769
  licenseAuthor: 'Tom Knudsen',
package/src/types.ts CHANGED
@@ -68,7 +68,7 @@ export interface FootNote {
68
68
  export interface Article {
69
69
  title: string;
70
70
  introduction: string;
71
- content: string;
71
+ content: string | (() => ReactNode) | ReactNode;
72
72
  footNotes: Array<FootNote>;
73
73
  copyright: Copyright;
74
74
  published: string;