@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.
- package/es/Article/Article.js +1 -1
- package/es/Article/ArticleHeaderWrapper.js +4 -4
- package/es/Frontpage/FrontpageAllSubjects.js +8 -8
- package/es/Notion/ConceptNotion.js +26 -1
- package/es/Notion/FigureNotion.js +28 -20
- package/es/Notion/NotionVisualElement.js +3 -2
- package/es/SearchTypeResult/SearchViewType.js +5 -5
- package/es/locale/messages-en.js +4 -4
- package/es/locale/messages-nb.js +4 -4
- package/es/locale/messages-nn.js +4 -4
- package/es/locale/messages-se.js +4 -4
- package/es/locale/messages-sma.js +4 -4
- package/lib/Article/Article.d.ts +2 -2
- package/lib/Article/Article.js +1 -1
- package/lib/Article/ArticleHeaderWrapper.d.ts +1 -1
- package/lib/Article/ArticleHeaderWrapper.js +4 -4
- package/lib/Frontpage/FrontpageAllSubjects.js +8 -8
- package/lib/Notion/ConceptNotion.js +26 -2
- package/lib/Notion/FigureNotion.d.ts +1 -1
- package/lib/Notion/FigureNotion.js +26 -19
- package/lib/Notion/NotionVisualElement.js +3 -2
- package/lib/SearchTypeResult/SearchViewType.js +5 -5
- package/lib/locale/messages-en.js +4 -4
- package/lib/locale/messages-nb.js +4 -4
- package/lib/locale/messages-nn.js +4 -4
- package/lib/locale/messages-se.js +4 -4
- package/lib/locale/messages-sma.js +4 -4
- package/lib/types.d.ts +1 -1
- package/package.json +3 -3
- package/src/Article/Article.tsx +2 -1
- package/src/Article/ArticleHeaderWrapper.tsx +1 -0
- package/src/Frontpage/FrontpageAllSubjects.tsx +1 -1
- package/src/Notion/ConceptNotion.tsx +18 -2
- package/src/Notion/FigureNotion.tsx +16 -15
- package/src/Notion/NotionVisualElement.tsx +1 -1
- package/src/SearchTypeResult/SearchViewType.tsx +1 -1
- package/src/locale/messages-en.ts +4 -4
- package/src/locale/messages-nb.ts +4 -4
- package/src/locale/messages-nn.ts +4 -4
- package/src/locale/messages-se.ts +4 -4
- package/src/locale/messages-sma.ts +4 -4
- 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
|
|
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
|
|
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
|
|
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
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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={
|
|
71
|
+
authors={authors}
|
|
72
72
|
licenseRights={license.rights}
|
|
73
73
|
hideIconsAndAuthors={hideIconsAndAuthors}>
|
|
74
74
|
<FigureLicenseDialog
|
|
75
75
|
id={id}
|
|
76
|
-
authors={
|
|
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(
|
|
83
|
+
rulesForUse: t(`license.${type}.rules`),
|
|
84
84
|
source: t('source'),
|
|
85
85
|
learnAboutLicenses: t('license.learnMore'),
|
|
86
86
|
title: t('title'),
|
|
87
|
-
}}
|
|
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
|
);
|
|
@@ -757,15 +757,15 @@ const messages = {
|
|
|
757
757
|
},
|
|
758
758
|
blogPosts: {
|
|
759
759
|
blog1: {
|
|
760
|
-
text: '
|
|
761
|
-
externalLink: 'https://blogg.ndla.no/2021/
|
|
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: '
|
|
768
|
-
externalLink: 'https://blogg.ndla.no/
|
|
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: '
|
|
759
|
-
externalLink: 'https://blogg.ndla.no/2021/
|
|
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: '
|
|
766
|
-
externalLink: 'https://blogg.ndla.no/
|
|
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: '
|
|
760
|
-
externalLink: 'https://blogg.ndla.no/2021/
|
|
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: '
|
|
767
|
-
externalLink: 'https://blogg.ndla.no/
|
|
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: '
|
|
759
|
-
externalLink: 'https://blogg.ndla.no/2021/
|
|
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: '
|
|
766
|
-
externalLink: 'https://blogg.ndla.no/
|
|
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: '
|
|
759
|
-
externalLink: 'https://blogg.ndla.no/2021/
|
|
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: '
|
|
766
|
-
externalLink: 'https://blogg.ndla.no/
|
|
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