@ndla/ui 45.0.8 → 45.0.10
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/BannerCard/BannerCard.js +20 -10
- package/es/Embed/ConceptEmbed.js +44 -22
- package/es/Embed/ConceptListEmbed.js +5 -4
- package/es/Embed/conceptComponents.js +54 -41
- package/es/FrontpageArticle/FrontpageArticle.js +3 -2
- package/es/Gloss/Gloss.js +12 -11
- package/es/LicenseByline/EmbedByline.js +5 -5
- package/es/Notion/NotionImage.js +2 -2
- package/es/locale/messages-en.js +5 -3
- package/es/locale/messages-nb.js +4 -2
- package/es/locale/messages-nn.js +5 -3
- package/es/locale/messages-se.js +5 -3
- package/es/locale/messages-sma.js +5 -3
- package/lib/BannerCard/BannerCard.d.ts +1 -1
- package/lib/BannerCard/BannerCard.js +21 -12
- package/lib/Embed/ConceptEmbed.d.ts +1 -1
- package/lib/Embed/ConceptEmbed.js +44 -22
- package/lib/Embed/ConceptListEmbed.js +5 -4
- package/lib/Embed/conceptComponents.d.ts +5 -2
- package/lib/Embed/conceptComponents.js +53 -41
- package/lib/Figure/FigureOpenDialogButton.d.ts +1 -1
- package/lib/FrontpageArticle/FrontpageArticle.js +3 -2
- package/lib/Gloss/Gloss.js +12 -11
- package/lib/LicenseByline/EmbedByline.d.ts +2 -2
- package/lib/LicenseByline/EmbedByline.js +5 -5
- package/lib/Notion/NotionImage.d.ts +1 -1
- package/lib/Notion/NotionImage.js +2 -2
- package/lib/locale/messages-en.d.ts +3 -1
- package/lib/locale/messages-en.js +5 -3
- package/lib/locale/messages-nb.d.ts +3 -1
- package/lib/locale/messages-nb.js +4 -2
- package/lib/locale/messages-nn.d.ts +3 -1
- package/lib/locale/messages-nn.js +5 -3
- package/lib/locale/messages-se.d.ts +3 -1
- package/lib/locale/messages-se.js +5 -3
- package/lib/locale/messages-sma.d.ts +3 -1
- package/lib/locale/messages-sma.js +5 -3
- package/lib/types.d.ts +1 -0
- package/package.json +5 -5
- package/src/BannerCard/BannerCard.tsx +2 -2
- package/src/ContactBlock/Contactblock.stories.tsx +1 -0
- package/src/Embed/AudioEmbed.stories.tsx +3 -0
- package/src/Embed/ConceptEmbed.stories.tsx +3 -0
- package/src/Embed/ConceptEmbed.tsx +96 -69
- package/src/Embed/ConceptListEmbed.tsx +2 -1
- package/src/Embed/IframeEmbed.stories.tsx +1 -0
- package/src/Embed/ImageEmbed.stories.tsx +1 -0
- package/src/Embed/conceptComponents.tsx +58 -37
- package/src/Figure/FigureOpenDialogButton.tsx +1 -1
- package/src/FrontpageArticle/FrontpageArticle.tsx +1 -1
- package/src/Gloss/Gloss.tsx +5 -5
- package/src/LicenseByline/EmbedByline.tsx +2 -2
- package/src/Notion/NotionImage.tsx +1 -1
- package/src/locale/messages-en.ts +3 -1
- package/src/locale/messages-nb.ts +3 -1
- package/src/locale/messages-nn.ts +3 -1
- package/src/locale/messages-se.ts +3 -1
- package/src/locale/messages-sma.ts +3 -1
- package/src/types.ts +1 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { forwardRef, ReactNode, RefAttributes } from 'react';
|
|
10
|
-
import { ConceptVisualElementMeta } from '@ndla/types-embed';
|
|
10
|
+
import { AudioMeta, AudioMetaData, ConceptData, ConceptVisualElementMeta } from '@ndla/types-embed';
|
|
11
11
|
import { useTranslation } from 'react-i18next';
|
|
12
12
|
import { css } from '@emotion/react';
|
|
13
13
|
import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
@@ -21,9 +21,12 @@ import BrightcoveEmbed from './BrightcoveEmbed';
|
|
|
21
21
|
import H5pEmbed from './H5pEmbed';
|
|
22
22
|
import { ExternalEmbed, HeartButtonType, IframeEmbed } from '.';
|
|
23
23
|
import { EmbedByline } from '../LicenseByline';
|
|
24
|
+
import { Gloss } from '../Gloss';
|
|
25
|
+
|
|
26
|
+
export type ConceptType = 'concept' | 'gloss';
|
|
24
27
|
|
|
25
28
|
export interface ConceptNotionData {
|
|
26
|
-
title:
|
|
29
|
+
title: ConceptData['concept']['title'];
|
|
27
30
|
content?: string;
|
|
28
31
|
metaImage?: {
|
|
29
32
|
url?: string;
|
|
@@ -32,6 +35,8 @@ export interface ConceptNotionData {
|
|
|
32
35
|
copyright?: Copyright;
|
|
33
36
|
source?: string;
|
|
34
37
|
visualElement?: ConceptVisualElementMeta;
|
|
38
|
+
conceptType: ConceptData['concept']['conceptType'];
|
|
39
|
+
glossData?: ConceptData['concept']['glossData'];
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
interface ConceptNotionProps extends RefAttributes<HTMLDivElement>, ConceptNotionData {
|
|
@@ -151,6 +156,8 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
151
156
|
subjects,
|
|
152
157
|
heartButton,
|
|
153
158
|
conceptHeartButton,
|
|
159
|
+
conceptType,
|
|
160
|
+
glossData,
|
|
154
161
|
...rest
|
|
155
162
|
},
|
|
156
163
|
ref,
|
|
@@ -162,47 +169,61 @@ export const ConceptNotionV2 = forwardRef<HTMLDivElement, ConceptNotionProps>(
|
|
|
162
169
|
<ContentPadding>
|
|
163
170
|
<NotionHeader>
|
|
164
171
|
<h1>
|
|
165
|
-
{title} {<small>{t(
|
|
172
|
+
{title.title} {<small>{t(`searchPage.resultType.${conceptType}`)}</small>}
|
|
166
173
|
</h1>
|
|
167
174
|
{closeButton}
|
|
168
175
|
</NotionHeader>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
176
|
+
{conceptType !== 'gloss' ? (
|
|
177
|
+
<>
|
|
178
|
+
<StyledNotionDialogContent>
|
|
179
|
+
{visualElement?.resource === 'image' ? (
|
|
180
|
+
<ImageEmbed embed={visualElement} heartButton={heartButton} />
|
|
181
|
+
) : visualElement?.resource === 'brightcove' ? (
|
|
182
|
+
<BrightcoveEmbed embed={visualElement} heartButton={heartButton} />
|
|
183
|
+
) : visualElement?.resource === 'h5p' ? (
|
|
184
|
+
<H5pEmbed embed={visualElement} />
|
|
185
|
+
) : visualElement?.resource === 'iframe' ? (
|
|
186
|
+
<IframeEmbed embed={visualElement} />
|
|
187
|
+
) : visualElement?.resource === 'external' ? (
|
|
188
|
+
<ExternalEmbed embed={visualElement} />
|
|
189
|
+
) : null}
|
|
190
|
+
<NotionDialogText>{parseMarkdown(content ?? '', 'body')}</NotionDialogText>
|
|
191
|
+
</StyledNotionDialogContent>
|
|
192
|
+
{tags && (
|
|
193
|
+
<ListWrapper>
|
|
194
|
+
{`${t('notions.tags')}:`}
|
|
195
|
+
<StyledList>
|
|
196
|
+
{tags.map((tag, index) => (
|
|
197
|
+
<li key={index}>{tag}</li>
|
|
198
|
+
))}
|
|
199
|
+
</StyledList>
|
|
200
|
+
</ListWrapper>
|
|
201
|
+
)}
|
|
202
|
+
{subjects && (
|
|
203
|
+
<ListWrapper>
|
|
204
|
+
{`${t('notions.usedIn')}:`}
|
|
205
|
+
<StyledList>
|
|
206
|
+
{subjects.map((subject, index) => (
|
|
207
|
+
<li key={index}>{subject}</li>
|
|
208
|
+
))}
|
|
209
|
+
</StyledList>
|
|
210
|
+
</ListWrapper>
|
|
211
|
+
)}
|
|
212
|
+
</>
|
|
213
|
+
) : (
|
|
214
|
+
<Gloss
|
|
215
|
+
title={title}
|
|
216
|
+
glossData={glossData!}
|
|
217
|
+
audio={
|
|
218
|
+
visualElement?.status === 'success' && visualElement.resource === 'audio'
|
|
219
|
+
? { src: visualElement.data.audioFile.url, title: visualElement.data.title.title }
|
|
220
|
+
: undefined
|
|
221
|
+
}
|
|
222
|
+
/>
|
|
202
223
|
)}
|
|
203
224
|
</ContentPadding>
|
|
204
225
|
{copyright && (
|
|
205
|
-
<EmbedByline copyright={copyright} type=
|
|
226
|
+
<EmbedByline copyright={copyright} type={conceptType as ConceptType}>
|
|
206
227
|
{copyright.license?.license.toLowerCase() !== COPYRIGHTED && conceptHeartButton}
|
|
207
228
|
</EmbedByline>
|
|
208
229
|
)}
|
|
@@ -10,7 +10,7 @@ import { Play } from '@ndla/icons/common';
|
|
|
10
10
|
import { ExpandTwoArrows, CursorClick } from '@ndla/icons/action';
|
|
11
11
|
|
|
12
12
|
interface Props {
|
|
13
|
-
type?: 'image' | 'video' | 'h5p' | 'iframe' | 'external';
|
|
13
|
+
type?: 'image' | 'video' | 'h5p' | 'iframe' | 'external' | 'audio';
|
|
14
14
|
messages: {
|
|
15
15
|
zoomImageButtonLabel: string;
|
|
16
16
|
zoomOutImageButtonLabel: string;
|
|
@@ -71,7 +71,7 @@ export const FrontpageArticle = ({ article, id, isWide, licenseBox }: Props) =>
|
|
|
71
71
|
|
|
72
72
|
if (isWide) {
|
|
73
73
|
return (
|
|
74
|
-
<StyledArticle data-wide={isWide} style={cssVars}>
|
|
74
|
+
<StyledArticle data-wide={isWide} style={cssVars} id={id}>
|
|
75
75
|
<LayoutItem>{content}</LayoutItem>
|
|
76
76
|
</StyledArticle>
|
|
77
77
|
);
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -86,7 +86,7 @@ const TranslatedText = styled.span`
|
|
|
86
86
|
padding: ${spacing.small} ${spacing.normal};
|
|
87
87
|
font-family: ${fonts.sans};
|
|
88
88
|
${fonts.sizes('18px', '24px')};
|
|
89
|
-
|
|
89
|
+
&[data-first='true'] {
|
|
90
90
|
color: ${colors.brand.dark};
|
|
91
91
|
font-weight: ${fonts.weight.bold};
|
|
92
92
|
background-color: ${colors.background.lightBlue};
|
|
@@ -135,9 +135,9 @@ const Gloss = ({ title, glossData, audio }: Props) => {
|
|
|
135
135
|
<StyledAccordionContent>
|
|
136
136
|
{glossData.examples.map((example, index) => (
|
|
137
137
|
<div key={index}>
|
|
138
|
-
{example.map((translation) => (
|
|
139
|
-
|
|
140
|
-
<TranslatedText>{translation.example}</TranslatedText>
|
|
138
|
+
{example.map((translation, innerIndex) => (
|
|
139
|
+
<div key={`${index}_${innerIndex}`}>
|
|
140
|
+
<TranslatedText data-first={innerIndex === 0}>{translation.example}</TranslatedText>
|
|
141
141
|
{translation.transcriptions.pinyin && (
|
|
142
142
|
<TranslatedText key={t('gloss.transcriptions.pinyin')} lang={glossData.originalLanguage}>
|
|
143
143
|
{translation.transcriptions?.pinyin}
|
|
@@ -148,7 +148,7 @@ const Gloss = ({ title, glossData, audio }: Props) => {
|
|
|
148
148
|
{translation.transcriptions?.traditional}
|
|
149
149
|
</TranslatedText>
|
|
150
150
|
)}
|
|
151
|
-
|
|
151
|
+
</div>
|
|
152
152
|
))}
|
|
153
153
|
</div>
|
|
154
154
|
))}
|
|
@@ -14,7 +14,7 @@ import { breakpoints, colors, fonts, misc, mq, spacing } from '@ndla/core';
|
|
|
14
14
|
import { getLicenseByAbbreviation, getLicenseCredits } from '@ndla/licenses';
|
|
15
15
|
import { ICopyright as ImageCopyright } from '@ndla/types-backend/image-api';
|
|
16
16
|
import { ICopyright as AudioCopyright } from '@ndla/types-backend/audio-api';
|
|
17
|
-
import {
|
|
17
|
+
import { IDraftCopyright as ConceptCopyright } from '@ndla/types-backend/concept-api';
|
|
18
18
|
import { BrightcoveCopyright } from '@ndla/types-embed';
|
|
19
19
|
import { WarningOutline } from '@ndla/icons/common';
|
|
20
20
|
import { parseMarkdown } from '@ndla/util';
|
|
@@ -58,7 +58,7 @@ interface PodcastProps extends BaseProps {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
interface ConceptProps extends BaseProps {
|
|
61
|
-
type: 'concept';
|
|
61
|
+
type: 'concept' | 'gloss';
|
|
62
62
|
copyright: ConceptCopyright | undefined;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -37,7 +37,7 @@ const StyledImage = styled(Image)`
|
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
39
|
interface Props {
|
|
40
|
-
type: 'image' | 'video' | 'h5p' | 'iframe' | 'external' | undefined;
|
|
40
|
+
type: 'image' | 'video' | 'h5p' | 'iframe' | 'external' | 'audio' | undefined;
|
|
41
41
|
id: string;
|
|
42
42
|
src: string;
|
|
43
43
|
alt: string;
|
|
@@ -210,9 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Explanations',
|
|
211
211
|
notionsRemove: 'Remove',
|
|
212
212
|
showVideo: 'Watch video',
|
|
213
|
-
|
|
213
|
+
concept: 'Show notion',
|
|
214
214
|
gridView: 'Grid-view',
|
|
215
215
|
listView: 'List-view',
|
|
216
|
+
gloss: 'Show gloss',
|
|
216
217
|
},
|
|
217
218
|
contextModal: {
|
|
218
219
|
button: '+ {{count}} more contexts',
|
|
@@ -1336,6 +1337,7 @@ const messages = {
|
|
|
1336
1337
|
concept: 'Concept',
|
|
1337
1338
|
h5p: 'H5P',
|
|
1338
1339
|
external: 'External resource',
|
|
1340
|
+
gloss: 'Gloss',
|
|
1339
1341
|
},
|
|
1340
1342
|
},
|
|
1341
1343
|
gloss: {
|
|
@@ -210,7 +210,8 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Begrepsforklaring',
|
|
211
211
|
notionsRemove: 'Fjern',
|
|
212
212
|
showVideo: 'Se video',
|
|
213
|
-
|
|
213
|
+
concept: 'Se forklaring',
|
|
214
|
+
gloss: 'Se glose',
|
|
214
215
|
gridView: 'Gallerivisning',
|
|
215
216
|
listView: 'Listevisning',
|
|
216
217
|
},
|
|
@@ -1332,6 +1333,7 @@ const messages = {
|
|
|
1332
1333
|
concept: 'Forklaring',
|
|
1333
1334
|
h5p: 'H5P',
|
|
1334
1335
|
external: 'Ekstern ressurs',
|
|
1336
|
+
gloss: 'Glose',
|
|
1335
1337
|
},
|
|
1336
1338
|
},
|
|
1337
1339
|
gloss: {
|
|
@@ -210,9 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Begrepsforklaring',
|
|
211
211
|
notionsRemove: 'Fjern',
|
|
212
212
|
showVideo: 'Sjå video',
|
|
213
|
-
|
|
213
|
+
concept: 'Sjå forklaring',
|
|
214
214
|
gridView: 'Gallerivisning',
|
|
215
215
|
listView: 'Listevisning',
|
|
216
|
+
gloss: 'Sjå glose',
|
|
216
217
|
},
|
|
217
218
|
contextModal: {
|
|
218
219
|
button: '+ {{count}} fleire stader',
|
|
@@ -1332,6 +1333,7 @@ const messages = {
|
|
|
1332
1333
|
concept: 'Forklaring',
|
|
1333
1334
|
h5p: 'H5P',
|
|
1334
1335
|
external: 'Ekstern ressurs',
|
|
1336
|
+
gloss: 'Glose',
|
|
1335
1337
|
},
|
|
1336
1338
|
},
|
|
1337
1339
|
gloss: {
|
|
@@ -210,9 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Doabačilgehus',
|
|
211
211
|
notionsRemove: 'Sihko',
|
|
212
212
|
showVideo: 'Geahča video',
|
|
213
|
-
|
|
213
|
+
concept: 'Geahča čilgehusa',
|
|
214
214
|
gridView: 'Galleriijačájáhus',
|
|
215
215
|
listView: 'Čájáhus listtu vuođul',
|
|
216
|
+
gloss: 'Se glose',
|
|
216
217
|
},
|
|
217
218
|
contextModal: {
|
|
218
219
|
button: '+ {{count}} eanet sajiin',
|
|
@@ -1333,6 +1334,7 @@ const messages = {
|
|
|
1333
1334
|
concept: 'Forklaring',
|
|
1334
1335
|
h5p: 'H5P',
|
|
1335
1336
|
external: 'Ekstern ressurs',
|
|
1337
|
+
gloss: 'Glose',
|
|
1336
1338
|
},
|
|
1337
1339
|
},
|
|
1338
1340
|
gloss: {
|
|
@@ -210,9 +210,10 @@ const messages = {
|
|
|
210
210
|
notionsHeading: 'Baakoebuerkiestimmie',
|
|
211
211
|
notionsRemove: 'Skubph',
|
|
212
212
|
showVideo: 'Gïehtjh videjovem',
|
|
213
|
-
|
|
213
|
+
concept: 'Gïehtjh buerkiestimmiem ',
|
|
214
214
|
gridView: 'Gallerivisning',
|
|
215
215
|
listView: 'Listevisning',
|
|
216
|
+
gloss: 'Se glose',
|
|
216
217
|
},
|
|
217
218
|
contextModal: {
|
|
218
219
|
button: '+ {{count}} jieniebinie sijjine',
|
|
@@ -1337,6 +1338,7 @@ const messages = {
|
|
|
1337
1338
|
concept: 'Forklaring',
|
|
1338
1339
|
h5p: 'H5P',
|
|
1339
1340
|
external: 'Ekstern ressurs',
|
|
1341
|
+
gloss: 'Glose',
|
|
1340
1342
|
},
|
|
1341
1343
|
},
|
|
1342
1344
|
gloss: {
|