@ndla/ui 56.0.74-alpha.0 → 56.0.75-alpha.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/dist/panda.buildinfo.json +3 -21
- package/dist/styles.css +8 -76
- package/es/Article/Article.js +2 -2
- package/es/ContentTypeBadge/ContentTypeBadge.js +35 -213
- package/es/ContentTypeHero/ContentTypeHero.js +2 -1
- package/es/RelatedArticleList/RelatedArticleList.js +1 -1
- package/es/index.js +1 -3
- package/es/locale/messages-en.js +2 -1
- package/es/locale/messages-nb.js +2 -1
- package/es/locale/messages-nn.js +2 -1
- package/es/locale/messages-se.js +2 -1
- package/es/locale/messages-sma.js +2 -1
- package/es/model/ContentType.js +2 -0
- package/lib/Article/Article.d.ts +1 -1
- package/lib/Article/Article.js +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +9 -19
- package/lib/ContentTypeBadge/ContentTypeBadge.js +36 -223
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.d.ts +1 -1
- package/lib/ContentTypeHero/ContentTypeHero.d.ts +1 -1
- package/lib/ContentTypeHero/ContentTypeHero.js +2 -1
- package/lib/RelatedArticleList/RelatedArticleList.js +2 -2
- package/lib/index.d.ts +2 -4
- package/lib/index.js +5 -61
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +2 -1
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +2 -1
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +2 -1
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +2 -1
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +2 -1
- package/lib/model/ContentType.d.ts +1 -0
- package/lib/model/ContentType.js +3 -1
- package/package.json +8 -8
- package/src/Article/Article.tsx +3 -3
- package/src/ContentTypeBadge/ContentTypeBadge.stories.tsx +45 -53
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +63 -211
- package/src/ContentTypeBlockQuote/ContentTypeBlockQuote.tsx +1 -1
- package/src/ContentTypeHero/ContentTypeHero.tsx +2 -1
- package/src/RelatedArticleList/RelatedArticleList.tsx +1 -1
- package/src/index.ts +2 -18
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
- package/src/model/ContentType.ts +2 -0
- package/es/ContentLoader/index.js +0 -82
- package/es/ContentTypeBadge/ContentTypeBadgeNew.js +0 -49
- package/es/ContentTypeBadge/index.js +0 -11
- package/lib/ContentLoader/index.d.ts +0 -16
- package/lib/ContentLoader/index.js +0 -88
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +0 -16
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +0 -57
- package/lib/ContentTypeBadge/index.d.ts +0 -10
- package/lib/ContentTypeBadge/index.js +0 -57
- package/src/ContentLoader/ContentLoader.stories.tsx +0 -62
- package/src/ContentLoader/index.tsx +0 -73
- package/src/ContentTypeBadge/ContentTypeBadgeNew.stories.tsx +0 -70
- package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +0 -77
- package/src/ContentTypeBadge/index.ts +0 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion": "0.
|
|
2
|
+
"schemaVersion": "0.48.0",
|
|
3
3
|
"styles": {
|
|
4
4
|
"atomic": [
|
|
5
5
|
"background]___[value:background.default",
|
|
@@ -171,26 +171,6 @@
|
|
|
171
171
|
"width]___[value:surface.xsmall",
|
|
172
172
|
"height]___[value:surface.xsmall",
|
|
173
173
|
"fontFamily]___[value:serif",
|
|
174
|
-
"display]___[value:inline-flex",
|
|
175
|
-
"borderRadius]___[value:100%",
|
|
176
|
-
"color]___[value:var(--icon-color)",
|
|
177
|
-
"width]___[value:20px",
|
|
178
|
-
"height]___[value:20px",
|
|
179
|
-
"width]___[value:10px]___[cond:& svg",
|
|
180
|
-
"height]___[value:10px]___[cond:& svg",
|
|
181
|
-
"height]___[value:26px]___[cond:tablet",
|
|
182
|
-
"width]___[value:26px]___[cond:tablet",
|
|
183
|
-
"width]___[value:12px]___[cond:& svg<___>tablet",
|
|
184
|
-
"height]___[value:12px]___[cond:& svg<___>tablet",
|
|
185
|
-
"width]___[value:34px",
|
|
186
|
-
"height]___[value:34px",
|
|
187
|
-
"width]___[value:50px",
|
|
188
|
-
"height]___[value:50px",
|
|
189
|
-
"width]___[value:25px]___[cond:& svg",
|
|
190
|
-
"height]___[value:25px]___[cond:& svg",
|
|
191
|
-
"border]___[value:2px solid",
|
|
192
|
-
"borderColor]___[value:var(--icon-color)",
|
|
193
|
-
"backgroundColor]___[value:var(--background-color)",
|
|
194
174
|
"opacity]___[value:1]___[cond:_hover<___>& [data-copy-button]",
|
|
195
175
|
"cursor]___[value:pointer]___[cond:_hover<___>& [data-copy-button]",
|
|
196
176
|
"position]___[value:absolute",
|
|
@@ -250,6 +230,7 @@
|
|
|
250
230
|
"right]___[value:xsmall",
|
|
251
231
|
"width]___[value:medium",
|
|
252
232
|
"height]___[value:medium",
|
|
233
|
+
"border]___[value:2px solid",
|
|
253
234
|
"borderColor]___[value:background.default",
|
|
254
235
|
"transitionProperty]___[value:transform, background-color, color",
|
|
255
236
|
"transitionDuration]___[value:normal",
|
|
@@ -349,6 +330,7 @@
|
|
|
349
330
|
"color]___[value:text.subtle",
|
|
350
331
|
"borderColor]___[value:stroke.error",
|
|
351
332
|
"background]___[value:surface.dangerSubtle",
|
|
333
|
+
"display]___[value:inline-flex",
|
|
352
334
|
"whiteSpace]___[value:pre-wrap",
|
|
353
335
|
"display]___[value:grid]___[cond:mobileWideDown",
|
|
354
336
|
"gridTemplateColumns]___[value:1fr auto]___[cond:mobileWideDown",
|
package/dist/styles.css
CHANGED
|
@@ -393,46 +393,6 @@
|
|
|
393
393
|
height: var(--sizes-surface-xsmall);
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
.d_inline-flex {
|
|
397
|
-
display: inline-flex;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
.bdr_100\% {
|
|
401
|
-
border-radius: 100%;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.c_var\(--icon-color\) {
|
|
405
|
-
color: var(--icon-color);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.w_20px {
|
|
409
|
-
width: 20px;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.h_20px {
|
|
413
|
-
height: 20px;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.w_34px {
|
|
417
|
-
width: 34px;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.h_34px {
|
|
421
|
-
height: 34px;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
.w_50px {
|
|
425
|
-
width: 50px;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.h_50px {
|
|
429
|
-
height: 50px;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.bd_2px_solid {
|
|
433
|
-
border: 2px solid;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
396
|
.pos_absolute {
|
|
437
397
|
position: absolute;
|
|
438
398
|
}
|
|
@@ -509,6 +469,10 @@
|
|
|
509
469
|
height: var(--sizes-medium);
|
|
510
470
|
}
|
|
511
471
|
|
|
472
|
+
.bd_2px_solid {
|
|
473
|
+
border: 2px solid;
|
|
474
|
+
}
|
|
475
|
+
|
|
512
476
|
.c_background\.default {
|
|
513
477
|
color: var(--colors-background-default);
|
|
514
478
|
}
|
|
@@ -577,6 +541,10 @@
|
|
|
577
541
|
background: var(--colors-surface-danger-subtle);
|
|
578
542
|
}
|
|
579
543
|
|
|
544
|
+
.d_inline-flex {
|
|
545
|
+
display: inline-flex;
|
|
546
|
+
}
|
|
547
|
+
|
|
580
548
|
.white-space_pre-wrap {
|
|
581
549
|
white-space: pre-wrap;
|
|
582
550
|
}
|
|
@@ -685,14 +653,6 @@
|
|
|
685
653
|
font-family: var(--fonts-serif);
|
|
686
654
|
}
|
|
687
655
|
|
|
688
|
-
.bd-c_var\(--icon-color\) {
|
|
689
|
-
border-color: var(--icon-color);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
.bg-c_var\(--background-color\) {
|
|
693
|
-
background-color: var(--background-color);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
656
|
.left_-xxlarge {
|
|
697
657
|
left: calc(var(--spacing-xxlarge) * -1);
|
|
698
658
|
}
|
|
@@ -911,22 +871,6 @@
|
|
|
911
871
|
z-index: var(--z-index-hide);
|
|
912
872
|
}
|
|
913
873
|
|
|
914
|
-
.\[\&_svg\]\:w_10px svg {
|
|
915
|
-
width: 10px;
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
.\[\&_svg\]\:h_10px svg {
|
|
919
|
-
height: 10px;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
.\[\&_svg\]\:w_25px svg {
|
|
923
|
-
width: 25px;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
.\[\&_svg\]\:h_25px svg {
|
|
927
|
-
height: 25px;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
874
|
.\[\&_\>_\*\:not\(\:where\(\:first-child\)\)\]\:mbs_xsmall > *:not(:where(:first-child)) {
|
|
931
875
|
margin-block-start: var(--spacing-xsmall);
|
|
932
876
|
}
|
|
@@ -1351,12 +1295,6 @@
|
|
|
1351
1295
|
}
|
|
1352
1296
|
.tablet\:box-orient_vertical {
|
|
1353
1297
|
box-orient: vertical;
|
|
1354
|
-
}
|
|
1355
|
-
.tablet\:h_26px {
|
|
1356
|
-
height: 26px;
|
|
1357
|
-
}
|
|
1358
|
-
.tablet\:w_26px {
|
|
1359
|
-
width: 26px;
|
|
1360
1298
|
}
|
|
1361
1299
|
.tablet\:ai_unset {
|
|
1362
1300
|
align-items: unset;
|
|
@@ -1375,12 +1313,6 @@
|
|
|
1375
1313
|
}
|
|
1376
1314
|
.\[\&\[data-has-image\=\'true\'\]\]\:tablet\:px_medium[data-has-image='true'] {
|
|
1377
1315
|
padding-inline: var(--spacing-medium);
|
|
1378
|
-
}
|
|
1379
|
-
.\[\&_svg\]\:tablet\:w_12px svg {
|
|
1380
|
-
width: 12px;
|
|
1381
|
-
}
|
|
1382
|
-
.\[\&_svg\]\:tablet\:h_12px svg {
|
|
1383
|
-
height: 12px;
|
|
1384
1316
|
}
|
|
1385
1317
|
}
|
|
1386
1318
|
|
package/es/Article/Article.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ark } from "@ark-ui/react";
|
|
|
11
11
|
import { Heading, Text } from "@ndla/primitives";
|
|
12
12
|
import { cx } from "@ndla/styled-system/css";
|
|
13
13
|
import { Stack, styled } from "@ndla/styled-system/jsx";
|
|
14
|
-
import {
|
|
14
|
+
import { ContentTypeBadge } from "..";
|
|
15
15
|
import { ArticleByline } from "./ArticleByline";
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const StyledArticleContent = styled(ark.section, {}, {
|
|
@@ -118,7 +118,7 @@ export const ArticleTitle = _ref2 => {
|
|
|
118
118
|
align: "center",
|
|
119
119
|
direction: "row",
|
|
120
120
|
gap: "small",
|
|
121
|
-
children: [!!contentType && /*#__PURE__*/_jsx(
|
|
121
|
+
children: [!!contentType && /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
122
122
|
contentType: contentType,
|
|
123
123
|
children: contentTypeLabel
|
|
124
124
|
}), heartButton]
|
|
@@ -1,228 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { BookReadFill, ShareFill, VoicePrintLine } from "@ndla/icons/common";
|
|
13
|
-
import { MenuSearchLine, LearningPath, SharedResource, TasksAndActivities } from "@ndla/icons/contentType";
|
|
14
|
-
import { ChatLine, FileListLine, LinkMedium, ImageLine, MovieLine } from "@ndla/icons/editor";
|
|
15
|
-
import { styled } from "@ndla/styled-system/jsx";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { useTranslation } from "react-i18next";
|
|
11
|
+
import { Badge } from "@ndla/primitives";
|
|
16
12
|
import * as contentTypes from "../model/ContentType";
|
|
17
|
-
|
|
18
|
-
// TODO: Remove this component
|
|
19
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
width: "10px",
|
|
41
|
-
height: "10px"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"x-small": {
|
|
45
|
-
width: "20px",
|
|
46
|
-
height: "20px",
|
|
47
|
-
border: "1px solid",
|
|
48
|
-
tablet: {
|
|
49
|
-
height: "26px",
|
|
50
|
-
width: "26px"
|
|
51
|
-
},
|
|
52
|
-
"& svg": {
|
|
53
|
-
width: "10px",
|
|
54
|
-
height: "10px",
|
|
55
|
-
tablet: {
|
|
56
|
-
width: "12px",
|
|
57
|
-
height: "12px"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
small: {
|
|
62
|
-
width: "34px",
|
|
63
|
-
height: "34px"
|
|
64
|
-
},
|
|
65
|
-
large: {
|
|
66
|
-
width: "50px",
|
|
67
|
-
height: "50px",
|
|
68
|
-
"& svg": {
|
|
69
|
-
width: "25px",
|
|
70
|
-
height: "25px"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
border: {
|
|
75
|
-
true: {
|
|
76
|
-
border: "2px solid",
|
|
77
|
-
borderColor: "var(--icon-color)"
|
|
78
|
-
},
|
|
79
|
-
false: {}
|
|
80
|
-
},
|
|
81
|
-
background: {
|
|
82
|
-
true: {
|
|
83
|
-
backgroundColor: "var(--background-color)"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
const iconMap = {
|
|
89
|
-
[contentTypes.SUBJECT_MATERIAL]: {
|
|
90
|
-
icon: FileListLine,
|
|
91
|
-
iconColor: colors.subjectMaterial.dark,
|
|
92
|
-
backgroundColor: colors.subjectMaterial.light
|
|
93
|
-
},
|
|
94
|
-
[contentTypes.TASKS_AND_ACTIVITIES]: {
|
|
95
|
-
icon: TasksAndActivities,
|
|
96
|
-
iconColor: colors.tasksAndActivities.dark,
|
|
97
|
-
backgroundColor: colors.tasksAndActivities.light
|
|
98
|
-
},
|
|
99
|
-
[contentTypes.ASSESSMENT_RESOURCES]: {
|
|
100
|
-
icon: MenuSearchLine,
|
|
101
|
-
iconColor: colors.assessmentResource.dark,
|
|
102
|
-
backgroundColor: colors.assessmentResource.light
|
|
103
|
-
},
|
|
104
|
-
[contentTypes.SUBJECT]: {
|
|
105
|
-
icon: BookReadFill,
|
|
106
|
-
iconColor: colors.subject.dark,
|
|
107
|
-
backgroundColor: colors.subject.light
|
|
108
|
-
},
|
|
109
|
-
[contentTypes.SOURCE_MATERIAL]: {
|
|
110
|
-
icon: SharedResource,
|
|
111
|
-
iconColor: colors.sourceMaterial.dark,
|
|
112
|
-
backgroundColor: colors.sourceMaterial.light
|
|
113
|
-
},
|
|
114
|
-
[contentTypes.LEARNING_PATH]: {
|
|
115
|
-
icon: LearningPath,
|
|
116
|
-
iconColor: colors.learningPath.dark,
|
|
117
|
-
backgroundColor: colors.learningPath.light
|
|
118
|
-
},
|
|
119
|
-
[contentTypes.TOPIC]: {
|
|
120
|
-
icon: BookmarkLine,
|
|
121
|
-
iconColor: colors.subject.dark,
|
|
122
|
-
backgroundColor: colors.subject.light
|
|
123
|
-
},
|
|
124
|
-
[contentTypes.MULTIDISCIPLINARY]: {
|
|
125
|
-
icon: ShareFill,
|
|
126
|
-
backgroundColor: "#b9b37b"
|
|
127
|
-
},
|
|
128
|
-
[contentTypes.CONCEPT]: {
|
|
129
|
-
icon: ChatLine,
|
|
130
|
-
iconColor: colors.concept.text,
|
|
131
|
-
backgroundColor: colors.concept.light
|
|
132
|
-
},
|
|
133
|
-
[contentTypes.EXTERNAL]: {
|
|
134
|
-
icon: LinkMedium,
|
|
135
|
-
iconColor: colors.external.dark,
|
|
136
|
-
backgroundColor: colors.external.light
|
|
137
|
-
},
|
|
138
|
-
[contentTypes.resourceEmbedTypeMapping.image]: {
|
|
139
|
-
icon: ImageLine,
|
|
140
|
-
iconColor: colors.brand.grey,
|
|
141
|
-
backgroundColor: colors.brand.greyLight
|
|
142
|
-
},
|
|
143
|
-
[contentTypes.resourceEmbedTypeMapping.audio]: {
|
|
144
|
-
icon: VoicePrintLine,
|
|
145
|
-
iconColor: colors.brand.grey,
|
|
146
|
-
backgroundColor: colors.brand.greyLight
|
|
147
|
-
},
|
|
148
|
-
[contentTypes.resourceEmbedTypeMapping.video]: {
|
|
149
|
-
icon: MovieLine,
|
|
150
|
-
iconColor: colors.brand.grey,
|
|
151
|
-
backgroundColor: colors.brand.greyLight
|
|
152
|
-
},
|
|
153
|
-
[contentTypes.MISSING]: {
|
|
154
|
-
icon: SubtractLine,
|
|
155
|
-
iconColor: colors.brand.grey,
|
|
156
|
-
backgroundColor: colors.brand.greyLight
|
|
157
|
-
}
|
|
14
|
+
export const contentTypeToBadgeVariantMap = {
|
|
15
|
+
[contentTypes.SUBJECT_MATERIAL]: "brand1",
|
|
16
|
+
[contentTypes.TASKS_AND_ACTIVITIES]: "brand2",
|
|
17
|
+
[contentTypes.ASSESSMENT_RESOURCES]: "brand2",
|
|
18
|
+
[contentTypes.SUBJECT]: "neutral",
|
|
19
|
+
[contentTypes.SOURCE_MATERIAL]: "brand1",
|
|
20
|
+
[contentTypes.LEARNING_PATH]: "brand3",
|
|
21
|
+
[contentTypes.TOPIC]: "neutral",
|
|
22
|
+
[contentTypes.MULTIDISCIPLINARY]: "neutral",
|
|
23
|
+
[contentTypes.CONCEPT]: "brand1",
|
|
24
|
+
[contentTypes.EXTERNAL]: "brand2",
|
|
25
|
+
[contentTypes.IMAGE]: "brand1",
|
|
26
|
+
[contentTypes.AUDIO]: "brand1",
|
|
27
|
+
[contentTypes.PODCAST]: "brand1",
|
|
28
|
+
[contentTypes.VIDEO]: "brand1",
|
|
29
|
+
[contentTypes.MISSING]: "neutral",
|
|
30
|
+
[contentTypes.PODCAST_SERIES]: "brand1",
|
|
31
|
+
[contentTypes.GLOSS]: "brand1",
|
|
32
|
+
[contentTypes.PROGRAMME]: "neutral",
|
|
33
|
+
[contentTypes.FRONTPAGE_ARTICLE]: "brand2"
|
|
158
34
|
};
|
|
159
|
-
export const ContentTypeBadge = _ref => {
|
|
35
|
+
export const ContentTypeBadge = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
160
36
|
let {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
size = "small",
|
|
165
|
-
border = true,
|
|
166
|
-
className,
|
|
167
|
-
...rest
|
|
37
|
+
contentType,
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
168
40
|
} = _ref;
|
|
169
41
|
const {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
return {
|
|
179
|
-
Icon: fromMap.icon,
|
|
180
|
-
style
|
|
181
|
-
};
|
|
182
|
-
}, [type]);
|
|
183
|
-
return /*#__PURE__*/_jsx(StyledContentTypeBadge, {
|
|
184
|
-
title: title,
|
|
185
|
-
background: background,
|
|
186
|
-
size: size,
|
|
187
|
-
border: border,
|
|
188
|
-
style: style,
|
|
189
|
-
"aria-label": title,
|
|
190
|
-
className: className,
|
|
191
|
-
"data-badge": "",
|
|
192
|
-
"data-type": type,
|
|
193
|
-
...rest,
|
|
194
|
-
children: /*#__PURE__*/_jsx(Icon, {})
|
|
42
|
+
t
|
|
43
|
+
} = useTranslation();
|
|
44
|
+
return /*#__PURE__*/_jsx(Badge, {
|
|
45
|
+
colorTheme: contentTypeToBadgeVariantMap[contentType ?? "missing"] ?? contentTypeToBadgeVariantMap["missing"],
|
|
46
|
+
...props,
|
|
47
|
+
ref: ref,
|
|
48
|
+
children: children ?? t(`contentTypes.${contentType}`)
|
|
195
49
|
});
|
|
196
|
-
};
|
|
197
|
-
export const SubjectMaterialBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
198
|
-
...props,
|
|
199
|
-
type: contentTypes.SUBJECT_MATERIAL
|
|
200
|
-
});
|
|
201
|
-
export const TasksAndActivitiesBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
202
|
-
...props,
|
|
203
|
-
type: contentTypes.TASKS_AND_ACTIVITIES
|
|
204
|
-
});
|
|
205
|
-
export const AssessmentResourcesBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
206
|
-
...props,
|
|
207
|
-
type: contentTypes.ASSESSMENT_RESOURCES
|
|
208
|
-
});
|
|
209
|
-
export const SubjectBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
210
|
-
...props,
|
|
211
|
-
type: contentTypes.SUBJECT
|
|
212
|
-
});
|
|
213
|
-
export const SourceMaterialBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
214
|
-
...props,
|
|
215
|
-
type: contentTypes.SOURCE_MATERIAL
|
|
216
|
-
});
|
|
217
|
-
export const LearningPathBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
218
|
-
...props,
|
|
219
|
-
type: contentTypes.LEARNING_PATH
|
|
220
|
-
});
|
|
221
|
-
export const MultidisciplinaryTopicBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
222
|
-
...props,
|
|
223
|
-
type: contentTypes.MULTIDISCIPLINARY
|
|
224
|
-
});
|
|
225
|
-
export const ConceptBadge = props => /*#__PURE__*/_jsx(ContentTypeBadge, {
|
|
226
|
-
...props,
|
|
227
|
-
type: contentTypes.CONCEPT
|
|
228
50
|
});
|
|
@@ -32,7 +32,8 @@ export const contentTypeToHeroMap = {
|
|
|
32
32
|
// this will never happen
|
|
33
33
|
[contentTypes.PROGRAMME]: "primary",
|
|
34
34
|
// this will never happen
|
|
35
|
-
[contentTypes.PODCAST_SERIES]: "primary"
|
|
35
|
+
[contentTypes.PODCAST_SERIES]: "primary",
|
|
36
|
+
[contentTypes.FRONTPAGE_ARTICLE]: "primary"
|
|
36
37
|
};
|
|
37
38
|
export const ContentTypeHero = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
38
39
|
let {
|
|
@@ -13,7 +13,7 @@ import { CardContent, CardHeading, CardRoot, Text, Heading, Button } from "@ndla
|
|
|
13
13
|
import { SafeLink } from "@ndla/safelink";
|
|
14
14
|
import { styled } from "@ndla/styled-system/jsx";
|
|
15
15
|
import { linkOverlay } from "@ndla/styled-system/patterns";
|
|
16
|
-
import { ContentTypeBadge } from "../ContentTypeBadge/
|
|
16
|
+
import { ContentTypeBadge } from "../ContentTypeBadge/ContentTypeBadge";
|
|
17
17
|
import { contentTypes } from "../model/ContentType";
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
19
|
const StyledSpan = styled("span", {
|
package/es/index.js
CHANGED
|
@@ -14,7 +14,6 @@ export { ImageEmbed, getCrop, getFocalPoint, AudioEmbed, H5pEmbed, ExternalEmbed
|
|
|
14
14
|
export { LicenseLink, EmbedByline } from "./LicenseByline";
|
|
15
15
|
export { ArticleByline, ArticleBylineAccordionItem, ArticleFootNotes, ArticleWrapper, Article, ArticleFooter, ArticleHeader, ArticleContent, ArticleHGroup, ArticleTitle } from "./Article";
|
|
16
16
|
export { getPossiblyRelativeUrl } from "./utils/relativeUrl";
|
|
17
|
-
export { default as ContentLoader } from "./ContentLoader";
|
|
18
17
|
export { default as RelatedArticleList, RelatedArticle } from "./RelatedArticleList";
|
|
19
18
|
export { ErrorResourceAccessDenied, default as ErrorMessage } from "./ErrorMessage";
|
|
20
19
|
export { FileListEmbed, File, PdfFile, FileListItem, FileListElement, FileListWrapper } from "./FileList";
|
|
@@ -30,8 +29,7 @@ export { default as messagesSE } from "./locale/messages-se";
|
|
|
30
29
|
export { default as messagesSMA } from "./locale/messages-sma";
|
|
31
30
|
export { default as Breadcrumb, HomeBreadcrumb } from "./Breadcrumb";
|
|
32
31
|
export { i18nInstance, formatNestedMessages, useTagsInputTranslations, useTagSelectorTranslations, useComboboxTranslations, usePaginationTranslations, useAudioSearchTranslations, useImageSearchTranslations, useVideoSearchTranslations } from "./i18n";
|
|
33
|
-
export {
|
|
34
|
-
export { ContentTypeBadge as ContentTypeBadgeNew, contentTypeToBadgeVariantMap } from "./ContentTypeBadge/ContentTypeBadgeNew";
|
|
32
|
+
export { ContentTypeBadge, contentTypeToBadgeVariantMap } from "./ContentTypeBadge/ContentTypeBadge";
|
|
35
33
|
export { ContentTypeBlockQuote } from "./ContentTypeBlockQuote/ContentTypeBlockQuote";
|
|
36
34
|
export { ContentTypeFramedContent } from "./ContentTypeFramedContent/ContentTypeFramedContent";
|
|
37
35
|
export { default as CopyParagraphButton } from "./CopyParagraphButton";
|
package/es/locale/messages-en.js
CHANGED
|
@@ -573,7 +573,8 @@ const messages = {
|
|
|
573
573
|
external: "External",
|
|
574
574
|
gloss: "Gloss",
|
|
575
575
|
programme: "Programme",
|
|
576
|
-
"podcast-series": "Podcast series"
|
|
576
|
+
"podcast-series": "Podcast series",
|
|
577
|
+
"frontpage-article": "About NDLA article"
|
|
577
578
|
},
|
|
578
579
|
modal: {
|
|
579
580
|
closeModal: "Close"
|
package/es/locale/messages-nb.js
CHANGED
|
@@ -573,7 +573,8 @@ const messages = {
|
|
|
573
573
|
external: "Ekstern",
|
|
574
574
|
gloss: "Glose",
|
|
575
575
|
programme: "Programfag",
|
|
576
|
-
"podcast-series": "Podkast-serie"
|
|
576
|
+
"podcast-series": "Podkast-serie",
|
|
577
|
+
"frontpage-article": "Om NDLA-artikkel"
|
|
577
578
|
},
|
|
578
579
|
modal: {
|
|
579
580
|
closeModal: "Lukk"
|
package/es/locale/messages-nn.js
CHANGED
|
@@ -573,7 +573,8 @@ const messages = {
|
|
|
573
573
|
external: "Ekstern",
|
|
574
574
|
gloss: "Glose",
|
|
575
575
|
programme: "Programfag",
|
|
576
|
-
"podcast-series": "Podkast-serie"
|
|
576
|
+
"podcast-series": "Podkast-serie",
|
|
577
|
+
"frontpage-article": "Om NDLA-artikkel"
|
|
577
578
|
},
|
|
578
579
|
modal: {
|
|
579
580
|
closeModal: "Lukk"
|
package/es/locale/messages-se.js
CHANGED
|
@@ -573,7 +573,8 @@ const messages = {
|
|
|
573
573
|
external: "Ekstern",
|
|
574
574
|
gloss: "Glose",
|
|
575
575
|
programme: "Programfag",
|
|
576
|
-
"podcast-series": "Podkast-serie"
|
|
576
|
+
"podcast-series": "Podkast-serie",
|
|
577
|
+
"frontpage-article": "Om NDLA-artikkel"
|
|
577
578
|
},
|
|
578
579
|
modal: {
|
|
579
580
|
closeModal: "Govčča"
|
|
@@ -573,7 +573,8 @@ const messages = {
|
|
|
573
573
|
external: "Ekstern",
|
|
574
574
|
gloss: "Glose",
|
|
575
575
|
programme: "Programfag",
|
|
576
|
-
"podcast-series": "Podkast-serie"
|
|
576
|
+
"podcast-series": "Podkast-serie",
|
|
577
|
+
"frontpage-article": "Om NDLA-artikkel"
|
|
577
578
|
},
|
|
578
579
|
modal: {
|
|
579
580
|
closeModal: "Dahph"
|
package/es/model/ContentType.js
CHANGED
|
@@ -24,6 +24,7 @@ export const PODCAST = "podcast";
|
|
|
24
24
|
export const GLOSS = "gloss";
|
|
25
25
|
export const PROGRAMME = "programme";
|
|
26
26
|
export const PODCAST_SERIES = "podcast-series";
|
|
27
|
+
export const FRONTPAGE_ARTICLE = "frontpage-article";
|
|
27
28
|
export const contentTypes = {
|
|
28
29
|
SUBJECT_MATERIAL,
|
|
29
30
|
TASKS_AND_ACTIVITIES,
|
|
@@ -54,6 +55,7 @@ export const contentTypeMapping = {
|
|
|
54
55
|
[RESOURCE_TYPE_CONCEPT]: CONCEPT,
|
|
55
56
|
[MULTIDISCIPLINARY]: MULTIDISCIPLINARY,
|
|
56
57
|
[TOPIC]: TOPIC,
|
|
58
|
+
[FRONTPAGE_ARTICLE]: FRONTPAGE_ARTICLE,
|
|
57
59
|
default: SUBJECT_MATERIAL
|
|
58
60
|
};
|
|
59
61
|
export const resourceEmbedTypeMapping = {
|
package/lib/Article/Article.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { ReactNode } from "react";
|
|
9
|
-
import { ContentType } from "../ContentTypeBadge/
|
|
9
|
+
import { ContentType } from "../ContentTypeBadge/ContentTypeBadge";
|
|
10
10
|
import { Article as ArticleType } from "../types";
|
|
11
11
|
export declare const ArticleContent: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("@ark-ui/react").PolymorphicProps & {
|
|
12
12
|
consumeCss?: boolean;
|
package/lib/Article/Article.js
CHANGED
|
@@ -124,7 +124,7 @@ const ArticleTitle = _ref2 => {
|
|
|
124
124
|
align: "center",
|
|
125
125
|
direction: "row",
|
|
126
126
|
gap: "small",
|
|
127
|
-
children: [!!contentType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.
|
|
127
|
+
children: [!!contentType && /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ContentTypeBadge, {
|
|
128
128
|
contentType: contentType,
|
|
129
129
|
children: contentTypeLabel
|
|
130
130
|
}), heartButton]
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2024-present, NDLA.
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the GPLv3 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
title?: string;
|
|
13
|
-
background?: boolean;
|
|
14
|
-
border?: boolean;
|
|
15
|
-
className?: string;
|
|
8
|
+
import { BadgeProps, type BadgeVariant } from "@ndla/primitives";
|
|
9
|
+
import * as contentTypes from "../model/ContentType";
|
|
10
|
+
export interface ContentTypeBadgeProps extends Omit<BadgeProps, "colorTheme"> {
|
|
11
|
+
contentType: ContentType | undefined;
|
|
16
12
|
}
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const SubjectBadge: (props: Omit<Props, "type">) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare const SourceMaterialBadge: (props: Omit<Props, "type">) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare const LearningPathBadge: (props: Omit<Props, "type">) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export declare const MultidisciplinaryTopicBadge: (props: Omit<Props, "type">) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export declare const ConceptBadge: (props: Omit<Props, "type">) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export {};
|
|
13
|
+
export type StrictContentType = typeof contentTypes.SUBJECT_MATERIAL | typeof contentTypes.TASKS_AND_ACTIVITIES | typeof contentTypes.ASSESSMENT_RESOURCES | typeof contentTypes.SUBJECT | typeof contentTypes.SOURCE_MATERIAL | typeof contentTypes.LEARNING_PATH | typeof contentTypes.TOPIC | typeof contentTypes.MULTIDISCIPLINARY | typeof contentTypes.CONCEPT | typeof contentTypes.EXTERNAL | typeof contentTypes.IMAGE | typeof contentTypes.AUDIO | typeof contentTypes.VIDEO | typeof contentTypes.MISSING | typeof contentTypes.PODCAST | typeof contentTypes.GLOSS | typeof contentTypes.PROGRAMME | typeof contentTypes.PODCAST_SERIES | typeof contentTypes.FRONTPAGE_ARTICLE;
|
|
14
|
+
export type ContentType = StrictContentType | (string & {});
|
|
15
|
+
export declare const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>;
|
|
16
|
+
export declare const ContentTypeBadge: import("react").ForwardRefExoticComponent<ContentTypeBadgeProps & import("react").RefAttributes<HTMLDivElement>>;
|