@ndla/ui 13.1.1 → 13.2.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/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 +25 -1
- package/es/Notion/FigureNotion.js +24 -20
- 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 +25 -2
- package/lib/Notion/FigureNotion.js +23 -20
- 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 +17 -2
- package/src/Notion/FigureNotion.tsx +6 -12
- package/src/types.ts +1 -1
|
@@ -71,6 +71,7 @@ const CompetenceButtonWrapper = styled.div<CompetenceButtonWrapperProps>`
|
|
|
71
71
|
type Props = {
|
|
72
72
|
competenceGoals?:
|
|
73
73
|
| ((inp: { Dialog: ComponentType; dialogProps: { isOpen: boolean; onClose: () => void } }) => ReactNode)
|
|
74
|
+
| ReactNode
|
|
74
75
|
| null;
|
|
75
76
|
competenceGoalTypes?: string[];
|
|
76
77
|
children: ReactNode;
|
|
@@ -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();
|
|
@@ -94,7 +101,11 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, fig
|
|
|
94
101
|
) : undefined}
|
|
95
102
|
<NotionDialogText>{parseMarkdown(concept.text, 'body')}</NotionDialogText>
|
|
96
103
|
</NotionDialogContent>
|
|
97
|
-
<NotionDialogLicenses
|
|
104
|
+
<NotionDialogLicenses
|
|
105
|
+
authors={authors}
|
|
106
|
+
license={concept.copyright?.license?.license ?? ''}
|
|
107
|
+
source={concept.source}
|
|
108
|
+
/>
|
|
98
109
|
</>
|
|
99
110
|
}>
|
|
100
111
|
{concept.visualElement.image && (
|
|
@@ -129,7 +140,11 @@ const ConceptNotion = ({ concept, disableScripts, type, hideIconsAndAuthors, fig
|
|
|
129
140
|
|
|
130
141
|
<NotionDialogText>{parseMarkdown(concept.text, 'body')}</NotionDialogText>
|
|
131
142
|
</NotionDialogContent>
|
|
132
|
-
<NotionDialogLicenses
|
|
143
|
+
<NotionDialogLicenses
|
|
144
|
+
authors={authors}
|
|
145
|
+
license={concept.copyright?.license?.license ?? ''}
|
|
146
|
+
source={concept.source}
|
|
147
|
+
/>
|
|
133
148
|
</>
|
|
134
149
|
}>
|
|
135
150
|
{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 {
|
|
10
|
+
import { 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';
|
|
@@ -47,15 +47,9 @@ const FigureNotion = ({
|
|
|
47
47
|
}: Props) => {
|
|
48
48
|
const { t, i18n } = useTranslation();
|
|
49
49
|
const license = getLicenseByAbbreviation(licenseString, i18n.language);
|
|
50
|
-
const { creators,
|
|
51
|
-
|
|
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 { creators, rightsholders, processors } = getLicenseCredits(copyright);
|
|
51
|
+
|
|
52
|
+
const authors = creators.length || rightsholders.length ? [...creators, ...rightsholders] : [...processors];
|
|
59
53
|
|
|
60
54
|
return (
|
|
61
55
|
<Figure resizeIframe={resizeIframe} id={figureId} type={figureType || 'full-column'}>
|
|
@@ -68,12 +62,12 @@ const FigureNotion = ({
|
|
|
68
62
|
figureId={figureId}
|
|
69
63
|
id={id}
|
|
70
64
|
reuseLabel={t(`${type}.reuse`)}
|
|
71
|
-
authors={
|
|
65
|
+
authors={authors}
|
|
72
66
|
licenseRights={license.rights}
|
|
73
67
|
hideIconsAndAuthors={hideIconsAndAuthors}>
|
|
74
68
|
<FigureLicenseDialog
|
|
75
69
|
id={id}
|
|
76
|
-
authors={
|
|
70
|
+
authors={authors}
|
|
77
71
|
locale={i18n.language}
|
|
78
72
|
title={title}
|
|
79
73
|
origin={copyright?.origin}
|
package/src/types.ts
CHANGED