@ndla/ui 27.1.6 → 28.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.
Files changed (69) hide show
  1. package/es/Article/ArticleByline.js +38 -7
  2. package/es/Breadcrumb/ActionBreadcrumb.js +5 -4
  3. package/es/Breadcrumb/Breadcrumb.js +12 -4
  4. package/es/Frontpage/FrontpageAllSubjects.js +9 -8
  5. package/es/Resource/BlockResource.js +45 -23
  6. package/es/Resource/ListResource.js +45 -25
  7. package/es/Resource/resourceComponents.js +42 -34
  8. package/es/SearchTypeResult/SearchItem.js +8 -35
  9. package/es/SearchTypeResult/components/ItemResourceHeader.js +5 -5
  10. package/es/locale/messages-en.js +8 -6
  11. package/es/locale/messages-nb.js +20 -18
  12. package/es/locale/messages-nn.js +19 -17
  13. package/es/locale/messages-se.js +97 -95
  14. package/es/locale/messages-sma.js +19 -17
  15. package/es/model/ContentType.js +24 -1
  16. package/es/model/SubjectCategories.js +1 -5
  17. package/es/model/index.js +3 -2
  18. package/es/utils/resourceTypeColor.js +44 -0
  19. package/lib/Article/ArticleByline.d.ts +3 -1
  20. package/lib/Article/ArticleByline.js +38 -7
  21. package/lib/Breadcrumb/ActionBreadcrumb.js +5 -4
  22. package/lib/Breadcrumb/Breadcrumb.js +12 -4
  23. package/lib/Frontpage/FrontpageAllSubjects.js +10 -8
  24. package/lib/Resource/BlockResource.d.ts +6 -2
  25. package/lib/Resource/BlockResource.js +47 -22
  26. package/lib/Resource/ListResource.d.ts +6 -2
  27. package/lib/Resource/ListResource.js +47 -24
  28. package/lib/Resource/resourceComponents.d.ts +11 -4
  29. package/lib/Resource/resourceComponents.js +47 -37
  30. package/lib/SearchTypeResult/SearchItem.d.ts +0 -1
  31. package/lib/SearchTypeResult/SearchItem.js +9 -39
  32. package/lib/SearchTypeResult/components/ItemResourceHeader.js +8 -8
  33. package/lib/locale/messages-en.d.ts +18 -23
  34. package/lib/locale/messages-en.js +8 -6
  35. package/lib/locale/messages-nb.d.ts +18 -23
  36. package/lib/locale/messages-nb.js +20 -18
  37. package/lib/locale/messages-nn.d.ts +18 -23
  38. package/lib/locale/messages-nn.js +19 -17
  39. package/lib/locale/messages-se.d.ts +18 -23
  40. package/lib/locale/messages-se.js +97 -95
  41. package/lib/locale/messages-sma.d.ts +18 -23
  42. package/lib/locale/messages-sma.js +19 -17
  43. package/lib/model/ContentType.d.ts +19 -0
  44. package/lib/model/ContentType.js +34 -2
  45. package/lib/model/SubjectCategories.d.ts +0 -3
  46. package/lib/model/SubjectCategories.js +3 -10
  47. package/lib/model/index.d.ts +12 -2
  48. package/lib/model/index.js +4 -3
  49. package/lib/utils/resourceTypeColor.d.ts +9 -0
  50. package/lib/utils/resourceTypeColor.js +59 -0
  51. package/package.json +7 -7
  52. package/src/Article/ArticleByline.tsx +40 -1
  53. package/src/Breadcrumb/ActionBreadcrumb.tsx +1 -2
  54. package/src/Breadcrumb/Breadcrumb.tsx +15 -6
  55. package/src/Frontpage/FrontpageAllSubjects.tsx +5 -2
  56. package/src/Resource/BlockResource.tsx +33 -15
  57. package/src/Resource/ListResource.tsx +41 -16
  58. package/src/Resource/resourceComponents.tsx +27 -16
  59. package/src/SearchTypeResult/SearchItem.tsx +0 -22
  60. package/src/SearchTypeResult/components/ItemResourceHeader.tsx +3 -1
  61. package/src/locale/messages-en.ts +7 -7
  62. package/src/locale/messages-nb.ts +19 -19
  63. package/src/locale/messages-nn.ts +18 -18
  64. package/src/locale/messages-se.ts +97 -96
  65. package/src/locale/messages-sma.ts +18 -18
  66. package/src/model/ContentType.ts +41 -0
  67. package/src/model/SubjectCategories.ts +0 -5
  68. package/src/model/index.ts +2 -1
  69. package/src/utils/resourceTypeColor.tsx +38 -0
@@ -15,3 +15,44 @@ export const SOURCE_MATERIAL = 'source-material';
15
15
  export const LEARNING_PATH = 'learning-path';
16
16
  export const TOPIC = 'topic';
17
17
  export const MULTIDISCIPLINARY_TOPIC = 'multidisciplinary-topic';
18
+
19
+ export const contentTypes = {
20
+ SUBJECT_MATERIAL,
21
+ TASKS_AND_ACTIVITIES,
22
+ ASSESSMENT_RESOURCES,
23
+ SUBJECT,
24
+ EXTERNAL_LEARNING_RESOURCES,
25
+ SOURCE_MATERIAL,
26
+ LEARNING_PATH,
27
+ TOPIC,
28
+ MULTIDISCIPLINARY_TOPIC,
29
+ };
30
+
31
+ export const RESOURCE_TYPE_LEARNING_PATH = 'urn:resourcetype:learningPath';
32
+ export const RESOURCE_TYPE_SUBJECT_MATERIAL = 'urn:resourcetype:subjectMaterial';
33
+ export const RESOURCE_TYPE_TASKS_AND_ACTIVITIES = 'urn:resourcetype:tasksAndActivities';
34
+ export const RESOURCE_TYPE_ASSESSMENT_RESOURCES = 'urn:resourcetype:reviewResource';
35
+ export const RESOURCE_TYPE_EXTERNAL_LEARNING_RESOURCES = 'urn:resourcetype:externalResource';
36
+ export const RESOURCE_TYPE_SOURCE_MATERIAL = 'urn:resourcetype:SourceMaterial';
37
+
38
+ export const ListOfContentTypes = [
39
+ 'SUBJECT_MATERIAL',
40
+ 'TASKS_AND_ACTIVITIES',
41
+ 'ASSESSMENT_RESOURCES',
42
+ 'SUBJECT',
43
+ 'EXTERNAL_LEARNING_RESOURCES',
44
+ 'SOURCE_MATERIAL',
45
+ 'LEARNING_PATH',
46
+ 'TOPIC',
47
+ 'MULTIDISIPLINARY_TOPIC',
48
+ ];
49
+
50
+ export const contentTypeMapping: Record<string, string> = {
51
+ [RESOURCE_TYPE_LEARNING_PATH]: LEARNING_PATH,
52
+ [RESOURCE_TYPE_SUBJECT_MATERIAL]: SUBJECT_MATERIAL,
53
+ [RESOURCE_TYPE_TASKS_AND_ACTIVITIES]: TASKS_AND_ACTIVITIES,
54
+ [RESOURCE_TYPE_ASSESSMENT_RESOURCES]: ASSESSMENT_RESOURCES,
55
+ [RESOURCE_TYPE_EXTERNAL_LEARNING_RESOURCES]: EXTERNAL_LEARNING_RESOURCES,
56
+ [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,
57
+ default: SUBJECT_MATERIAL,
58
+ };
@@ -9,8 +9,3 @@
9
9
  export const ACTIVE_SUBJECTS = 'active';
10
10
  export const BETA_SUBJECTS = 'beta';
11
11
  export const ARCHIVE_SUBJECTS = 'archive';
12
-
13
- // deprecated
14
- export const COMMON_SUBJECTS = 'common';
15
- export const PROGRAMME_SUBJECTS = 'programme';
16
- export const SPECIALIZED_SUBJECTS = 'specialized';
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import * as contentTypes from './ContentType';
9
+ import { contentTypes, contentTypeMapping } from './ContentType';
10
10
  import * as subjectCategories from './SubjectCategories';
11
11
  import * as subjectTypes from './SubjectTypes';
12
12
 
@@ -14,6 +14,7 @@ const model = {
14
14
  contentTypes,
15
15
  subjectCategories,
16
16
  subjectTypes,
17
+ contentTypeMapping,
17
18
  };
18
19
 
19
20
  export default model;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Copyright (c) 2022-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 { colors } from '@ndla/core';
10
+ import constants from '../model';
11
+ const { contentTypes } = constants;
12
+
13
+ export const resourceTypeColor = (type: string) => {
14
+ switch (type) {
15
+ case contentTypes.SUBJECT_MATERIAL:
16
+ return colors.subjectMaterial.light;
17
+ case contentTypes.SUBJECT:
18
+ return colors.subject.light;
19
+ case contentTypes.TOPIC:
20
+ return colors.subject.light;
21
+ case contentTypes.TASKS_AND_ACTIVITIES:
22
+ return colors.tasksAndActivities.light;
23
+ case contentTypes.ASSESSMENT_RESOURCES:
24
+ return colors.assessmentResource.light;
25
+ case contentTypes.EXTERNAL_LEARNING_RESOURCES:
26
+ return colors.externalLearningResource.light;
27
+ case contentTypes.SOURCE_MATERIAL:
28
+ return colors.sourceMaterial.light;
29
+ case contentTypes.LEARNING_PATH:
30
+ return colors.learningPath.light;
31
+ case contentTypes.MULTIDISCIPLINARY_TOPIC:
32
+ return colors.learningPath.background;
33
+ default:
34
+ return '';
35
+ }
36
+ };
37
+
38
+ export default resourceTypeColor;