@ndla/ui 56.0.71-alpha.0 → 56.0.73-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.
Files changed (98) hide show
  1. package/dist/panda.buildinfo.json +4 -15
  2. package/dist/styles.css +16 -57
  3. package/es/Article/Article.js +1 -2
  4. package/es/Article/ArticleByline.js +19 -30
  5. package/es/AudioPlayer/AudioPlayer.js +2 -2
  6. package/es/AudioPlayer/Controls.js +3 -1
  7. package/es/Concept/Concept.js +1 -1
  8. package/es/ContactBlock/ContactBlock.js +1 -1
  9. package/es/ContentTypeBadge/ContentTypeBadgeNew.js +4 -1
  10. package/es/ContentTypeHero/ContentTypeHero.js +6 -1
  11. package/es/Embed/RelatedContentEmbed.js +3 -3
  12. package/es/ErrorMessage/ErrorMessage.js +8 -8
  13. package/es/Gloss/Gloss.js +4 -4
  14. package/es/KeyFigure/KeyFigure.js +1 -1
  15. package/es/LicenseByline/EmbedByline.js +1 -1
  16. package/es/LinkBlock/LinkBlock.js +1 -1
  17. package/es/i18n/formatNestedMessages.js +0 -2
  18. package/es/index.js +0 -1
  19. package/es/locale/messages-en.js +6 -2
  20. package/es/locale/messages-nb.js +6 -2
  21. package/es/locale/messages-nn.js +6 -2
  22. package/es/locale/messages-se.js +6 -2
  23. package/es/locale/messages-sma.js +6 -2
  24. package/es/model/ContentType.js +9 -2
  25. package/lib/Article/Article.js +1 -2
  26. package/lib/Article/ArticleByline.d.ts +1 -3
  27. package/lib/Article/ArticleByline.js +18 -29
  28. package/lib/AudioPlayer/AudioPlayer.js +2 -2
  29. package/lib/AudioPlayer/Controls.js +3 -1
  30. package/lib/Concept/Concept.js +1 -1
  31. package/lib/ContactBlock/ContactBlock.js +1 -1
  32. package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +1 -1
  33. package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +4 -1
  34. package/lib/ContentTypeHero/ContentTypeHero.js +6 -1
  35. package/lib/Embed/RelatedContentEmbed.d.ts +1 -1
  36. package/lib/Embed/RelatedContentEmbed.js +2 -2
  37. package/lib/ErrorMessage/ErrorMessage.js +8 -8
  38. package/lib/Gloss/Gloss.js +4 -4
  39. package/lib/KeyFigure/KeyFigure.js +1 -1
  40. package/lib/LicenseByline/EmbedByline.js +1 -1
  41. package/lib/LinkBlock/LinkBlock.js +1 -1
  42. package/lib/TagSelector/TagSelector.d.ts +1 -1
  43. package/lib/i18n/formatNestedMessages.js +0 -2
  44. package/lib/index.d.ts +0 -1
  45. package/lib/index.js +0 -13
  46. package/lib/locale/messages-en.d.ts +4 -0
  47. package/lib/locale/messages-en.js +6 -2
  48. package/lib/locale/messages-nb.d.ts +4 -0
  49. package/lib/locale/messages-nb.js +6 -2
  50. package/lib/locale/messages-nn.d.ts +4 -0
  51. package/lib/locale/messages-nn.js +6 -2
  52. package/lib/locale/messages-se.d.ts +4 -0
  53. package/lib/locale/messages-se.js +6 -2
  54. package/lib/locale/messages-sma.d.ts +4 -0
  55. package/lib/locale/messages-sma.js +6 -2
  56. package/lib/model/ContentType.d.ts +5 -0
  57. package/lib/model/ContentType.js +10 -3
  58. package/lib/model/index.d.ts +2 -0
  59. package/package.json +8 -8
  60. package/src/Article/Article.tsx +1 -2
  61. package/src/Article/ArticleByline.stories.tsx +0 -3
  62. package/src/Article/ArticleByline.tsx +17 -32
  63. package/src/AudioPlayer/AudioPlayer.tsx +2 -2
  64. package/src/AudioPlayer/Controls.tsx +2 -0
  65. package/src/Concept/Concept.tsx +1 -1
  66. package/src/ContactBlock/ContactBlock.tsx +1 -1
  67. package/src/ContentTypeBadge/ContentTypeBadge.stories.tsx +3 -0
  68. package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +7 -1
  69. package/src/ContentTypeHero/ContentTypeHero.tsx +5 -0
  70. package/src/Embed/RelatedContentEmbed.tsx +2 -2
  71. package/src/ErrorMessage/ErrorMessage.stories.tsx +1 -1
  72. package/src/ErrorMessage/ErrorMessage.tsx +8 -8
  73. package/src/Gloss/Gloss.tsx +4 -4
  74. package/src/Grid/Grid.stories.tsx +3 -0
  75. package/src/KeyFigure/KeyFigure.tsx +1 -1
  76. package/src/LicenseByline/EmbedByline.tsx +2 -2
  77. package/src/LinkBlock/LinkBlock.tsx +1 -1
  78. package/src/TagSelector/TagSelector.tsx +1 -2
  79. package/src/i18n/formatNestedMessages.ts +0 -1
  80. package/src/index.ts +0 -2
  81. package/src/locale/messages-en.ts +4 -0
  82. package/src/locale/messages-nb.ts +4 -0
  83. package/src/locale/messages-nn.ts +4 -0
  84. package/src/locale/messages-se.ts +4 -0
  85. package/src/locale/messages-sma.ts +4 -0
  86. package/src/model/ContentType.ts +7 -0
  87. package/es/Layout/OneColumn.js +0 -43
  88. package/es/Layout/PageContainer.js +0 -32
  89. package/es/Layout/index.js +0 -10
  90. package/lib/Layout/OneColumn.d.ts +0 -11
  91. package/lib/Layout/OneColumn.js +0 -48
  92. package/lib/Layout/PageContainer.d.ts +0 -11
  93. package/lib/Layout/PageContainer.js +0 -37
  94. package/lib/Layout/index.d.ts +0 -9
  95. package/lib/Layout/index.js +0 -20
  96. package/src/Layout/OneColumn.tsx +0 -44
  97. package/src/Layout/PageContainer.tsx +0 -33
  98. package/src/Layout/index.ts +0 -10
@@ -552,7 +552,8 @@ const messages = {
552
552
  aboutNdla: "About NDLA",
553
553
  blog: "Faageblogge",
554
554
  tips: "Tipsh learoehkidie",
555
- vacancies: "Gaavnoes barkoeh"
555
+ vacancies: "Gaavnoes barkoeh",
556
+ contact: "Kontakt oss"
556
557
  },
557
558
  otherLanguages: "Andre språk"
558
559
  },
@@ -576,7 +577,10 @@ const messages = {
576
577
  h5p: "H5P",
577
578
  video: "Video",
578
579
  missing: "Ukjent",
579
- external: "Ekstern"
580
+ external: "Ekstern",
581
+ gloss: "Glose",
582
+ programme: "Programfag",
583
+ "podcast-series": "Podkast-serie"
580
584
  },
581
585
  modal: {
582
586
  closeModal: "Dahph"
@@ -20,6 +20,9 @@ export declare const IMAGE = "image";
20
20
  export declare const VIDEO = "video";
21
21
  export declare const AUDIO = "audio";
22
22
  export declare const PODCAST = "podcast";
23
+ export declare const GLOSS = "gloss";
24
+ export declare const PROGRAMME = "programme";
25
+ export declare const PODCAST_SERIES = "podcast-series";
23
26
  export declare const contentTypes: {
24
27
  SUBJECT_MATERIAL: string;
25
28
  TASKS_AND_ACTIVITIES: string;
@@ -32,6 +35,8 @@ export declare const contentTypes: {
32
35
  CONCEPT: string;
33
36
  EXTERNAL: string;
34
37
  MISSING: string;
38
+ PROGRAMME: string;
39
+ PODCAST_SERIES: string;
35
40
  };
36
41
  export declare const RESOURCE_TYPE_LEARNING_PATH = "urn:resourcetype:learningPath";
37
42
  export declare const RESOURCE_TYPE_SUBJECT_MATERIAL = "urn:resourcetype:subjectMaterial";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.resourceEmbedTypeMapping = exports.contentTypes = exports.contentTypeMapping = exports.VIDEO = exports.TOPIC = exports.TASKS_AND_ACTIVITIES = exports.SUBJECT_MATERIAL = exports.SUBJECT = exports.SOURCE_MATERIAL = exports.RESOURCE_TYPE_TASKS_AND_ACTIVITIES = exports.RESOURCE_TYPE_SUBJECT_MATERIAL = exports.RESOURCE_TYPE_SOURCE_MATERIAL = exports.RESOURCE_TYPE_LEARNING_PATH = exports.RESOURCE_TYPE_CONCEPT = exports.RESOURCE_TYPE_ASSESSMENT_RESOURCES = exports.PODCAST = exports.MULTIDISCIPLINARY = exports.MISSING = exports.LEARNING_PATH = exports.IMAGE = exports.EXTERNAL = exports.CONCEPT = exports.AUDIO = exports.ASSESSMENT_RESOURCES = void 0;
6
+ exports.resourceEmbedTypeMapping = exports.contentTypes = exports.contentTypeMapping = exports.VIDEO = exports.TOPIC = exports.TASKS_AND_ACTIVITIES = exports.SUBJECT_MATERIAL = exports.SUBJECT = exports.SOURCE_MATERIAL = exports.RESOURCE_TYPE_TASKS_AND_ACTIVITIES = exports.RESOURCE_TYPE_SUBJECT_MATERIAL = exports.RESOURCE_TYPE_SOURCE_MATERIAL = exports.RESOURCE_TYPE_LEARNING_PATH = exports.RESOURCE_TYPE_CONCEPT = exports.RESOURCE_TYPE_ASSESSMENT_RESOURCES = exports.PROGRAMME = exports.PODCAST_SERIES = exports.PODCAST = exports.MULTIDISCIPLINARY = exports.MISSING = exports.LEARNING_PATH = exports.IMAGE = exports.GLOSS = exports.EXTERNAL = exports.CONCEPT = exports.AUDIO = exports.ASSESSMENT_RESOURCES = void 0;
7
7
  /**
8
8
  * Copyright (c) 2017-present, NDLA.
9
9
  *
@@ -27,6 +27,9 @@ const IMAGE = exports.IMAGE = "image";
27
27
  const VIDEO = exports.VIDEO = "video";
28
28
  const AUDIO = exports.AUDIO = "audio";
29
29
  const PODCAST = exports.PODCAST = "podcast";
30
+ const GLOSS = exports.GLOSS = "gloss";
31
+ const PROGRAMME = exports.PROGRAMME = "programme";
32
+ const PODCAST_SERIES = exports.PODCAST_SERIES = "podcast-series";
30
33
  const contentTypes = exports.contentTypes = {
31
34
  SUBJECT_MATERIAL,
32
35
  TASKS_AND_ACTIVITIES,
@@ -38,7 +41,9 @@ const contentTypes = exports.contentTypes = {
38
41
  MULTIDISCIPLINARY,
39
42
  CONCEPT,
40
43
  EXTERNAL,
41
- MISSING
44
+ MISSING,
45
+ PROGRAMME,
46
+ PODCAST_SERIES
42
47
  };
43
48
  const RESOURCE_TYPE_LEARNING_PATH = exports.RESOURCE_TYPE_LEARNING_PATH = "urn:resourcetype:learningPath";
44
49
  const RESOURCE_TYPE_SUBJECT_MATERIAL = exports.RESOURCE_TYPE_SUBJECT_MATERIAL = "urn:resourcetype:subjectMaterial";
@@ -54,6 +59,7 @@ const contentTypeMapping = exports.contentTypeMapping = {
54
59
  [RESOURCE_TYPE_SOURCE_MATERIAL]: SOURCE_MATERIAL,
55
60
  [RESOURCE_TYPE_CONCEPT]: CONCEPT,
56
61
  [MULTIDISCIPLINARY]: MULTIDISCIPLINARY,
62
+ [TOPIC]: TOPIC,
57
63
  default: SUBJECT_MATERIAL
58
64
  };
59
65
  const resourceEmbedTypeMapping = exports.resourceEmbedTypeMapping = {
@@ -61,5 +67,6 @@ const resourceEmbedTypeMapping = exports.resourceEmbedTypeMapping = {
61
67
  video: "video",
62
68
  concept: "concept",
63
69
  audio: "audio",
64
- podcast: "podcast"
70
+ podcast: "podcast",
71
+ gloss: "gloss"
65
72
  };
@@ -21,6 +21,8 @@ declare const model: {
21
21
  CONCEPT: string;
22
22
  EXTERNAL: string;
23
23
  MISSING: string;
24
+ PROGRAMME: string;
25
+ PODCAST_SERIES: string;
24
26
  };
25
27
  subjectCategories: typeof subjectCategories;
26
28
  subjectTypes: typeof subjectTypes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.71-alpha.0",
3
+ "version": "56.0.73-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -33,12 +33,12 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ndla/core": "^5.0.2",
36
- "@ndla/icons": "^8.0.43-alpha.0",
37
- "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.55-alpha.0",
39
- "@ndla/safelink": "^7.0.56-alpha.0",
36
+ "@ndla/icons": "^8.0.44-alpha.0",
37
+ "@ndla/licenses": "^8.0.4-alpha.0",
38
+ "@ndla/primitives": "^1.0.57-alpha.0",
39
+ "@ndla/safelink": "^7.0.58-alpha.0",
40
40
  "@ndla/styled-system": "^0.0.27",
41
- "@ndla/util": "^5.0.0-alpha.0",
41
+ "@ndla/util": "^5.0.1-alpha.0",
42
42
  "html-react-parser": "^5.1.8",
43
43
  "i18next-browser-languagedetector": "^7.1.0"
44
44
  },
@@ -50,7 +50,7 @@
50
50
  "react-router-dom": "> 6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@ndla/preset-panda": "^0.0.44",
53
+ "@ndla/preset-panda": "^0.0.45",
54
54
  "@ndla/types-backend": "^0.2.86",
55
55
  "@ndla/types-embed": "^5.0.4-alpha.0",
56
56
  "@pandacss/dev": "^0.46.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "428dc6978a13bfff19a02020ecdbb69ce5e3fb5e"
61
+ "gitHead": "3f2d720f26b163be90b396f40f3c1fad746b3cf9"
62
62
  }
@@ -12,8 +12,8 @@ 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
14
  import { JsxStyleProps } from "@ndla/styled-system/types";
15
- import { ArticleByline } from "./ArticleByline";
16
15
  import { ContentTypeBadgeNew } from "..";
16
+ import { ArticleByline } from "./ArticleByline";
17
17
  import { ContentType } from "../ContentTypeBadge/ContentTypeBadgeNew";
18
18
  import { Article as ArticleType } from "../types";
19
19
 
@@ -200,7 +200,6 @@ export const Article = ({
200
200
  authors={authors}
201
201
  suppliers={copyright?.rightsholders}
202
202
  published={published}
203
- license={copyright?.license?.license ?? ""}
204
203
  licenseBox={licenseBox}
205
204
  />
206
205
  {children}
@@ -23,7 +23,6 @@ export default {
23
23
  args: {
24
24
  authors: [{ name: "Frida Forfatter" }, { name: "Fred Forfatter" }],
25
25
  published: "21.06.2018",
26
- license: "CC BY-SA",
27
26
  },
28
27
  } as Meta<typeof ArticleByline>;
29
28
 
@@ -36,7 +35,6 @@ ArticleBylineStory.storyName = "ArticleByline";
36
35
  export const SeveralAuthors: StoryObj<typeof ArticleByline> = {
37
36
  args: {
38
37
  published: "21.06.2018",
39
- license: "CC BY-SA",
40
38
  authors: [{ name: "Frida Forfatter" }, { name: "Ida Illustratør" }, { name: "Fred Forfatter" }],
41
39
  },
42
40
  };
@@ -44,7 +42,6 @@ export const SeveralAuthors: StoryObj<typeof ArticleByline> = {
44
42
  export const WithoutCreators: StoryObj<typeof ArticleByline> = {
45
43
  args: {
46
44
  published: "21.06.2018",
47
- license: "CC BY-SA",
48
45
  authors: [],
49
46
  },
50
47
  };
@@ -11,7 +11,6 @@ import { ReactNode, forwardRef, useCallback, useEffect, useState } from "react";
11
11
  import { useTranslation } from "react-i18next";
12
12
  import { useLocation } from "react-router-dom";
13
13
  import { ArrowDownShortLine } from "@ndla/icons/common";
14
- import { getLicenseByAbbreviation } from "@ndla/licenses";
15
14
  import {
16
15
  AccordionItem,
17
16
  AccordionItemContent,
@@ -23,7 +22,6 @@ import {
23
22
  } from "@ndla/primitives";
24
23
  import { styled } from "@ndla/styled-system/jsx";
25
24
  import { ArticleFootNotes } from "./ArticleFootNotes";
26
- import { LicenseLink } from "../LicenseByline/LicenseLink";
27
25
  import { FootNote } from "../types";
28
26
 
29
27
  const Wrapper = styled("div", {
@@ -39,12 +37,15 @@ const Wrapper = styled("div", {
39
37
  const TextWrapper = styled("div", {
40
38
  base: {
41
39
  display: "flex",
42
- flexDirection: "column-reverse",
40
+ flexDirection: "column",
43
41
  gap: "3xsmall",
44
42
  width: "100%",
45
43
  justifyContent: "space-between",
46
44
  paddingBlock: "xsmall",
47
45
  textStyle: "body.medium",
46
+ '& [data-contributors="false"]': {
47
+ marginInlineStart: "auto",
48
+ },
48
49
  },
49
50
  variants: {
50
51
  learningpath: {
@@ -70,9 +71,7 @@ type Props = {
70
71
  authors?: AuthorProps[];
71
72
  suppliers?: SupplierProps[];
72
73
  published?: string;
73
- license?: string;
74
74
  licenseBox?: ReactNode;
75
- locale?: string;
76
75
  footnotes?: FootNote[];
77
76
  displayByline?: boolean;
78
77
  bylineType?: "article" | "learningPath";
@@ -102,13 +101,6 @@ const getSuppliersText = (suppliers: SupplierProps[], t: TFunction) => {
102
101
  });
103
102
  };
104
103
 
105
- const LicenseWrapper = styled("div", {
106
- base: {
107
- display: "flex",
108
- gap: "xsmall",
109
- },
110
- });
111
-
112
104
  const StyledAccordionRoot = styled(AccordionRoot, {
113
105
  base: {
114
106
  paddingBlockStart: "xxlarge",
@@ -122,10 +114,8 @@ export const ArticleByline = ({
122
114
  authors = [],
123
115
  suppliers = [],
124
116
  footnotes,
125
- license: licenseString,
126
117
  licenseBox,
127
118
  published,
128
- locale,
129
119
  displayByline = true,
130
120
  bylineType = "article",
131
121
  }: Props) => {
@@ -156,29 +146,24 @@ export const ArticleByline = ({
156
146
  return () => window.removeEventListener("hashchange", onHashChange);
157
147
  }, [onHashChange]);
158
148
 
159
- const license = licenseString && getLicenseByAbbreviation(licenseString, locale);
160
-
161
149
  const showPrimaryContributors = suppliers.length > 0 || authors.length > 0;
162
150
 
163
151
  return (
164
152
  <Wrapper>
165
- {displayByline && (
153
+ {!!displayByline && (
166
154
  <TextWrapper learningpath={bylineType === "learningPath"}>
167
- <LicenseWrapper>
168
- {license && <LicenseLink license={license} />}
169
- {showPrimaryContributors && (
170
- //eslint-disable-next-line react/no-unknown-property
171
- <span property="cc:attributionName">
172
- {authors.length > 0 &&
173
- `${t("article.authorsLabel", {
174
- names: renderContributors(authors, t),
175
- interpolation: { escapeValue: false },
176
- })}. `}
177
- {getSuppliersText(suppliers, t)}
178
- </span>
179
- )}
180
- </LicenseWrapper>
181
- <div>
155
+ {!!showPrimaryContributors && (
156
+ //eslint-disable-next-line react/no-unknown-property
157
+ <span property="cc:attributionName">
158
+ {authors.length > 0 &&
159
+ `${t("article.authorsLabel", {
160
+ names: renderContributors(authors, t),
161
+ interpolation: { escapeValue: false },
162
+ })}. `}
163
+ {getSuppliersText(suppliers, t)}
164
+ </span>
165
+ )}
166
+ <div data-contributors={showPrimaryContributors}>
182
167
  {t(`${bylineType}.lastUpdated`)} {published}
183
168
  </div>
184
169
  </TextWrapper>
@@ -185,7 +185,7 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
185
185
  return (
186
186
  <AudioPlayerWrapper>
187
187
  <InfoWrapper>
188
- {img && (
188
+ {!!img && (
189
189
  <ImageWrapper>
190
190
  <img src={img.url} alt={img.alt} />
191
191
  </ImageWrapper>
@@ -200,7 +200,7 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
200
200
  </div>
201
201
  {!!textVersion && !img && textVersionButton}
202
202
  </TitleWrapper>
203
- {description && (
203
+ {!!description && (
204
204
  <Text textStyle="body.medium">
205
205
  {showFullDescription || description.length < DESCRIPTION_MAX_LENGTH
206
206
  ? description
@@ -101,6 +101,8 @@ const ProgressWrapper = styled("div", {
101
101
  const StyledText = styled(Text, {
102
102
  base: {
103
103
  minWidth: "xxlarge",
104
+ flexShrink: "0",
105
+ textAlign: "center",
104
106
  },
105
107
  });
106
108
 
@@ -69,7 +69,7 @@ export const Concept = forwardRef<HTMLElement, ConceptProps>(
69
69
  ) : visualElement?.resource === "external" ? (
70
70
  <ExternalEmbed embed={visualElement} />
71
71
  ) : null}
72
- {copyright && <EmbedByline copyright={copyright} type="concept" />}
72
+ {!!copyright && <EmbedByline copyright={copyright} type="concept" />}
73
73
  </StyledFigure>
74
74
  );
75
75
  },
@@ -180,7 +180,7 @@ export const ContactBlock = ({
180
180
  </HeaderWrapper>
181
181
  <StyledDescription textStyle="body.large">{description}</StyledDescription>
182
182
  </ContentWrapper>
183
- {image && (
183
+ {!!image && (
184
184
  <ImageWrapper variant={backgroundColor}>
185
185
  <StyledImage
186
186
  alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}
@@ -76,5 +76,8 @@ export const AllBadges: StoryFn<typeof ContentTypeBadge> = ({ ...args }) => (
76
76
  <ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.image} />
77
77
  <ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.audio} />
78
78
  <ContentTypeBadge {...args} type={contentTypes.resourceEmbedTypeMapping.video} />
79
+ <ContentTypeBadge {...args} type={contentTypes.GLOSS} />
80
+ <ContentTypeBadge {...args} type={contentTypes.PROGRAMME} />
81
+ <ContentTypeBadge {...args} type={contentTypes.PODCAST_SERIES} />
79
82
  </BadgesWrapper>
80
83
  );
@@ -30,7 +30,10 @@ export type StrictContentType =
30
30
  | typeof contentTypes.AUDIO
31
31
  | typeof contentTypes.VIDEO
32
32
  | typeof contentTypes.MISSING
33
- | typeof contentTypes.PODCAST;
33
+ | typeof contentTypes.PODCAST
34
+ | typeof contentTypes.GLOSS
35
+ | typeof contentTypes.PROGRAMME
36
+ | typeof contentTypes.PODCAST_SERIES;
34
37
 
35
38
  export type ContentType =
36
39
  | StrictContentType
@@ -53,6 +56,9 @@ export const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {
53
56
  [contentTypes.PODCAST]: "brand1",
54
57
  [contentTypes.VIDEO]: "brand1",
55
58
  [contentTypes.MISSING]: "neutral",
59
+ [contentTypes.PODCAST_SERIES]: "brand1",
60
+ [contentTypes.GLOSS]: "brand1",
61
+ [contentTypes.PROGRAMME]: "neutral",
56
62
  };
57
63
 
58
64
  export const ContentTypeBadge = forwardRef<HTMLDivElement, ContentTypeBadgeProps>(
@@ -29,6 +29,11 @@ export const contentTypeToHeroMap: Record<ContentType, HeroVariant> = {
29
29
  [contentTypes.PODCAST]: "primary",
30
30
  [contentTypes.VIDEO]: "primary",
31
31
  [contentTypes.MISSING]: "neutral",
32
+ [contentTypes.GLOSS]: "brand1Moderate",
33
+ // this will never happen
34
+ [contentTypes.PROGRAMME]: "primary",
35
+ // this will never happen
36
+ [contentTypes.PODCAST_SERIES]: "primary",
32
37
  };
33
38
 
34
39
  export interface ContentTypeHeroProps extends HeroProps {
@@ -21,7 +21,7 @@ interface Props {
21
21
  const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: Props) => {
22
22
  const { t } = useTranslation();
23
23
  if (embed.status === "error") {
24
- return <></>;
24
+ return null;
25
25
  }
26
26
 
27
27
  const { data, embedData } = embed;
@@ -55,7 +55,7 @@ const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: P
55
55
  />
56
56
  );
57
57
  }
58
- return <></>;
58
+ return null;
59
59
  };
60
60
 
61
61
  export default RelatedContentEmbed;
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { Meta, StoryFn, StoryObj } from "@storybook/react";
10
10
  import ErrorMessage from "./ErrorMessage";
11
- //@ts-ignore
11
+ // @ts-expect-error - It exists.
12
12
  import Oops from "../../../../images/oops.gif";
13
13
 
14
14
  /**
@@ -76,27 +76,27 @@ interface Props {
76
76
  }
77
77
  export const ErrorMessage = ({ children, messages, illustration, illustrationElement, customElement }: Props) => (
78
78
  <StyledErrorMessage>
79
- {illustration && (
79
+ {!!illustration && (
80
80
  <IllustrationWrapper>
81
81
  <img src={illustration.url} alt={illustration.altText} />
82
82
  </IllustrationWrapper>
83
83
  )}
84
- {illustrationElement && <IllustrationWrapper>{illustrationElement}</IllustrationWrapper>}
84
+ {!!illustrationElement && <IllustrationWrapper>{illustrationElement}</IllustrationWrapper>}
85
85
  <h1>{messages.title}</h1>
86
- {messages.description && <Description>{messages.description}</Description>}
87
- {customElement && <CustomElementWrapper>{customElement}</CustomElementWrapper>}
88
- {messages.linksTitle && <h2>{messages.linksTitle}</h2>}
89
- {messages.back && (
86
+ {!!messages.description && <Description>{messages.description}</Description>}
87
+ {!!customElement && <CustomElementWrapper>{customElement}</CustomElementWrapper>}
88
+ {!!messages.linksTitle && <h2>{messages.linksTitle}</h2>}
89
+ {!!messages.back && (
90
90
  <SafeLink to={`/#${encodeURI(messages.back)}`} onClick={() => window.history.back()}>
91
91
  {messages.back}
92
92
  </SafeLink>
93
93
  )}
94
- {messages.goToFrontPage && (
94
+ {!!messages.goToFrontPage && (
95
95
  <MessageWrapper>
96
96
  <SafeLink to="/">{messages.goToFrontPage}</SafeLink>
97
97
  </MessageWrapper>
98
98
  )}
99
- {messages.logInFailed && (
99
+ {!!messages.logInFailed && (
100
100
  <MessageWrapper>
101
101
  <SafeLink to="/minndla">{messages.logInFailed}</SafeLink>
102
102
  </MessageWrapper>
@@ -131,7 +131,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }: P
131
131
  <Text textStyle="label.medium" fontWeight="bold" asChild consumeCss lang={glossData.originalLanguage}>
132
132
  <span>{glossData.gloss}</span>
133
133
  </Text>
134
- {glossData.transcriptions.traditional && (
134
+ {!!glossData.transcriptions.traditional && (
135
135
  <Text textStyle="label.medium" asChild consumeCss>
136
136
  <span
137
137
  key={t("gloss.transcriptions.traditional")}
@@ -142,7 +142,7 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }: P
142
142
  </span>
143
143
  </Text>
144
144
  )}
145
- {glossData.transcriptions.pinyin && (
145
+ {!!glossData.transcriptions.pinyin && (
146
146
  <Text textStyle="label.medium" asChild consumeCss>
147
147
  <span
148
148
  data-pinyin=""
@@ -154,13 +154,13 @@ const Gloss = ({ title, glossData, audio, exampleIds, exampleLangs, variant }: P
154
154
  </span>
155
155
  </Text>
156
156
  )}
157
- {glossData.wordClass && (
157
+ {!!glossData.wordClass && (
158
158
  <Text textStyle="label.medium" asChild consumeCss>
159
159
  <span aria-label={t("gloss.wordClass")}>{t(`wordClass.${glossData.wordClass}`).toLowerCase()}</span>
160
160
  </Text>
161
161
  )}
162
162
  </TextWrapper>
163
- {audio?.src && <SpeechControl src={audio.src} title={audio.title} type="gloss" />}
163
+ {!!audio?.src && <SpeechControl src={audio.src} title={audio.title} type="gloss" />}
164
164
  </Container>
165
165
  <StyledContainer>
166
166
  <Text textStyle="label.medium" asChild consumeCss>
@@ -64,8 +64,11 @@ export const GridPitchStory: StoryFn<typeof Grid> = ({ ...args }) => {
64
64
  const items = new Array(columns).fill(
65
65
  <div data-type="grid-cell" data-parallax-cell="false">
66
66
  <PitchStory
67
+ // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
67
68
  metaImage={PitchStory.args?.metaImage!}
69
+ // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
68
70
  title={PitchStory.args?.title!}
71
+ // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
69
72
  url={PitchStory.args?.url!}
70
73
  description={PitchStory.args?.description}
71
74
  />
@@ -57,7 +57,7 @@ interface Props {
57
57
  const KeyFigure = ({ image, title, subtitle }: Props) => {
58
58
  return (
59
59
  <ContentWrapper data-embed-type="key-figure">
60
- {image && <StyledImage src={`${image?.src}?width=150`} width={150} height={150} alt={image?.alt} />}
60
+ {!!image && <StyledImage src={`${image?.src}?width=150`} width={150} height={150} alt={image?.alt} />}
61
61
  <TitleWrapper>{parse(title)}</TitleWrapper>
62
62
  <SubTitleWrapper>{parse(subtitle)}</SubTitleWrapper>
63
63
  </ContentWrapper>
@@ -141,7 +141,7 @@ export const EmbedByline = ({ type, description, children, visibleAlt, hideCopyr
141
141
  {!hideByline && (
142
142
  <BylineWrapper>
143
143
  <div>
144
- {hideCopyright && description}
144
+ {!!hideCopyright && description}
145
145
  {!hideCopyright && (
146
146
  <LicenseContainerContent type={type} copyright={copyright}>
147
147
  {description}
@@ -209,7 +209,7 @@ const StyledButton = styled(Button, {
209
209
 
210
210
  interface LicenseDescriptionProps {
211
211
  children?: ReactNode;
212
- isOpen: Boolean;
212
+ isOpen: boolean;
213
213
  setIsOpen: Dispatch<SetStateAction<boolean>>;
214
214
  }
215
215
 
@@ -90,7 +90,7 @@ const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {
90
90
  <Heading asChild consumeCss textStyle="title.medium">
91
91
  <h3 data-heading>{parse(title)}</h3>
92
92
  </Heading>
93
- {date && (
93
+ {!!date && (
94
94
  <StyledDateContainer>
95
95
  <StyledCalendarEd />
96
96
  {formattedDate}
@@ -7,8 +7,7 @@
7
7
  */
8
8
 
9
9
  import { forwardRef, useEffect, useId, useRef } from "react";
10
- import type { CollectionItem } from "@ark-ui/react";
11
- import { useTagsInputContext, useComboboxContext } from "@ark-ui/react";
10
+ import { type CollectionItem, useTagsInputContext, useComboboxContext } from "@ark-ui/react";
12
11
  import { CloseLine } from "@ndla/icons/action";
13
12
  import {
14
13
  ComboboxClearTrigger,
@@ -21,7 +21,6 @@ export const formatNestedMessages = (
21
21
  ) => {
22
22
  const messages = formattedMessages;
23
23
 
24
- // eslint-disable-next-line
25
24
  Object.keys(phrases).forEach((key) => {
26
25
  const value = phrases[key];
27
26
  if ({}.hasOwnProperty.call(phrases, key)) {
package/src/index.ts CHANGED
@@ -94,8 +94,6 @@ export {
94
94
  useVideoSearchTranslations,
95
95
  } from "./i18n";
96
96
 
97
- export { OneColumn, PageContainer } from "./Layout";
98
-
99
97
  export {
100
98
  default as ContentTypeBadge,
101
99
  SubjectMaterialBadge,
@@ -556,6 +556,7 @@ const messages = {
556
556
  blog: "Blog",
557
557
  tips: "Tips to students",
558
558
  vacancies: "Vacancies",
559
+ contact: "Contact us",
559
560
  },
560
561
  otherLanguages: "Other languages",
561
562
  },
@@ -580,6 +581,9 @@ const messages = {
580
581
  video: "Video",
581
582
  missing: "Unknown",
582
583
  external: "External",
584
+ gloss: "Gloss",
585
+ programme: "Programme",
586
+ "podcast-series": "Podcast series",
583
587
  },
584
588
  modal: {
585
589
  closeModal: "Close",
@@ -557,6 +557,7 @@ const messages = {
557
557
  blog: "Fagblogg",
558
558
  tips: "Tips til elever",
559
559
  vacancies: "Ledige stillinger",
560
+ contact: "Kontakt oss",
560
561
  },
561
562
  otherLanguages: "Andre språk",
562
563
  },
@@ -581,6 +582,9 @@ const messages = {
581
582
  video: "Video",
582
583
  missing: "Ukjent",
583
584
  external: "Ekstern",
585
+ gloss: "Glose",
586
+ programme: "Programfag",
587
+ "podcast-series": "Podkast-serie",
584
588
  },
585
589
  modal: {
586
590
  closeModal: "Lukk",
@@ -557,6 +557,7 @@ const messages = {
557
557
  blog: "Fagblogg",
558
558
  tips: "Tips til elevar",
559
559
  vacancies: "Ledige stillingar",
560
+ contact: "Kontakt oss",
560
561
  },
561
562
  otherLanguages: "Andre språk",
562
563
  },
@@ -581,6 +582,9 @@ const messages = {
581
582
  video: "Video",
582
583
  missing: "Ukjent",
583
584
  external: "Ekstern",
585
+ gloss: "Glose",
586
+ programme: "Programfag",
587
+ "podcast-series": "Podkast-serie",
584
588
  },
585
589
  modal: {
586
590
  closeModal: "Lukk",
@@ -558,6 +558,7 @@ const messages = {
558
558
  blog: "Fágablogga",
559
559
  tips: "Cavgileapmi ohppiide",
560
560
  vacancies: "Rabas virggit",
561
+ contact: "Kontakt oss",
561
562
  },
562
563
  otherLanguages: "Andre språk",
563
564
  },
@@ -582,6 +583,9 @@ const messages = {
582
583
  video: "Video",
583
584
  missing: "Ukjent",
584
585
  external: "Ekstern",
586
+ gloss: "Glose",
587
+ programme: "Programfag",
588
+ "podcast-series": "Podkast-serie",
585
589
  },
586
590
  modal: {
587
591
  closeModal: "Govčča",