@ndla/ui 36.0.1 → 37.0.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 +7 -13
- package/es/Article/ArticleByline.js +79 -123
- package/es/Article/ArticleFootNotes.js +16 -11
- package/es/AudioPlayer/AudioPlayer.js +33 -35
- package/es/AudioPlayer/initAudioPlayers.js +6 -1
- package/es/BlogPost/BlogPost.js +4 -4
- package/es/CampaignBlock/CampaignBlock.js +77 -0
- package/es/CampaignBlock/index.js +9 -0
- package/es/ContactBlock/ContactBlock.js +63 -39
- package/es/Embed/AudioEmbed.js +44 -188
- package/es/Embed/BrightcoveEmbed.js +27 -123
- package/es/Embed/ConceptEmbed.js +53 -75
- package/es/Embed/EmbedErrorPlaceholder.js +41 -0
- package/es/Embed/ExternalEmbed.js +5 -12
- package/es/Embed/H5pEmbed.js +4 -14
- package/es/Embed/IframeEmbed.js +4 -4
- package/es/Embed/ImageEmbed.js +41 -153
- package/es/Embed/conceptComponents.js +62 -228
- package/es/Embed/types.js +1 -0
- package/es/KeyFigure/KeyFigure.js +57 -0
- package/es/{KeyPerformanceIndicator → KeyFigure}/index.js +1 -1
- package/es/LicenseByline/EmbedByline.js +115 -0
- package/es/LicenseByline/LicenseDescription.js +39 -0
- package/es/LicenseByline/LicenseLink.js +36 -0
- package/es/LicenseByline/index.js +1 -0
- package/es/List/OrderedList.js +48 -0
- package/es/List/UnOrderedList.js +36 -0
- package/es/List/index.js +10 -0
- package/es/Navigation/NavigationBox.js +41 -48
- package/es/Navigation/NavigationHeading.js +18 -29
- package/es/Notion/Notion.js +5 -5
- package/es/Resource/resourceComponents.js +12 -11
- package/es/Typography/Heading.js +38 -0
- package/es/Typography/index.js +9 -0
- package/es/all.css +1 -1
- package/es/index.js +4 -2
- package/es/locale/messages-en.js +13 -2
- package/es/locale/messages-nb.js +13 -2
- package/es/locale/messages-nn.js +13 -2
- package/es/locale/messages-se.js +13 -2
- package/es/locale/messages-sma.js +13 -2
- package/es/model/ContentType.js +7 -1
- package/lib/Article/Article.d.ts +1 -3
- package/lib/Article/Article.js +7 -13
- package/lib/Article/ArticleByline.d.ts +3 -5
- package/lib/Article/ArticleByline.js +83 -126
- package/lib/Article/ArticleFootNotes.js +16 -11
- package/lib/AudioPlayer/AudioPlayer.d.ts +1 -2
- package/lib/AudioPlayer/AudioPlayer.js +33 -36
- package/lib/AudioPlayer/initAudioPlayers.d.ts +1 -0
- package/lib/AudioPlayer/initAudioPlayers.js +9 -3
- package/lib/BlogPost/BlogPost.js +4 -4
- package/lib/CampaignBlock/CampaignBlock.d.ts +31 -0
- package/lib/CampaignBlock/CampaignBlock.js +82 -0
- package/lib/CampaignBlock/index.d.ts +8 -0
- package/lib/CampaignBlock/index.js +13 -0
- package/lib/ContactBlock/ContactBlock.js +63 -39
- package/lib/Embed/AudioEmbed.d.ts +3 -2
- package/lib/Embed/AudioEmbed.js +53 -192
- package/lib/Embed/BrightcoveEmbed.d.ts +3 -1
- package/lib/Embed/BrightcoveEmbed.js +27 -122
- package/lib/Embed/ConceptEmbed.d.ts +7 -2
- package/lib/Embed/ConceptEmbed.js +51 -73
- package/lib/Embed/EmbedErrorPlaceholder.d.ts +17 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +48 -0
- package/lib/Embed/ExternalEmbed.js +5 -11
- package/lib/Embed/H5pEmbed.js +4 -13
- package/lib/Embed/IframeEmbed.d.ts +2 -2
- package/lib/Embed/IframeEmbed.js +4 -4
- package/lib/Embed/ImageEmbed.d.ts +3 -10
- package/lib/Embed/ImageEmbed.js +48 -161
- package/lib/Embed/conceptComponents.d.ts +4 -2
- package/lib/Embed/conceptComponents.js +67 -231
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/types.d.ts +14 -0
- package/lib/Embed/types.js +5 -0
- package/lib/KeyFigure/KeyFigure.d.ts +10 -0
- package/lib/KeyFigure/KeyFigure.js +62 -0
- package/lib/KeyFigure/index.d.ts +1 -0
- package/lib/KeyFigure/index.js +13 -0
- package/lib/LicenseByline/EmbedByline.d.ts +51 -0
- package/lib/LicenseByline/EmbedByline.js +120 -0
- package/lib/LicenseByline/LicenseDescription.d.ts +14 -0
- package/lib/LicenseByline/LicenseDescription.js +44 -0
- package/lib/LicenseByline/LicenseLink.d.ts +14 -0
- package/lib/LicenseByline/LicenseLink.js +44 -0
- package/lib/LicenseByline/index.d.ts +1 -0
- package/lib/LicenseByline/index.js +13 -0
- package/lib/List/OrderedList.d.ts +15 -0
- package/lib/List/OrderedList.js +56 -0
- package/lib/List/UnOrderedList.d.ts +10 -0
- package/lib/List/UnOrderedList.js +43 -0
- package/lib/List/index.d.ts +9 -0
- package/lib/List/index.js +20 -0
- package/lib/Navigation/NavigationBox.js +40 -47
- package/lib/Navigation/NavigationHeading.js +17 -28
- package/lib/Notion/Notion.js +5 -5
- package/lib/Resource/resourceComponents.js +12 -11
- package/lib/Typography/Heading.d.ts +26 -0
- package/lib/Typography/Heading.js +45 -0
- package/lib/Typography/index.d.ts +8 -0
- package/lib/Typography/index.js +13 -0
- package/lib/all.css +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +23 -3
- package/lib/locale/messages-en.d.ts +11 -0
- package/lib/locale/messages-en.js +13 -2
- package/lib/locale/messages-nb.d.ts +11 -0
- package/lib/locale/messages-nb.js +13 -2
- package/lib/locale/messages-nn.d.ts +11 -0
- package/lib/locale/messages-nn.js +13 -2
- package/lib/locale/messages-se.d.ts +11 -0
- package/lib/locale/messages-se.js +13 -2
- package/lib/locale/messages-sma.d.ts +11 -0
- package/lib/locale/messages-sma.js +13 -2
- package/lib/model/ContentType.d.ts +1 -0
- package/lib/model/ContentType.js +9 -2
- package/package.json +15 -15
- package/src/Article/Article.tsx +1 -8
- package/src/Article/ArticleByline.tsx +78 -127
- package/src/Article/ArticleFootNotes.tsx +33 -10
- package/src/Article/component.article.scss +1 -52
- package/src/Article/component.footnotes.scss +2 -2
- package/src/Aside/component.aside.scss +3 -3
- package/src/AudioPlayer/AudioPlayer.tsx +11 -24
- package/src/AudioPlayer/initAudioPlayers.tsx +7 -2
- package/src/BlogPost/BlogPost.tsx +0 -4
- package/src/CampaignBlock/CampaignBlock.stories.tsx +63 -0
- package/src/CampaignBlock/CampaignBlock.tsx +99 -0
- package/src/CampaignBlock/index.ts +9 -0
- package/src/ContactBlock/ContactBlock.tsx +27 -19
- package/src/ContactBlock/Contactblock.stories.tsx +0 -1
- package/src/Dialog/component.dialog.scss +4 -5
- package/src/Embed/AudioEmbed.stories.tsx +5 -3
- package/src/Embed/AudioEmbed.tsx +45 -192
- package/src/Embed/BrightcoveEmbed.stories.tsx +5 -1
- package/src/Embed/BrightcoveEmbed.tsx +20 -95
- package/src/Embed/ConceptEmbed.stories.tsx +5 -0
- package/src/Embed/ConceptEmbed.tsx +43 -54
- package/src/Embed/EmbedErrorPlaceholder.tsx +59 -0
- package/src/Embed/ExternalEmbed.stories.tsx +86 -0
- package/src/Embed/ExternalEmbed.tsx +3 -8
- package/src/Embed/H5pEmbed.stories.tsx +92 -0
- package/src/Embed/H5pEmbed.tsx +2 -10
- package/src/Embed/IframeEmbed.stories.tsx +130 -0
- package/src/Embed/IframeEmbed.tsx +3 -3
- package/src/Embed/ImageEmbed.stories.tsx +3 -1
- package/src/Embed/ImageEmbed.tsx +21 -116
- package/src/Embed/conceptComponents.tsx +67 -257
- package/src/Embed/index.ts +1 -0
- package/src/Embed/types.ts +12 -0
- package/src/FactBox/component.factbox.scss +3 -3
- package/src/Figure/component.figure-license.scss +4 -4
- package/src/Figure/component.figure.scss +1 -1
- package/src/KeyFigure/KeyFigure.stories.tsx +36 -0
- package/src/{KeyPerformanceIndicator/KeyPerformanceIndicator.tsx → KeyFigure/KeyFigure.tsx} +9 -7
- package/src/{KeyPerformanceIndicator → KeyFigure}/index.ts +1 -1
- package/src/LicenseByline/EmbedByline.stories.tsx +83 -0
- package/src/LicenseByline/EmbedByline.tsx +165 -0
- package/src/LicenseByline/LicenseDescription.tsx +43 -0
- package/src/LicenseByline/LicenseLink.tsx +42 -0
- package/src/LicenseByline/index.tsx +1 -0
- package/src/List/OrderedList.tsx +115 -0
- package/src/List/UnOrderedList.tsx +49 -0
- package/src/List/index.ts +10 -0
- package/src/MediaList/component.medialist.scss +2 -2
- package/src/Navigation/NavigationBox.tsx +10 -14
- package/src/Navigation/NavigationHeading.tsx +15 -24
- package/src/Notion/Notion.tsx +1 -1
- package/src/RelatedArticleList/component.related-articles.scss +3 -13
- package/src/Resource/resourceComponents.tsx +4 -2
- package/src/Table/component.tables.scss +0 -46
- package/src/Translation/component.translation.scss +3 -5
- package/src/Typography/Heading.tsx +96 -0
- package/src/Typography/index.ts +9 -0
- package/src/index.ts +5 -1
- package/src/locale/messages-en.ts +11 -0
- package/src/locale/messages-nb.ts +11 -0
- package/src/locale/messages-nn.ts +11 -0
- package/src/locale/messages-se.ts +11 -0
- package/src/locale/messages-sma.ts +11 -0
- package/src/model/ContentType.ts +7 -0
- package/es/KeyPerformanceIndicator/KeyPerformanceIndicator.js +0 -57
- package/lib/KeyPerformanceIndicator/KeyPerformanceIndicator.d.ts +0 -8
- package/lib/KeyPerformanceIndicator/KeyPerformanceIndicator.js +0 -62
- package/lib/KeyPerformanceIndicator/index.d.ts +0 -1
- package/lib/KeyPerformanceIndicator/index.js +0 -13
- package/src/KeyPerformanceIndicator/KeyPerformanceIndicator.stories.tsx +0 -79
|
@@ -6,28 +6,24 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { forwardRef, ReactNode, RefAttributes
|
|
9
|
+
import { forwardRef, ReactNode, RefAttributes } from 'react';
|
|
10
10
|
import { ConceptVisualElementMeta } from '@ndla/types-embed';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
|
-
import { Root, Item, Header, Trigger, Content } from '@radix-ui/react-accordion';
|
|
13
|
-
import { getGroupedContributorDescriptionList, getLicenseByAbbreviation, getLicenseCredits } from '@ndla/licenses';
|
|
14
12
|
import { css } from '@emotion/react';
|
|
15
|
-
import { ButtonV2 } from '@ndla/button';
|
|
16
13
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
17
|
-
import { ChevronDown } from '@ndla/icons/common';
|
|
18
14
|
import { parseMarkdown } from '@ndla/util';
|
|
19
15
|
import styled from '@emotion/styled';
|
|
20
|
-
import { NotionDialogContent,
|
|
21
|
-
import { Figure, FigureCaption } from '../Figure';
|
|
22
|
-
import { NotionVisualElementType } from '../Notion';
|
|
23
|
-
import { classLicenses, FigureLicenseByline, FigureLicenseCta } from '../Figure/FigureLicense';
|
|
16
|
+
import { NotionDialogContent, NotionDialogText } from '@ndla/notion';
|
|
24
17
|
import { Copyright } from '../types';
|
|
25
|
-
import
|
|
18
|
+
import ImageEmbed from './ImageEmbed';
|
|
19
|
+
import BrightcoveEmbed from './BrightcoveEmbed';
|
|
20
|
+
import H5pEmbed from './H5pEmbed';
|
|
21
|
+
import { ExternalEmbed, HeartButtonType, IframeEmbed } from '.';
|
|
22
|
+
import { EmbedByline } from '../LicenseByline';
|
|
26
23
|
|
|
27
24
|
export interface ConceptNotionData {
|
|
28
25
|
title: string;
|
|
29
26
|
content?: string;
|
|
30
|
-
articlePath?: string;
|
|
31
27
|
metaImage?: {
|
|
32
28
|
url?: string;
|
|
33
29
|
alt?: string;
|
|
@@ -44,42 +40,13 @@ interface ConceptNotionProps extends RefAttributes<HTMLDivElement>, ConceptNotio
|
|
|
44
40
|
inPopover?: boolean;
|
|
45
41
|
tags?: string[];
|
|
46
42
|
subjects?: string[];
|
|
43
|
+
heartButton?: HeartButtonType;
|
|
44
|
+
conceptHeartButton?: ReactNode;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (visualElement.resource === 'image') {
|
|
55
|
-
return {
|
|
56
|
-
resource: visualElement.resource,
|
|
57
|
-
title: visualElement.data.title.title,
|
|
58
|
-
copyright: visualElement.data.copyright,
|
|
59
|
-
image: { src: visualElement.data.imageUrl, alt: visualElement.data.alttext.alttext },
|
|
60
|
-
url: visualElement.data.imageUrl,
|
|
61
|
-
};
|
|
62
|
-
} else if (visualElement.resource === 'brightcove') {
|
|
63
|
-
return {
|
|
64
|
-
resource: visualElement.resource,
|
|
65
|
-
title: visualElement.data.name,
|
|
66
|
-
url: `https://players.brightcove.net/${visualElement.embedData.account}/${visualElement.embedData.player}_default/index.html?videoId=${visualElement.embedData.videoid}`,
|
|
67
|
-
copyright: visualElement.data.copyright,
|
|
68
|
-
};
|
|
69
|
-
} else if (visualElement.resource === 'external' || visualElement.resource === 'iframe') {
|
|
70
|
-
return {
|
|
71
|
-
resource: visualElement.resource,
|
|
72
|
-
url: visualElement.embedData.url,
|
|
73
|
-
title: visualElement.embedData.url,
|
|
74
|
-
};
|
|
75
|
-
} else {
|
|
76
|
-
return {
|
|
77
|
-
resource: visualElement.resource,
|
|
78
|
-
url: visualElement.data.h5pUrl,
|
|
79
|
-
title: visualElement.embedData.title,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
};
|
|
47
|
+
const ContentPadding = styled.div`
|
|
48
|
+
padding: ${spacing.normal};
|
|
49
|
+
`;
|
|
83
50
|
|
|
84
51
|
const notionContentCss = css`
|
|
85
52
|
@keyframes animateIn {
|
|
@@ -95,7 +62,6 @@ const notionContentCss = css`
|
|
|
95
62
|
|
|
96
63
|
animation-name: animateIn;
|
|
97
64
|
animation-duration: 300ms;
|
|
98
|
-
padding: ${spacing.normal};
|
|
99
65
|
background-color: white;
|
|
100
66
|
z-index: 1;
|
|
101
67
|
box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
|
|
@@ -115,11 +81,6 @@ const notionContentCss = css`
|
|
|
115
81
|
}
|
|
116
82
|
`;
|
|
117
83
|
|
|
118
|
-
const StyledIframe = styled.iframe<{ type?: string }>`
|
|
119
|
-
height: auto;
|
|
120
|
-
min-height: ${(p) => p.type === 'video' && '400px'};
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
84
|
const NotionHeader = styled.div`
|
|
124
85
|
display: flex;
|
|
125
86
|
align-items: center;
|
|
@@ -141,72 +102,6 @@ const NotionHeader = styled.div`
|
|
|
141
102
|
}
|
|
142
103
|
`;
|
|
143
104
|
|
|
144
|
-
const StyledAccordionContent = styled(Content)`
|
|
145
|
-
background-color: ${colors.brand.lighter};
|
|
146
|
-
padding: ${spacing.small};
|
|
147
|
-
border-radius: ${misc.borderRadius};
|
|
148
|
-
overflow: hidden;
|
|
149
|
-
&[data-state='open'] {
|
|
150
|
-
animation: slideDown 300ms ease-out;
|
|
151
|
-
}
|
|
152
|
-
&[data-state='closed'] {
|
|
153
|
-
animation: slideUp 300ms ease-out;
|
|
154
|
-
}
|
|
155
|
-
@keyframes slideDown {
|
|
156
|
-
from {
|
|
157
|
-
height: 0;
|
|
158
|
-
}
|
|
159
|
-
to {
|
|
160
|
-
height: var(--radix-accordion-content-height);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
@keyframes slideUp {
|
|
164
|
-
from {
|
|
165
|
-
height: var(--radix-accordion-content-height);
|
|
166
|
-
}
|
|
167
|
-
to {
|
|
168
|
-
height: 0;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
`;
|
|
172
|
-
|
|
173
|
-
const StyledRoot = styled(Root)`
|
|
174
|
-
border-bottom: 1px solid ${colors.brand.greyLight};
|
|
175
|
-
`;
|
|
176
|
-
|
|
177
|
-
const StyledFigure = styled(Figure)`
|
|
178
|
-
&& {
|
|
179
|
-
margin: ${spacing.normal} 0;
|
|
180
|
-
}
|
|
181
|
-
padding-bottom: 0;
|
|
182
|
-
`;
|
|
183
|
-
|
|
184
|
-
const StyledFigureCaption = styled(FigureCaption)`
|
|
185
|
-
border-bottom: 0;
|
|
186
|
-
|
|
187
|
-
h3 {
|
|
188
|
-
margin: 0;
|
|
189
|
-
}
|
|
190
|
-
`;
|
|
191
|
-
|
|
192
|
-
const StyledSpan = styled.span`
|
|
193
|
-
font-style: italic;
|
|
194
|
-
color: grey;
|
|
195
|
-
`;
|
|
196
|
-
|
|
197
|
-
const StyledAccordionTrigger = styled(ButtonV2)`
|
|
198
|
-
color: ${colors.brand.primary};
|
|
199
|
-
border-color: ${colors.brand.primary};
|
|
200
|
-
&[data-state='open'] {
|
|
201
|
-
svg {
|
|
202
|
-
transform: rotate(180deg);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
svg {
|
|
206
|
-
transition: transform 300ms;
|
|
207
|
-
}
|
|
208
|
-
`;
|
|
209
|
-
|
|
210
105
|
const ListWrapper = styled.div`
|
|
211
106
|
display: flex;
|
|
212
107
|
gap: ${spacing.small};
|
|
@@ -215,6 +110,13 @@ const ListWrapper = styled.div`
|
|
|
215
110
|
|
|
216
111
|
const StyledNotionDialogContent = styled(NotionDialogContent)`
|
|
217
112
|
padding-top: ${spacing.small};
|
|
113
|
+
.c-figure {
|
|
114
|
+
left: unset !important;
|
|
115
|
+
width: 100% !important;
|
|
116
|
+
padding: 0;
|
|
117
|
+
margin: 0;
|
|
118
|
+
padding-bottom: ${spacing.normal};
|
|
119
|
+
}
|
|
218
120
|
`;
|
|
219
121
|
|
|
220
122
|
const StyledList = styled.ul`
|
|
@@ -237,7 +139,6 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
237
139
|
(
|
|
238
140
|
{
|
|
239
141
|
visualElement,
|
|
240
|
-
articlePath,
|
|
241
142
|
title,
|
|
242
143
|
content,
|
|
243
144
|
source,
|
|
@@ -247,154 +148,63 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
247
148
|
previewAlt,
|
|
248
149
|
tags,
|
|
249
150
|
subjects,
|
|
151
|
+
heartButton,
|
|
152
|
+
conceptHeartButton,
|
|
250
153
|
...rest
|
|
251
154
|
},
|
|
252
155
|
ref,
|
|
253
156
|
) => {
|
|
254
|
-
const { t
|
|
255
|
-
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
256
|
-
|
|
257
|
-
useEffect(() => {
|
|
258
|
-
const iframe = iframeRef.current;
|
|
259
|
-
if (iframe) {
|
|
260
|
-
const [width, height] = [parseInt(iframe.width), parseInt(iframe.height)];
|
|
261
|
-
iframe.style.aspectRatio = `${width ? width : 16}/${height ? height : 9}`;
|
|
262
|
-
iframe.width = '';
|
|
263
|
-
iframe.height = '';
|
|
264
|
-
}
|
|
265
|
-
}, []);
|
|
266
|
-
|
|
267
|
-
const licenseCredits = getLicenseCredits(copyright);
|
|
268
|
-
const { creators, rightsholders, processors } = licenseCredits;
|
|
269
|
-
const authors = creators.length || rightsholders.length ? creators.concat(rightsholders) : processors;
|
|
157
|
+
const { t } = useTranslation();
|
|
270
158
|
|
|
271
|
-
const visualElementType =
|
|
272
|
-
visualElement?.embedData.resource === 'brightcove' ? 'video' : visualElement?.embedData.resource;
|
|
273
|
-
|
|
274
|
-
const notionVisualElement = visualElement ? getConceptVisualElement(visualElement) : undefined;
|
|
275
|
-
const visualElementLicense = getLicenseByAbbreviation(
|
|
276
|
-
notionVisualElement?.copyright?.license?.license ?? '',
|
|
277
|
-
i18n.language,
|
|
278
|
-
);
|
|
279
|
-
const visualElementLicenseCredits = getLicenseCredits(notionVisualElement?.copyright);
|
|
280
|
-
const visualElementAuthors =
|
|
281
|
-
visualElementLicenseCredits.creators.length || visualElementLicenseCredits.rightsholders.length
|
|
282
|
-
? visualElementLicenseCredits.creators.concat(visualElementLicenseCredits.rightsholders)
|
|
283
|
-
: visualElementLicenseCredits.processors;
|
|
284
|
-
const visualElementGroupedAuthors = getGroupedContributorDescriptionList(
|
|
285
|
-
visualElementLicenseCredits,
|
|
286
|
-
i18n.language,
|
|
287
|
-
).map((item) => ({
|
|
288
|
-
name: item.description,
|
|
289
|
-
type: item.label,
|
|
290
|
-
}));
|
|
291
159
|
return (
|
|
292
160
|
<div css={inPopover ? notionContentCss : undefined} {...rest} ref={ref}>
|
|
293
|
-
<
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
{
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
{
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
reuseLabel={t('reuse')}
|
|
324
|
-
authors={visualElementAuthors}
|
|
325
|
-
licenseRights={visualElementLicense.rights}
|
|
326
|
-
>
|
|
327
|
-
{visualElementLicense.abbreviation && (
|
|
328
|
-
<Header>
|
|
329
|
-
<Trigger asChild>
|
|
330
|
-
<StyledAccordionTrigger variant="outline" shape="pill" size="small" colorTheme="lighter">
|
|
331
|
-
{t('license.info')}
|
|
332
|
-
<ChevronDown />
|
|
333
|
-
</StyledAccordionTrigger>
|
|
334
|
-
</Trigger>
|
|
335
|
-
</Header>
|
|
336
|
-
)}
|
|
337
|
-
</StyledFigureCaption>
|
|
338
|
-
<StyledAccordionContent>
|
|
339
|
-
<div {...classLicenses()}>
|
|
340
|
-
<h1 {...classLicenses('title')}>{t(`license.${visualElementType}.rules`)}</h1>
|
|
341
|
-
<FigureLicenseByline
|
|
342
|
-
license={visualElementLicense}
|
|
343
|
-
messages={{
|
|
344
|
-
learnAboutLicenses: t('license.learnMore'),
|
|
345
|
-
}}
|
|
346
|
-
locale={i18n.language}
|
|
347
|
-
/>
|
|
348
|
-
<FigureLicenseCta
|
|
349
|
-
authors={visualElementGroupedAuthors}
|
|
350
|
-
title={notionVisualElement?.title}
|
|
351
|
-
origin={notionVisualElement?.copyright?.origin}
|
|
352
|
-
messages={{ source: t('source'), title: t('title') }}
|
|
353
|
-
>
|
|
354
|
-
{visualElementType === 'image' ? (
|
|
355
|
-
<ImageLicenseButtons
|
|
356
|
-
imageUrl={notionVisualElement.image?.src ?? ''}
|
|
357
|
-
title={notionVisualElement.title}
|
|
358
|
-
copyright={notionVisualElement.copyright}
|
|
359
|
-
articlePath={articlePath}
|
|
360
|
-
/>
|
|
361
|
-
) : null}
|
|
362
|
-
</FigureLicenseCta>
|
|
363
|
-
</div>
|
|
364
|
-
</StyledAccordionContent>
|
|
365
|
-
</Item>
|
|
366
|
-
</StyledRoot>
|
|
367
|
-
)}
|
|
368
|
-
</StyledFigure>
|
|
161
|
+
<ContentPadding>
|
|
162
|
+
<NotionHeader>
|
|
163
|
+
<h1>
|
|
164
|
+
{title} {<small>{t('searchPage.resultType.notionsHeading')}</small>}
|
|
165
|
+
</h1>
|
|
166
|
+
{closeButton}
|
|
167
|
+
</NotionHeader>
|
|
168
|
+
<StyledNotionDialogContent>
|
|
169
|
+
{visualElement?.resource === 'image' ? (
|
|
170
|
+
<ImageEmbed embed={visualElement} heartButton={heartButton} />
|
|
171
|
+
) : visualElement?.resource === 'brightcove' ? (
|
|
172
|
+
<BrightcoveEmbed embed={visualElement} heartButton={heartButton} />
|
|
173
|
+
) : visualElement?.resource === 'h5p' ? (
|
|
174
|
+
<H5pEmbed embed={visualElement} />
|
|
175
|
+
) : visualElement?.resource === 'iframe' ? (
|
|
176
|
+
<IframeEmbed embed={visualElement} />
|
|
177
|
+
) : visualElement?.resource === 'external' ? (
|
|
178
|
+
<ExternalEmbed embed={visualElement} />
|
|
179
|
+
) : null}
|
|
180
|
+
<NotionDialogText>{parseMarkdown(content ?? '', 'body')}</NotionDialogText>
|
|
181
|
+
</StyledNotionDialogContent>
|
|
182
|
+
{tags && (
|
|
183
|
+
<ListWrapper>
|
|
184
|
+
{`${t('notions.tags')}:`}
|
|
185
|
+
<StyledList>
|
|
186
|
+
{tags.map((tag, index) => (
|
|
187
|
+
<li key={index}>{tag}</li>
|
|
188
|
+
))}
|
|
189
|
+
</StyledList>
|
|
190
|
+
</ListWrapper>
|
|
369
191
|
)}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
<StyledList>
|
|
386
|
-
{subjects.map((subject, index) => (
|
|
387
|
-
<li key={index}>{subject}</li>
|
|
388
|
-
))}
|
|
389
|
-
</StyledList>
|
|
390
|
-
</ListWrapper>
|
|
192
|
+
{subjects && (
|
|
193
|
+
<ListWrapper>
|
|
194
|
+
{`${t('notions.usedIn')}:`}
|
|
195
|
+
<StyledList>
|
|
196
|
+
{subjects.map((subject, index) => (
|
|
197
|
+
<li key={index}>{subject}</li>
|
|
198
|
+
))}
|
|
199
|
+
</StyledList>
|
|
200
|
+
</ListWrapper>
|
|
201
|
+
)}
|
|
202
|
+
</ContentPadding>
|
|
203
|
+
{copyright && (
|
|
204
|
+
<EmbedByline copyright={copyright} type="concept">
|
|
205
|
+
{conceptHeartButton}
|
|
206
|
+
</EmbedByline>
|
|
391
207
|
)}
|
|
392
|
-
|
|
393
|
-
<NotionDialogLicenses
|
|
394
|
-
authors={authors.map((a) => a.name)}
|
|
395
|
-
license={copyright?.license?.license ?? ''}
|
|
396
|
-
source={parseMarkdown(source ?? '', 'body')}
|
|
397
|
-
/>
|
|
398
208
|
</div>
|
|
399
209
|
);
|
|
400
210
|
},
|
package/src/Embed/index.ts
CHANGED
|
@@ -19,3 +19,4 @@ export { default as ConceptEmbed } from './ConceptEmbed';
|
|
|
19
19
|
export { ConceptNotionV2 } from './conceptComponents';
|
|
20
20
|
export { default as ConceptListEmbed } from './ConceptListEmbed';
|
|
21
21
|
export { default as UnknownEmbed } from './UnknownEmbed';
|
|
22
|
+
export type { HeartButtonType } from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-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 { ElementType } from 'react';
|
|
10
|
+
import { EmbedMetaData } from '@ndla/types-embed';
|
|
11
|
+
|
|
12
|
+
export type HeartButtonType = ElementType<{ embed: Extract<EmbedMetaData, { status: 'success' }> }>;
|
|
@@ -7,7 +7,7 @@ $padding-bottom: 17px;
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
padding-bottom: $padding-bottom;
|
|
9
9
|
|
|
10
|
-
@include
|
|
10
|
+
@include font-size(16px, 1.5);
|
|
11
11
|
|
|
12
12
|
&__content {
|
|
13
13
|
position: relative;
|
|
@@ -148,7 +148,7 @@ $padding-bottom: 17px;
|
|
|
148
148
|
border-bottom: 2px solid $brand-color;
|
|
149
149
|
margin-top: 0;
|
|
150
150
|
margin-bottom: $spacing;
|
|
151
|
-
@include
|
|
151
|
+
@include font-size(22px, 34px);
|
|
152
152
|
font-weight: $font-weight-bold;
|
|
153
153
|
position: relative;
|
|
154
154
|
z-index: 2;
|
|
@@ -159,7 +159,7 @@ $padding-bottom: 17px;
|
|
|
159
159
|
h4,
|
|
160
160
|
h5 {
|
|
161
161
|
display: block;
|
|
162
|
-
@include
|
|
162
|
+
@include font-size(16px, 1.5);
|
|
163
163
|
letter-spacing: 0.1em;
|
|
164
164
|
margin-top: $spacing;
|
|
165
165
|
margin-bottom: $spacing--small;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
**/
|
|
8
8
|
|
|
9
9
|
.c-figure-license {
|
|
10
|
-
@include font-size(16px);
|
|
10
|
+
@include font-size(16px, 1.5);
|
|
11
11
|
font-family: $font-serif;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
background: transparent;
|
|
58
58
|
border: none;
|
|
59
59
|
color: $brand-color;
|
|
60
|
-
@include font-size(
|
|
60
|
+
@include font-size(18px, 1.33);
|
|
61
61
|
font-weight: $font-weight-normal;
|
|
62
62
|
z-index: 9;
|
|
63
63
|
cursor: pointer;
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
.c-figure-license__title {
|
|
73
73
|
margin: 0 0 $spacing--small;
|
|
74
|
-
@include
|
|
74
|
+
@include font-size(18px, 1.33);
|
|
75
75
|
color: $brand-color;
|
|
76
76
|
}
|
|
77
77
|
.c-figure-license--fullscreen {
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
.c-figure-license__image-title {
|
|
87
|
-
@include
|
|
87
|
+
@include font-size(28px, 30px);
|
|
88
88
|
margin: $spacing 0 0;
|
|
89
89
|
text-align: left;
|
|
90
90
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-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
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
11
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
12
|
+
import KeyFigure from './KeyFigure';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Enkle komponenter/Nøkkeltall',
|
|
16
|
+
component: KeyFigure,
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
parameters: {
|
|
19
|
+
...defaultParameters,
|
|
20
|
+
layout: 'centered',
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
title: '500',
|
|
24
|
+
subtitle: 'TVERRFAGLIGE RESSURSER',
|
|
25
|
+
image: {
|
|
26
|
+
alt: 'Nøkkeltall tverrfaglig',
|
|
27
|
+
src: 'https://api.test.ndla.no/image-api/raw/wMowCjRg.svg',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
} as Meta<typeof KeyFigure>;
|
|
31
|
+
|
|
32
|
+
export const KeyFigureStory: StoryFn<typeof KeyFigure> = ({ ...args }) => {
|
|
33
|
+
return <KeyFigure {...args} />;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
KeyFigureStory.storyName = 'Nøkkeltall';
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import { breakpoints, colors, fonts, mq, spacing } from '@ndla/core';
|
|
11
|
-
import { IImageMetaInformationV3 } from '@ndla/types-backend/build/image-api';
|
|
12
11
|
|
|
13
12
|
const ContentWrapper = styled.div`
|
|
14
13
|
display: flex;
|
|
@@ -48,19 +47,22 @@ const SubTitleWrapper = styled.div`
|
|
|
48
47
|
`;
|
|
49
48
|
|
|
50
49
|
interface Props {
|
|
51
|
-
image?:
|
|
50
|
+
image?: {
|
|
51
|
+
src?: string;
|
|
52
|
+
alt?: string;
|
|
53
|
+
};
|
|
52
54
|
title: string;
|
|
53
|
-
|
|
55
|
+
subtitle: string;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
const
|
|
58
|
+
const KeyFigure = ({ image, title, subtitle }: Props) => {
|
|
57
59
|
return (
|
|
58
60
|
<ContentWrapper>
|
|
59
|
-
<StyledImage src={image?.
|
|
61
|
+
<StyledImage src={image?.src} alt={image?.alt} />
|
|
60
62
|
<TitleWrapper>{title}</TitleWrapper>
|
|
61
|
-
<SubTitleWrapper>{
|
|
63
|
+
<SubTitleWrapper>{subtitle}</SubTitleWrapper>
|
|
62
64
|
</ContentWrapper>
|
|
63
65
|
);
|
|
64
66
|
};
|
|
65
67
|
|
|
66
|
-
export default
|
|
68
|
+
export default KeyFigure;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2023-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
|
+
import { Meta, StoryFn } from '@storybook/react';
|
|
11
|
+
import styled from '@emotion/styled';
|
|
12
|
+
import { breakpoints, mq, spacing } from '@ndla/core';
|
|
13
|
+
import { IconButtonV2 } from '@ndla/button';
|
|
14
|
+
import { Switch } from '@ndla/switch';
|
|
15
|
+
import { HeartOutline } from '@ndla/icons/action';
|
|
16
|
+
import EmbedByline from './EmbedByline';
|
|
17
|
+
import { defaultParameters } from '../../../../stories/defaults';
|
|
18
|
+
|
|
19
|
+
const ButtonWrapper = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
gap: ${spacing.small};
|
|
22
|
+
${mq.range({ until: breakpoints.tablet })} {
|
|
23
|
+
flex: 1;
|
|
24
|
+
width: 100%;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
align-items: space-between;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
title: 'Enkle komponenter/EmbedByline',
|
|
32
|
+
component: EmbedByline,
|
|
33
|
+
tags: ['autodocs'],
|
|
34
|
+
parameters: {
|
|
35
|
+
...defaultParameters,
|
|
36
|
+
},
|
|
37
|
+
args: {
|
|
38
|
+
topRounded: true,
|
|
39
|
+
bottomRounded: true,
|
|
40
|
+
visibleAlt: 'Synlig alt-tekst kan legges her, eller fjernes helt',
|
|
41
|
+
type: 'image',
|
|
42
|
+
children: (
|
|
43
|
+
<ButtonWrapper>
|
|
44
|
+
<Switch checked={false} label="Bytt til synstolket video" onChange={() => {}} id="switch" />
|
|
45
|
+
<IconButtonV2 variant="ghost" aria-label="Legg til i favoritter">
|
|
46
|
+
<HeartOutline />
|
|
47
|
+
</IconButtonV2>
|
|
48
|
+
</ButtonWrapper>
|
|
49
|
+
),
|
|
50
|
+
description:
|
|
51
|
+
'Bildetekst som kan være ganske lang. Denne roboten er laget av DALLE2, en helt vaskeekte AI. Hvis denne teksten blir veldig lang kommer den på flere linjer.',
|
|
52
|
+
copyright: {
|
|
53
|
+
license: {
|
|
54
|
+
license: 'CC-BY-SA-4.0',
|
|
55
|
+
description: 'Creative Commons Attribution-ShareAlike 4.0 International',
|
|
56
|
+
url: 'https://creativecommons.org/licenses/by-sa/4.0/',
|
|
57
|
+
},
|
|
58
|
+
origin: 'http://floradania.dk/forside/',
|
|
59
|
+
creators: [],
|
|
60
|
+
processors: [],
|
|
61
|
+
rightsholders: [
|
|
62
|
+
{
|
|
63
|
+
type: 'Supplier',
|
|
64
|
+
name: 'Floradania',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
argTypes: {
|
|
70
|
+
children: {
|
|
71
|
+
control: {
|
|
72
|
+
type: null,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
} as Meta<typeof EmbedByline>;
|
|
77
|
+
|
|
78
|
+
export const EmbedBylineStory: StoryFn<typeof EmbedByline> = (args) => {
|
|
79
|
+
const { children, ...rest } = args;
|
|
80
|
+
return <EmbedByline {...rest}>{children}</EmbedByline>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
EmbedBylineStory.storyName = 'EmbedByline';
|