@ndla/ui 55.0.15-alpha.0 → 55.0.17-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 (324) hide show
  1. package/dist/panda.buildinfo.json +125 -29
  2. package/dist/styles.css +453 -103
  3. package/es/Article/Article.js +101 -162
  4. package/es/Article/ArticleByline.js +89 -56
  5. package/es/Article/ArticleFootNotes.js +35 -23
  6. package/es/Article/ArticleParagraph.js +2 -2
  7. package/es/Article/index.js +3 -5
  8. package/es/AudioPlayer/AudioPlayer.js +20 -20
  9. package/es/AudioPlayer/Controls.js +45 -45
  10. package/es/AudioPlayer/SpeechControl.js +8 -8
  11. package/es/BlogPost/BlogPost.js +6 -6
  12. package/es/Breadcrumb/Breadcrumb.js +19 -29
  13. package/es/Breadcrumb/BreadcrumbItem.js +20 -49
  14. package/es/Breadcrumb/HomeBreadcrumb.js +36 -82
  15. package/es/CampaignBlock/CampaignBlock.js +12 -12
  16. package/es/CodeBlock/CodeBlock.js +2 -2
  17. package/es/Concept/Concept.js +11 -11
  18. package/es/ContactBlock/ContactBlock.js +170 -185
  19. package/es/ContactBlock/index.js +3 -3
  20. package/es/ContentLoader/index.js +12 -12
  21. package/es/ContentPlaceholder/ContentPlaceholder.js +3 -3
  22. package/es/ContentTypeBadge/ContentTypeBadge.js +81 -80
  23. package/es/ContentTypeBadge/ContentTypeBadgeNew.js +3 -2
  24. package/es/ContentTypeHero/ContentTypeHero.js +50 -0
  25. package/es/{Logo → ContentTypeHero}/index.js +2 -3
  26. package/es/CopyParagraphButton/CopyParagraphButton.js +13 -12
  27. package/es/Embed/AudioEmbed.js +7 -7
  28. package/es/Embed/BrightcoveEmbed.js +8 -8
  29. package/es/Embed/CodeEmbed.js +6 -6
  30. package/es/Embed/ConceptEmbed.js +13 -13
  31. package/es/Embed/ConceptListEmbed.js +9 -9
  32. package/es/Embed/ContentLinkEmbed.js +6 -6
  33. package/es/Embed/CopyrightEmbed.js +3 -3
  34. package/es/Embed/EmbedErrorPlaceholder.js +5 -5
  35. package/es/Embed/ExternalEmbed.js +5 -5
  36. package/es/Embed/FootnoteEmbed.js +5 -5
  37. package/es/Embed/GlossEmbed.js +11 -11
  38. package/es/Embed/H5pEmbed.js +5 -5
  39. package/es/Embed/IframeEmbed.js +6 -6
  40. package/es/Embed/ImageEmbed.js +10 -10
  41. package/es/Embed/InlineTriggerButton.js +2 -2
  42. package/es/Embed/RelatedContentEmbed.js +5 -5
  43. package/es/Embed/UnknownEmbed.js +3 -3
  44. package/es/Embed/UuDisclaimerEmbed.js +6 -6
  45. package/es/ErrorMessage/ErrorMessage.js +14 -14
  46. package/es/ErrorMessage/ErrorResourceAccessDenied.js +6 -6
  47. package/es/FactBox/FactBox.js +5 -5
  48. package/es/FileList/File.js +3 -3
  49. package/es/FileList/FileList.js +6 -6
  50. package/es/FileList/Format.js +6 -6
  51. package/es/FileList/PdfFile.js +5 -5
  52. package/es/FrontpageArticle/FrontpageArticle.js +7 -8
  53. package/es/Gloss/Gloss.js +23 -23
  54. package/es/Gloss/GlossExample.js +9 -9
  55. package/es/Grid/Grid.js +4 -4
  56. package/es/KeyFigure/KeyFigure.js +5 -5
  57. package/es/Layout/LayoutItem.js +25 -37
  58. package/es/Layout/OneColumn.js +33 -31
  59. package/es/Layout/PageContainer.js +21 -30
  60. package/es/LicenseByline/EmbedByline.js +21 -21
  61. package/es/LicenseByline/LicenseLink.js +3 -3
  62. package/es/LinkBlock/LinkBlock.js +8 -8
  63. package/es/LinkBlock/LinkBlockSection.js +4 -4
  64. package/es/Messages/MessageBox.js +11 -11
  65. package/es/Messages/index.js +1 -2
  66. package/es/ProgrammeCard/ProgrammeCard.js +5 -5
  67. package/es/RelatedArticleList/RelatedArticleList.js +15 -15
  68. package/es/ResourceBox/ResourceBox.js +9 -9
  69. package/es/SnackBar/DefaultSnackbar.js +5 -5
  70. package/es/SnackBar/SnackbarProvider.js +7 -7
  71. package/es/TagSelector/TagSelector.js +17 -17
  72. package/es/TreeStructure/AddFolderButton.js +4 -4
  73. package/es/TreeStructure/ComboboxButton.js +7 -7
  74. package/es/TreeStructure/FolderItem.js +13 -13
  75. package/es/TreeStructure/FolderItems.js +6 -6
  76. package/es/TreeStructure/TreeStructure.js +9 -9
  77. package/es/ZendeskButton/ZendeskButton.js +2 -2
  78. package/es/i18n/index.js +1 -1
  79. package/es/index.js +5 -12
  80. package/es/locale/messages-en.js +1 -1
  81. package/es/locale/messages-nb.js +1 -1
  82. package/es/locale/messages-nn.js +1 -1
  83. package/es/locale/messages-se.js +1 -1
  84. package/es/locale/messages-sma.js +1 -1
  85. package/es/model/ContentType.js +3 -1
  86. package/es/styles.css +453 -103
  87. package/lib/Article/Article.d.ts +9 -30
  88. package/lib/Article/Article.js +104 -164
  89. package/lib/Article/ArticleByline.d.ts +1 -3
  90. package/lib/Article/ArticleByline.js +89 -56
  91. package/lib/Article/ArticleFootNotes.js +35 -24
  92. package/lib/Article/ArticleParagraph.js +2 -2
  93. package/lib/Article/index.d.ts +2 -5
  94. package/lib/Article/index.js +18 -24
  95. package/lib/AudioPlayer/AudioPlayer.js +20 -20
  96. package/lib/AudioPlayer/Controls.js +45 -45
  97. package/lib/AudioPlayer/SpeechControl.js +8 -8
  98. package/lib/BlogPost/BlogPost.js +6 -6
  99. package/lib/Breadcrumb/Breadcrumb.js +21 -29
  100. package/lib/Breadcrumb/BreadcrumbItem.js +22 -50
  101. package/lib/Breadcrumb/HomeBreadcrumb.d.ts +1 -2
  102. package/lib/Breadcrumb/HomeBreadcrumb.js +38 -82
  103. package/lib/CampaignBlock/CampaignBlock.js +12 -12
  104. package/lib/CodeBlock/CodeBlock.js +2 -2
  105. package/lib/Concept/Concept.js +11 -11
  106. package/lib/ContactBlock/ContactBlock.d.ts +6 -7
  107. package/lib/ContactBlock/ContactBlock.js +173 -184
  108. package/lib/ContactBlock/index.d.ts +3 -3
  109. package/lib/ContactBlock/index.js +13 -11
  110. package/lib/ContentLoader/index.js +12 -12
  111. package/lib/ContentPlaceholder/ContentPlaceholder.js +3 -3
  112. package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +11 -12
  113. package/lib/ContentTypeBadge/ContentTypeBadge.js +83 -80
  114. package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +1 -2
  115. package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +3 -2
  116. package/lib/ContentTypeHero/ContentTypeHero.d.ts +15 -0
  117. package/lib/ContentTypeHero/ContentTypeHero.js +57 -0
  118. package/lib/ContentTypeHero/index.d.ts +9 -0
  119. package/lib/ContentTypeHero/index.js +12 -0
  120. package/lib/CopyParagraphButton/CopyParagraphButton.js +13 -12
  121. package/lib/Embed/AudioEmbed.js +7 -7
  122. package/lib/Embed/BrightcoveEmbed.js +8 -8
  123. package/lib/Embed/CodeEmbed.js +6 -6
  124. package/lib/Embed/ConceptEmbed.js +13 -13
  125. package/lib/Embed/ConceptListEmbed.js +9 -9
  126. package/lib/Embed/ContentLinkEmbed.js +6 -6
  127. package/lib/Embed/CopyrightEmbed.js +3 -3
  128. package/lib/Embed/EmbedErrorPlaceholder.js +5 -5
  129. package/lib/Embed/ExternalEmbed.js +5 -5
  130. package/lib/Embed/FootnoteEmbed.js +5 -5
  131. package/lib/Embed/GlossEmbed.js +11 -11
  132. package/lib/Embed/H5pEmbed.js +5 -5
  133. package/lib/Embed/IframeEmbed.js +6 -6
  134. package/lib/Embed/ImageEmbed.js +10 -10
  135. package/lib/Embed/InlineTriggerButton.js +2 -2
  136. package/lib/Embed/RelatedContentEmbed.js +5 -5
  137. package/lib/Embed/UnknownEmbed.js +3 -3
  138. package/lib/Embed/UuDisclaimerEmbed.js +6 -6
  139. package/lib/ErrorMessage/ErrorMessage.js +14 -14
  140. package/lib/ErrorMessage/ErrorResourceAccessDenied.js +6 -6
  141. package/lib/FactBox/FactBox.js +5 -5
  142. package/lib/FileList/File.js +3 -3
  143. package/lib/FileList/FileList.js +6 -6
  144. package/lib/FileList/Format.js +6 -6
  145. package/lib/FileList/PdfFile.js +5 -5
  146. package/lib/FrontpageArticle/FrontpageArticle.js +7 -8
  147. package/lib/Gloss/Gloss.js +23 -23
  148. package/lib/Gloss/GlossExample.js +9 -9
  149. package/lib/Grid/Grid.js +4 -4
  150. package/lib/KeyFigure/KeyFigure.js +5 -5
  151. package/lib/Layout/LayoutItem.d.ts +3 -7
  152. package/lib/Layout/LayoutItem.js +27 -38
  153. package/lib/Layout/OneColumn.d.ts +3 -6
  154. package/lib/Layout/OneColumn.js +36 -33
  155. package/lib/Layout/PageContainer.d.ts +3 -6
  156. package/lib/Layout/PageContainer.js +24 -32
  157. package/lib/LicenseByline/EmbedByline.js +21 -21
  158. package/lib/LicenseByline/LicenseLink.js +3 -3
  159. package/lib/LinkBlock/LinkBlock.js +8 -8
  160. package/lib/LinkBlock/LinkBlockSection.js +4 -4
  161. package/lib/Messages/MessageBox.js +11 -11
  162. package/lib/Messages/index.d.ts +1 -2
  163. package/lib/Messages/index.js +0 -7
  164. package/lib/ProgrammeCard/ProgrammeCard.js +5 -5
  165. package/lib/RelatedArticleList/RelatedArticleList.js +15 -15
  166. package/lib/ResourceBox/ResourceBox.js +9 -9
  167. package/lib/SnackBar/DefaultSnackbar.js +5 -5
  168. package/lib/SnackBar/SnackbarProvider.js +7 -7
  169. package/lib/TagSelector/TagSelector.js +17 -17
  170. package/lib/TreeStructure/AddFolderButton.js +4 -4
  171. package/lib/TreeStructure/ComboboxButton.js +7 -7
  172. package/lib/TreeStructure/FolderItem.js +13 -13
  173. package/lib/TreeStructure/FolderItems.js +6 -6
  174. package/lib/TreeStructure/TreeStructure.js +9 -9
  175. package/lib/ZendeskButton/ZendeskButton.js +2 -2
  176. package/lib/i18n/index.d.ts +1 -1
  177. package/lib/i18n/index.js +6 -0
  178. package/lib/index.d.ts +8 -15
  179. package/lib/index.js +30 -139
  180. package/lib/locale/messages-en.js +1 -1
  181. package/lib/locale/messages-nb.js +1 -1
  182. package/lib/locale/messages-nn.js +1 -1
  183. package/lib/locale/messages-se.js +1 -1
  184. package/lib/locale/messages-sma.js +1 -1
  185. package/lib/model/ContentType.d.ts +1 -0
  186. package/lib/model/ContentType.js +4 -2
  187. package/lib/styles.css +453 -103
  188. package/package.json +10 -11
  189. package/src/Article/Article.tsx +101 -229
  190. package/src/Article/ArticleByline.tsx +82 -69
  191. package/src/Article/ArticleFootNotes.tsx +32 -36
  192. package/src/Article/index.ts +3 -7
  193. package/src/Breadcrumb/Breadcrumb.tsx +20 -18
  194. package/src/Breadcrumb/BreadcrumbItem.tsx +36 -59
  195. package/src/Breadcrumb/HomeBreadcrumb.stories.tsx +0 -12
  196. package/src/Breadcrumb/HomeBreadcrumb.tsx +33 -46
  197. package/src/ContactBlock/{Contactblock.stories.tsx → ContactBlock.stories.tsx} +3 -4
  198. package/src/ContactBlock/ContactBlock.tsx +165 -199
  199. package/src/ContactBlock/index.ts +3 -3
  200. package/src/ContentTypeBadge/ContentTypeBadge.tsx +77 -77
  201. package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +3 -1
  202. package/src/ContentTypeHero/ContentTypeHero.stories.tsx +76 -0
  203. package/src/ContentTypeHero/ContentTypeHero.tsx +55 -0
  204. package/src/ContentTypeHero/index.ts +10 -0
  205. package/src/CopyParagraphButton/CopyParagraphButton.tsx +10 -3
  206. package/src/Embed/AudioEmbed.stories.tsx +6 -8
  207. package/src/Embed/BrightcoveEmbed.stories.tsx +6 -8
  208. package/src/Embed/ConceptEmbed.stories.tsx +6 -8
  209. package/src/Embed/ExternalEmbed.stories.tsx +5 -5
  210. package/src/Embed/H5pEmbed.stories.tsx +6 -8
  211. package/src/Embed/IframeEmbed.stories.tsx +6 -8
  212. package/src/Embed/ImageEmbed.stories.tsx +6 -8
  213. package/src/Embed/RelatedContentEmbed.stories.tsx +6 -8
  214. package/src/Embed/UuDisclaimerEmbed.stories.tsx +6 -8
  215. package/src/FrontpageArticle/FrontpageArticle.tsx +1 -1
  216. package/src/Layout/LayoutItem.tsx +25 -41
  217. package/src/Layout/OneColumn.tsx +33 -33
  218. package/src/Layout/PageContainer.tsx +22 -24
  219. package/src/Messages/index.ts +1 -2
  220. package/src/i18n/index.ts +1 -0
  221. package/src/index.ts +11 -35
  222. package/src/locale/messages-en.ts +1 -1
  223. package/src/locale/messages-nb.ts +1 -1
  224. package/src/locale/messages-nn.ts +1 -1
  225. package/src/locale/messages-se.ts +1 -1
  226. package/src/locale/messages-sma.ts +1 -1
  227. package/src/model/ContentType.ts +2 -0
  228. package/es/Article/ArticleHeaderWrapper.js +0 -33
  229. package/es/CreatedBy/CreatedBy.js +0 -73
  230. package/es/CreatedBy/index.js +0 -10
  231. package/es/Hero/Hero.js +0 -68
  232. package/es/Hero/HeroContent.js +0 -16
  233. package/es/Hero/index.js +0 -10
  234. package/es/LanguageSelector/LanguageSelector.js +0 -87
  235. package/es/LanguageSelector/index.js +0 -10
  236. package/es/Logo/Logo.js +0 -52
  237. package/es/Logo/SvgLogo.js +0 -54
  238. package/es/Messages/MessageBanner.js +0 -72
  239. package/es/Search/ActiveFilterContent.js +0 -40
  240. package/es/Search/ActiveFilters.js +0 -112
  241. package/es/Search/ContentTypeResult.js +0 -151
  242. package/es/Search/ContentTypeResultStyles.js +0 -51
  243. package/es/Search/IsPathToHighlight.js +0 -12
  244. package/es/Search/LoadingWrapper.js +0 -31
  245. package/es/Search/SearchField.js +0 -110
  246. package/es/Search/SearchFieldForm.js +0 -33
  247. package/es/Search/SearchResult.js +0 -185
  248. package/es/Search/SearchResultSleeve.js +0 -229
  249. package/es/Search/index.js +0 -12
  250. package/lib/Article/ArticleHeaderWrapper.d.ts +0 -14
  251. package/lib/Article/ArticleHeaderWrapper.js +0 -40
  252. package/lib/CreatedBy/CreatedBy.d.ts +0 -15
  253. package/lib/CreatedBy/CreatedBy.js +0 -78
  254. package/lib/CreatedBy/index.d.ts +0 -9
  255. package/lib/CreatedBy/index.js +0 -16
  256. package/lib/Hero/Hero.d.ts +0 -25
  257. package/lib/Hero/Hero.js +0 -83
  258. package/lib/Hero/HeroContent.d.ts +0 -12
  259. package/lib/Hero/HeroContent.js +0 -23
  260. package/lib/Hero/index.d.ts +0 -10
  261. package/lib/Hero/index.js +0 -61
  262. package/lib/LanguageSelector/LanguageSelector.d.ts +0 -15
  263. package/lib/LanguageSelector/LanguageSelector.js +0 -92
  264. package/lib/LanguageSelector/index.d.ts +0 -9
  265. package/lib/LanguageSelector/index.js +0 -13
  266. package/lib/Logo/Logo.d.ts +0 -20
  267. package/lib/Logo/Logo.js +0 -58
  268. package/lib/Logo/SvgLogo.d.ts +0 -14
  269. package/lib/Logo/SvgLogo.js +0 -62
  270. package/lib/Logo/index.d.ts +0 -9
  271. package/lib/Logo/index.js +0 -16
  272. package/lib/Messages/MessageBanner.d.ts +0 -16
  273. package/lib/Messages/MessageBanner.js +0 -77
  274. package/lib/Search/ActiveFilterContent.d.ts +0 -23
  275. package/lib/Search/ActiveFilterContent.js +0 -47
  276. package/lib/Search/ActiveFilters.d.ts +0 -19
  277. package/lib/Search/ActiveFilters.js +0 -119
  278. package/lib/Search/ContentTypeResult.d.ts +0 -29
  279. package/lib/Search/ContentTypeResult.js +0 -159
  280. package/lib/Search/ContentTypeResultStyles.d.ts +0 -45
  281. package/lib/Search/ContentTypeResultStyles.js +0 -58
  282. package/lib/Search/IsPathToHighlight.d.ts +0 -8
  283. package/lib/Search/IsPathToHighlight.js +0 -19
  284. package/lib/Search/LoadingWrapper.d.ts +0 -12
  285. package/lib/Search/LoadingWrapper.js +0 -38
  286. package/lib/Search/SearchField.d.ts +0 -25
  287. package/lib/Search/SearchField.js +0 -117
  288. package/lib/Search/SearchFieldForm.d.ts +0 -15
  289. package/lib/Search/SearchFieldForm.js +0 -41
  290. package/lib/Search/SearchResult.d.ts +0 -43
  291. package/lib/Search/SearchResult.js +0 -194
  292. package/lib/Search/SearchResultSleeve.d.ts +0 -25
  293. package/lib/Search/SearchResultSleeve.js +0 -237
  294. package/lib/Search/index.d.ts +0 -11
  295. package/lib/Search/index.js +0 -33
  296. package/src/Article/ArticleHeaderWrapper.tsx +0 -38
  297. package/src/CreatedBy/CreatedBy.stories.tsx +0 -36
  298. package/src/CreatedBy/CreatedBy.tsx +0 -63
  299. package/src/CreatedBy/index.ts +0 -11
  300. package/src/Hero/Hero.stories.tsx +0 -35
  301. package/src/Hero/Hero.tsx +0 -129
  302. package/src/Hero/HeroContent.tsx +0 -43
  303. package/src/Hero/index.ts +0 -21
  304. package/src/LanguageSelector/LanguageSelector.stories.tsx +0 -44
  305. package/src/LanguageSelector/LanguageSelector.tsx +0 -101
  306. package/src/LanguageSelector/index.ts +0 -11
  307. package/src/Logo/Logo.stories.tsx +0 -47
  308. package/src/Logo/Logo.tsx +0 -47
  309. package/src/Logo/SvgLogo.tsx +0 -48
  310. package/src/Logo/index.ts +0 -11
  311. package/src/Messages/MessageBanner.stories.tsx +0 -31
  312. package/src/Messages/MessageBanner.tsx +0 -67
  313. package/src/Search/ActiveFilterContent.tsx +0 -64
  314. package/src/Search/ActiveFilters.tsx +0 -145
  315. package/src/Search/ContentTypeResult.tsx +0 -190
  316. package/src/Search/ContentTypeResultStyles.tsx +0 -172
  317. package/src/Search/IsPathToHighlight.ts +0 -12
  318. package/src/Search/LoadingWrapper.tsx +0 -44
  319. package/src/Search/SearchField.tsx +0 -175
  320. package/src/Search/SearchFieldForm.tsx +0 -64
  321. package/src/Search/SearchResult.tsx +0 -368
  322. package/src/Search/SearchResultSleeve.tsx +0 -367
  323. package/src/Search/__tests__/Highlight-test.ts +0 -66
  324. package/src/Search/index.ts +0 -14
@@ -1,233 +1,199 @@
1
1
  /**
2
- * Copyright (c) 2023-present, NDLA.
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
- /** @jsxImportSource @emotion/react */
10
- import { ReactNode } from "react";
11
9
  import { useTranslation } from "react-i18next";
12
- import { css } from "@emotion/react";
13
- import styled from "@emotion/styled";
14
- import { spacing, fonts, colors, mq, breakpoints, misc } from "@ndla/core";
15
- import { BlobPointy as UnstyledBlobPointy, BlobRound as UnstyledBlobRound } from "@ndla/icons/common";
16
- import { COPYRIGHTED, getLicenseByAbbreviation } from "@ndla/licenses";
17
- import { Image } from "@ndla/primitives";
18
- import { IAuthor, IImageMetaInformationV3 } from "@ndla/types-backend/image-api";
19
- import { CanonicalUrlFuncs } from "../Embed";
20
- import { errorSvgSrc } from "../Embed/ImageEmbed";
21
- import { LicenseLink } from "../LicenseByline/LicenseLink";
10
+ import { Text } from "@ndla/primitives";
11
+ import { styled } from "@ndla/styled-system/jsx";
12
+ import { SystemStyleObject } from "@ndla/styled-system/types";
13
+ import { IImageMetaInformationV3 } from "@ndla/types-backend/image-api";
14
+ import { LicenseContainerContent } from "../LicenseByline/EmbedByline";
15
+
16
+ export type ContactBlockBackground = "strong" | "moderate" | "subtle";
17
+
18
+ const BackgroundVariant: Record<ContactBlockBackground, SystemStyleObject> = {
19
+ strong: { _before: { backgroundColor: "surface.brand.3" } },
20
+ moderate: { _before: { backgroundColor: "surface.brand.3.moderate" } },
21
+ subtle: { _before: { backgroundColor: "surface.brand.3.subtle" } },
22
+ };
22
23
 
23
- const BLOB_WIDTH = 90;
24
+ export const contactBlockBackgrounds = Object.keys(BackgroundVariant) as ContactBlockBackground[];
25
+
26
+ const StyledWrapper = styled("div", {
27
+ base: {
28
+ display: "flex",
29
+ maxWidth: "744px",
30
+ minWidth: "surface.xxsmall",
31
+ padding: "medium",
32
+ alignItems: "center",
33
+ justifyContent: "space-between",
34
+ boxShadow: "full",
35
+ border: "1px solid",
36
+ gap: "medium",
37
+ position: "relative",
38
+ borderColor: "stroke.default",
39
+ borderRadius: "xsmall",
40
+ overflow: "hidden",
41
+ background: "surface.default",
42
+ flexDirection: "column-reverse",
43
+ tablet: {
44
+ alignItems: "unset",
45
+ flexDirection: "row",
46
+ },
47
+ },
48
+ });
49
+
50
+ const EmailLink = styled("a", {
51
+ base: {
52
+ color: "text.default",
53
+ textDecoration: "underline",
54
+ _hover: { textDecoration: "none" },
55
+ _focusVisible: { textDecoration: "none" },
56
+ },
57
+ });
58
+
59
+ const HeaderWrapper = styled("div", {
60
+ base: {
61
+ position: "relative",
62
+ display: "flex",
63
+ flexDirection: "column",
64
+ gap: "3xsmall",
65
+ zIndex: "base",
66
+ _before: {
67
+ content: '""',
68
+ position: "absolute",
69
+ top: "-60px",
70
+ left: "-50px",
71
+ right: "0",
72
+ bottom: "0",
73
+ height: "calc(100% + 50px)",
74
+ width: "surface.3xlarge",
75
+ transform: "rotate(-4deg)",
76
+ zIndex: "hide",
77
+ },
78
+ },
79
+ variants: {
80
+ variant: BackgroundVariant,
81
+ imageExists: {
82
+ true: {
83
+ tabletDown: {
84
+ _before: {
85
+ display: "none",
86
+ },
87
+ },
88
+ },
89
+ },
90
+ },
91
+ });
92
+
93
+ const ImageWrapper = styled("div", {
94
+ base: {
95
+ display: "flex",
96
+ gap: "xxsmall",
97
+ alignItems: "flex-start",
98
+ justifyContent: "flex-start",
99
+ flexDirection: "column",
100
+ zIndex: "base",
101
+ tabletDown: {
102
+ _before: {
103
+ content: '""',
104
+ position: "absolute",
105
+ top: "-50px",
106
+ left: "-50px",
107
+ right: "0",
108
+ bottom: "0",
109
+ height: "surface.xxsmall",
110
+ width: "surface.3xlarge",
111
+ transform: "rotate(-4deg)",
112
+ zIndex: "hide",
113
+ },
114
+ },
115
+ },
116
+ variants: {
117
+ variant: BackgroundVariant,
118
+ },
119
+ });
120
+
121
+ const StyledImage = styled("img", {
122
+ base: {
123
+ borderRadius: "xsmall",
124
+ width: "surface.xsmall",
125
+ height: "surface.xsmall",
126
+ objectFit: "cover",
127
+ },
128
+ });
129
+
130
+ const ContentWrapper = styled("div", {
131
+ base: {
132
+ display: "flex",
133
+ flexDirection: "column",
134
+ gap: "medium",
135
+ flex: "1",
136
+ width: "100%",
137
+ },
138
+ });
139
+
140
+ const StyledDescription = styled(Text, {
141
+ base: {
142
+ fontFamily: "serif",
143
+ },
144
+ });
24
145
 
25
146
  interface Props {
26
147
  image?: IImageMetaInformationV3;
27
148
  jobTitle: string;
28
149
  description: string;
29
- blobColor?: "pink" | "green";
30
- blob?: "pointy" | "round";
150
+ backgroundColor?: ContactBlockBackground;
31
151
  imageWidth?: number;
32
152
  name: string;
33
153
  email: string;
34
154
  embedAlt?: string;
35
155
  lang?: string;
36
- imageCanonicalUrl?: CanonicalUrlFuncs["image"];
37
- }
38
- const BlockWrapper = styled.div`
39
- display: flex;
40
- position: relative;
41
- flex-direction: column;
42
- padding: 0 0 ${spacing.medium} ${spacing.medium};
43
- font-family: ${fonts.sans};
44
- border-radius: ${misc.borderRadius};
45
- border: 1px solid ${colors.brand.lighter};
46
- background-color: ${colors.white};
47
- & ~ & {
48
- margin-top: ${spacing.medium};
49
- }
50
- ${mq.range({ from: breakpoints.tablet })} {
51
- max-width: 773px;
52
- flex-direction: row;
53
- padding: 0 0 ${spacing.medium} ${spacing.medium};
54
- gap: ${spacing.nsmall};
55
- }
56
- `;
57
-
58
- const StyledHeader = styled.div`
59
- ${fonts.sizes("22px", "30px")};
60
- font-weight: ${fonts.weight.bold};
61
- margin: 0 0 ${spacing.xsmall} 0;
62
- padding-top: ${spacing.medium};
63
- `;
64
-
65
- const StyledText = styled.div`
66
- display: flex;
67
- ${fonts.sizes("16px", "26px")};
68
- overflow-wrap: anywhere;
69
- color: ${colors.text.light};
70
- gap: ${spacing.xxsmall};
71
- `;
72
-
73
- const EmailLink = styled.a`
74
- color: ${colors.text.light};
75
- text-decoration-color: ${colors.text.light};
76
- text-decoration-style: solid;
77
- text-decoration: underline;
78
- box-shadow: unset;
79
- `;
80
-
81
- const SummaryBlock = styled.p`
82
- font-family: ${fonts.sans};
83
- padding: 0;
84
- max-width: calc(100% - (${BLOB_WIDTH}px / 2));
85
- ${mq.range({ from: breakpoints.tabletWide })} {
86
- padding-top: 0;
87
- }
88
- `;
89
-
90
- const InfoWrapper = styled.div`
91
- max-width: calc(100% - ${BLOB_WIDTH}px);
92
- `;
93
-
94
- const TextWrapper = styled.div`
95
- display: flex;
96
- overflow: hidden;
97
- justify-content: space-between;
98
- `;
99
-
100
- const BlobWrapper = styled.div`
101
- height: 180px;
102
- width: ${BLOB_WIDTH}px;
103
- position: absolute;
104
- overflow: hidden;
105
- right: 0px;
106
- `;
107
-
108
- const ImageWrapper = styled.div`
109
- display: flex;
110
- flex-direction: column;
111
- gap: ${spacing.xsmall};
112
- ${fonts.sizes("16px", "26px")};
113
- padding: ${spacing.medium} ${spacing.medium} 0 0;
114
- ${mq.range({ from: breakpoints.tablet })} {
115
- padding-right: 0;
116
- }
117
- `;
118
-
119
- const blobStyling = css`
120
- width: 165px;
121
- height: 180px;
122
- transform: translate(10%, 0);
123
- color: ${colors.support.redLight};
124
- &[data-green="true"] {
125
- color: ${colors.support.greenLight};
126
- }
127
- `;
128
-
129
- const BlobPointy = styled(UnstyledBlobPointy)`
130
- ${blobStyling}
131
- `;
132
-
133
- const BlobRound = styled(UnstyledBlobRound)`
134
- ${blobStyling}
135
- `;
136
- const Email = styled.div`
137
- white-space: nowrap;
138
- `;
139
-
140
- const ContentWrapper = styled.div`
141
- width: 100%;
142
- `;
143
-
144
- const StyledImage = styled(Image)`
145
- object-fit: cover;
146
- `;
147
-
148
- interface LinkWrapperProps {
149
- src?: string;
150
- children: ReactNode;
151
156
  }
152
157
 
153
- const StyledLink = styled.a`
154
- text-decoration: none;
155
- `;
156
-
157
- const LinkWrapper = ({ src, children }: LinkWrapperProps) => {
158
- if (src) {
159
- return (
160
- <StyledLink target="_blank" href={src} rel="noopener noreferrer">
161
- {children}
162
- </StyledLink>
163
- );
164
- }
165
- return children;
166
- };
167
-
168
- const ContactBlock = ({
158
+ export const ContactBlock = ({
169
159
  image,
170
160
  jobTitle,
171
161
  description,
172
162
  name,
173
163
  email,
174
164
  embedAlt,
175
- blobColor = "green",
176
- blob = "pointy",
177
- imageCanonicalUrl,
178
165
  lang,
166
+ backgroundColor = "strong",
179
167
  }: Props) => {
180
- const { t, i18n } = useTranslation();
181
- const isGreenBlob = blobColor === "green";
182
- const Blob = blob === "pointy" ? BlobPointy : BlobRound;
183
- const authors = [image?.copyright.processors, image?.copyright.creators, image?.copyright.rightsholders]
184
- .filter((authors) => !!authors?.length)
185
- .reduce<IAuthor[]>((acc, val) => acc.concat(val!), []);
186
- const license = image?.copyright
187
- ? getLicenseByAbbreviation(image.copyright.license.license, i18n.language)
188
- : undefined;
189
-
190
- const isCopyrighted = image?.copyright.license.license.toLowerCase() === COPYRIGHTED;
191
-
168
+ const { t } = useTranslation();
192
169
  return (
193
- <BlockWrapper>
194
- <ImageWrapper>
195
- {image ? (
196
- <>
197
- <LinkWrapper src={!isCopyrighted && image ? imageCanonicalUrl?.(image) : undefined}>
198
- <StyledImage
199
- alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}
200
- src={image.image.imageUrl}
201
- sizes={`(min-width: ${breakpoints.tablet}) 240px, (max-width: ${breakpoints.tablet}) 500px`}
202
- />
203
- </LinkWrapper>
204
- <span>
205
- {`${t("embed.type.image")}: ${authors.map((author) => `${author?.name}`).join(", ")} `}
206
- {!!license && <LicenseLink license={license} />}
207
- </span>
208
- </>
209
- ) : (
210
- <img alt={t("image.error.url")} src={errorSvgSrc} />
211
- )}
212
- </ImageWrapper>
170
+ <StyledWrapper>
213
171
  <ContentWrapper>
214
- <TextWrapper>
215
- <InfoWrapper>
216
- <StyledHeader lang={lang}>{name}</StyledHeader>
217
- <StyledText lang={lang}>{jobTitle}</StyledText>
218
- <StyledText>
219
- <Email>{`${t("email")}:`}</Email>
220
- <EmailLink href={`mailto:${email}`}>{email}</EmailLink>
221
- </StyledText>
222
- </InfoWrapper>
223
- <BlobWrapper>
224
- <Blob data-green={isGreenBlob} />
225
- </BlobWrapper>
226
- </TextWrapper>
227
- <SummaryBlock>{description}</SummaryBlock>
172
+ <HeaderWrapper variant={backgroundColor} imageExists={!!image}>
173
+ {/* TODO: The font in the design specified `Source Sans Pro` and this is the default `Satoshi` */}
174
+ <Text lang={lang} fontWeight="bold" textStyle="heading.small">
175
+ {name}
176
+ </Text>
177
+ <Text lang={lang}>{jobTitle}</Text>
178
+ <Text>
179
+ {`${t("email")}: `}
180
+ <EmailLink href={`mailto:${email}`}>{email}</EmailLink>
181
+ </Text>
182
+ </HeaderWrapper>
183
+ <StyledDescription textStyle="body.large">{description}</StyledDescription>
228
184
  </ContentWrapper>
229
- </BlockWrapper>
185
+ {image && (
186
+ <ImageWrapper variant={backgroundColor}>
187
+ <StyledImage
188
+ alt={embedAlt !== undefined ? embedAlt : image.alttext.alttext}
189
+ src={image.image.imageUrl}
190
+ width={300}
191
+ height={300}
192
+ />
193
+ {/* TODO: The font in the design specified `Source Sans Pro` and this is the default `Satoshi` */}
194
+ <LicenseContainerContent type="image" copyright={image.copyright} />
195
+ </ImageWrapper>
196
+ )}
197
+ </StyledWrapper>
230
198
  );
231
199
  };
232
-
233
- export default ContactBlock;
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2023-present, NDLA.
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 ContactBlock from "./ContactBlock";
9
8
 
10
- export default ContactBlock;
9
+ export { ContactBlock, contactBlockBackgrounds } from "./ContactBlock";
10
+ export type { ContactBlockBackground } from "./ContactBlock";
@@ -6,12 +6,9 @@
6
6
  *
7
7
  */
8
8
 
9
- /** @jsxImportSource @emotion/react */
10
- import { CSSProperties, ComponentProps, useMemo } from "react";
9
+ import { CSSProperties, ComponentPropsWithoutRef, useMemo } from "react";
11
10
 
12
- import { css } from "@emotion/react";
13
- import styled from "@emotion/styled";
14
- import { breakpoints, colors, mq } from "@ndla/core";
11
+ import { colors } from "@ndla/core";
15
12
  import { Minus, MenuBook } from "@ndla/icons/action";
16
13
  import { Audio } from "@ndla/icons/common";
17
14
  import {
@@ -24,12 +21,12 @@ import {
24
21
  SubjectMaterial,
25
22
  TasksAndActivities,
26
23
  } from "@ndla/icons/contentType";
27
-
28
24
  import { Concept, Media, Video } from "@ndla/icons/editor";
25
+ import { styled } from "@ndla/styled-system/jsx";
29
26
 
30
27
  import * as contentTypes from "../model/ContentType";
31
28
 
32
- interface Props extends ComponentProps<"div"> {
29
+ interface Props extends ComponentPropsWithoutRef<"div"> {
33
30
  size?: "xx-small" | "x-small" | "small" | "large";
34
31
  type: string;
35
32
  title?: string;
@@ -38,62 +35,74 @@ interface Props extends ComponentProps<"div"> {
38
35
  className?: string;
39
36
  }
40
37
 
41
- const sizes = {
42
- "xx-small": css`
43
- width: 20px;
44
- height: 20px;
45
- border: 1px solid;
46
- svg {
47
- width: 10px;
48
- height: 10x;
49
- }
50
- `,
51
- "x-small": css`
52
- width: 20px;
53
- height: 20px;
54
- border: 1px solid;
55
- ${mq.range({ from: breakpoints.tablet })} {
56
- height: 26px;
57
- width: 26px;
58
- }
59
- svg {
60
- width: 10px;
61
- height: 10x;
62
- ${mq.range({ from: breakpoints.tablet })} {
63
- width: 12px;
64
- height: 12px;
65
- }
66
- }
67
- `,
68
- small: "",
69
- large: css`
70
- width: 50px;
71
- height: 50px;
72
- svg {
73
- width: 25px;
74
- height: 25px;
75
- }
76
- `,
77
- } as const;
78
-
79
- const BaseContentTypeBadge = styled.div`
80
- display: inline-flex;
81
- align-items: center;
82
- justify-content: center;
83
- border-radius: 100%;
84
- width: 34px;
85
- height: 34px;
86
- color: var(--icon-color);
87
- `;
88
-
89
- const borderStyle = css`
90
- border: 2px solid;
91
- border-color: var(--icon-color);
92
- `;
93
-
94
- const backgroundStyle = css`
95
- background-color: var(--background-color);
96
- `;
38
+ const StyledContentTypeBadge = styled("div", {
39
+ base: {
40
+ display: "inline-flex",
41
+ alignItems: "center",
42
+ justifyContent: "center",
43
+ borderRadius: "100%",
44
+ color: "var(--icon-color)",
45
+ },
46
+ defaultVariants: {
47
+ size: "small",
48
+ border: true,
49
+ background: false,
50
+ },
51
+ variants: {
52
+ size: {
53
+ "xx-small": {
54
+ width: "20px",
55
+ height: "20px",
56
+ border: "1px solid",
57
+ "& svg": {
58
+ width: "10px",
59
+ height: "10px",
60
+ },
61
+ },
62
+ "x-small": {
63
+ width: "20px",
64
+ height: "20px",
65
+ border: "1px solid",
66
+ tablet: {
67
+ height: "26px",
68
+ width: "26px",
69
+ },
70
+ "& svg": {
71
+ width: "10px",
72
+ height: "10px",
73
+ tablet: {
74
+ width: "12px",
75
+ height: "12px",
76
+ },
77
+ },
78
+ },
79
+ small: {
80
+ width: "34px",
81
+ height: "34px",
82
+ },
83
+ large: {
84
+ width: "50px",
85
+ height: "50px",
86
+ "& svg": {
87
+ width: "25px",
88
+ height: "25px",
89
+ },
90
+ },
91
+ },
92
+ border: {
93
+ true: {
94
+ border: "2px solid",
95
+ borderColor: "var(--icon-color)",
96
+ },
97
+ false: {},
98
+ },
99
+ background: {
100
+ true: {
101
+ backgroundColor: "var(--background-color)",
102
+ },
103
+ },
104
+ },
105
+ });
97
106
 
98
107
  const iconMap = {
99
108
  [contentTypes.SUBJECT_MATERIAL]: {
@@ -185,21 +194,12 @@ export const ContentTypeBadge = ({
185
194
  return { Icon: fromMap.icon, style };
186
195
  }, [type]);
187
196
 
188
- const cssStyles = useMemo(() => {
189
- const styles = [sizes[size]];
190
- if (background) {
191
- styles.push(backgroundStyle);
192
- }
193
- if (border) {
194
- styles.push(borderStyle);
195
- }
196
- return styles;
197
- }, [background, border, size]);
198
-
199
197
  return (
200
- <BaseContentTypeBadge
201
- css={cssStyles}
198
+ <StyledContentTypeBadge
202
199
  title={title}
200
+ background={background}
201
+ size={size}
202
+ border={border}
203
203
  style={style}
204
204
  aria-label={title}
205
205
  className={className}
@@ -208,7 +208,7 @@ export const ContentTypeBadge = ({
208
208
  {...rest}
209
209
  >
210
210
  <Icon />
211
- </BaseContentTypeBadge>
211
+ </StyledContentTypeBadge>
212
212
  );
213
213
  };
214
214
 
@@ -15,7 +15,7 @@ export interface ContentTypeBadgeProps extends Omit<BadgeProps, "colorTheme"> {
15
15
  contentType: ContentType | undefined;
16
16
  }
17
17
 
18
- type ContentType =
18
+ export type ContentType =
19
19
  | typeof contentTypes.SUBJECT_MATERIAL
20
20
  | typeof contentTypes.TASKS_AND_ACTIVITIES
21
21
  | typeof contentTypes.ASSESSMENT_RESOURCES
@@ -30,6 +30,7 @@ type ContentType =
30
30
  | typeof contentTypes.AUDIO
31
31
  | typeof contentTypes.VIDEO
32
32
  | typeof contentTypes.MISSING
33
+ | typeof contentTypes.PODCAST
33
34
  // This allows for us to fallback to string without getting a ts error, while still keeping intellisense
34
35
  | (string & {});
35
36
 
@@ -49,6 +50,7 @@ export const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant> = {
49
50
  // TODO: Verify resourceEmbedTypeMapping colors
50
51
  [contentTypes.IMAGE]: "brand1",
51
52
  [contentTypes.AUDIO]: "brand1",
53
+ [contentTypes.PODCAST]: "brand1",
52
54
  [contentTypes.VIDEO]: "brand1",
53
55
  [contentTypes.MISSING]: "neutral",
54
56
  };