@ndla/ui 50.15.3 → 52.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 (572) hide show
  1. package/README.md +2 -2
  2. package/es/Article/Article.js +12 -12
  3. package/es/Article/ArticleHeaderWrapper.js +0 -11
  4. package/es/Article/ArticleNotions.js +6 -6
  5. package/es/Article/ArticleParagraph.js +25 -0
  6. package/es/Article/index.js +1 -0
  7. package/es/AudioPlayer/AudioPlayer.js +13 -13
  8. package/es/AudioPlayer/Controls.js +22 -38
  9. package/es/Breadcrumb/Breadcrumb.js +2 -33
  10. package/es/Breadcrumb/BreadcrumbItem.js +16 -29
  11. package/es/Breadcrumb/index.js +0 -1
  12. package/es/CodeBlock/CodeBlock.js +115 -0
  13. package/es/CodeBlock/codeLanguageOptions.js +84 -0
  14. package/es/CodeBlock/index.js +10 -0
  15. package/es/CreatedBy/CreatedBy.js +4 -4
  16. package/es/Embed/BrightcoveEmbed.js +3 -3
  17. package/es/Embed/CodeEmbed.js +2 -2
  18. package/es/Embed/ConceptEmbed.js +37 -33
  19. package/es/Embed/ExternalEmbed.js +2 -2
  20. package/es/Embed/IframeEmbed.js +1 -1
  21. package/es/Embed/ImageEmbed.js +18 -14
  22. package/es/Embed/RelatedContentEmbed.js +3 -3
  23. package/es/Embed/UuDisclaimerEmbed.js +4 -3
  24. package/es/Embed/conceptComponents.js +10 -10
  25. package/es/Embed/index.js +1 -1
  26. package/es/Figure/Figure.js +32 -19
  27. package/es/Footer/FooterBlock.js +17 -0
  28. package/es/Footer/index.js +1 -4
  29. package/es/FrontpageArticle/FrontpageArticle.js +3 -3
  30. package/es/Gloss/Gloss.js +12 -10
  31. package/es/Hero/Hero.js +1 -1
  32. package/es/Image/Image.js +3 -3
  33. package/es/LanguageSelector/LanguageSelector.js +5 -5
  34. package/es/Layout/LayoutItem.js +2 -1
  35. package/es/Layout/OneColumn.js +22 -28
  36. package/es/Layout/PageContainer.js +21 -17
  37. package/es/LicenseByline/LicenseLink.js +5 -6
  38. package/es/Messages/MessageBox.js +9 -7
  39. package/es/MyNdla/Resource/index.js +1 -2
  40. package/es/MyNdla/index.js +1 -2
  41. package/es/Notion/Notion.js +4 -4
  42. package/es/Resource/BlockResource.js +13 -15
  43. package/es/Resource/ListResource.js +13 -15
  44. package/es/Search/ContentTypeResult.js +4 -4
  45. package/es/Search/SearchResult.js +11 -11
  46. package/es/Search/SearchResultSleeve.js +16 -16
  47. package/es/TreeStructure/TreeStructure.js +6 -6
  48. package/es/all.css +1 -1
  49. package/es/index.js +7 -21
  50. package/es/locale/messages-en.js +14 -3
  51. package/es/locale/messages-nb.js +14 -3
  52. package/es/locale/messages-nn.js +15 -4
  53. package/es/locale/messages-se.js +13 -2
  54. package/es/locale/messages-sma.js +14 -3
  55. package/es/types.js +0 -9
  56. package/lib/Article/Article.d.ts +5 -7
  57. package/lib/Article/Article.js +12 -12
  58. package/lib/Article/ArticleHeaderWrapper.js +0 -11
  59. package/lib/Article/ArticleNotions.js +5 -5
  60. package/lib/Article/ArticleParagraph.d.ts +13 -0
  61. package/lib/Article/ArticleParagraph.js +32 -0
  62. package/lib/Article/index.d.ts +1 -0
  63. package/lib/Article/index.js +7 -0
  64. package/lib/AudioPlayer/AudioPlayer.js +13 -13
  65. package/lib/AudioPlayer/Controls.js +21 -37
  66. package/lib/Breadcrumb/Breadcrumb.d.ts +1 -2
  67. package/lib/Breadcrumb/Breadcrumb.js +2 -33
  68. package/lib/Breadcrumb/BreadcrumbItem.js +16 -29
  69. package/lib/Breadcrumb/index.d.ts +0 -1
  70. package/lib/Breadcrumb/index.js +0 -7
  71. package/lib/CodeBlock/CodeBlock.d.ts +18 -0
  72. package/lib/CodeBlock/CodeBlock.js +121 -0
  73. package/lib/{NDLAFilm/isLetter.d.ts → CodeBlock/codeLanguageOptions.d.ts} +5 -1
  74. package/lib/CodeBlock/codeLanguageOptions.js +90 -0
  75. package/lib/CodeBlock/index.d.ts +9 -0
  76. package/lib/CodeBlock/index.js +20 -0
  77. package/lib/CreatedBy/CreatedBy.js +4 -4
  78. package/lib/Embed/BrightcoveEmbed.js +3 -3
  79. package/lib/Embed/CodeEmbed.js +2 -2
  80. package/lib/Embed/ConceptEmbed.d.ts +1 -1
  81. package/lib/Embed/ConceptEmbed.js +36 -33
  82. package/lib/Embed/ExternalEmbed.js +2 -2
  83. package/lib/Embed/IframeEmbed.js +1 -1
  84. package/lib/Embed/ImageEmbed.js +18 -14
  85. package/lib/Embed/RelatedContentEmbed.js +3 -3
  86. package/lib/Embed/UuDisclaimerEmbed.js +4 -3
  87. package/lib/Embed/conceptComponents.js +10 -10
  88. package/lib/Embed/index.d.ts +1 -1
  89. package/lib/Embed/index.js +15 -3
  90. package/lib/Figure/Figure.d.ts +2 -5
  91. package/lib/Figure/Figure.js +32 -23
  92. package/lib/Footer/FooterBlock.d.ts +13 -0
  93. package/lib/Footer/FooterBlock.js +24 -0
  94. package/lib/Footer/index.d.ts +1 -4
  95. package/lib/Footer/index.js +3 -18
  96. package/lib/FrontpageArticle/FrontpageArticle.js +3 -3
  97. package/lib/Gloss/Gloss.js +12 -10
  98. package/lib/Hero/Hero.js +1 -1
  99. package/lib/Image/Image.js +2 -2
  100. package/lib/LanguageSelector/LanguageSelector.js +5 -5
  101. package/lib/Layout/LayoutItem.js +2 -1
  102. package/lib/Layout/OneColumn.d.ts +3 -8
  103. package/lib/Layout/OneColumn.js +22 -30
  104. package/lib/Layout/PageContainer.d.ts +3 -7
  105. package/lib/Layout/PageContainer.js +21 -19
  106. package/lib/LicenseByline/LicenseLink.js +5 -6
  107. package/lib/Messages/MessageBox.d.ts +2 -1
  108. package/lib/Messages/MessageBox.js +9 -7
  109. package/lib/MyNdla/Resource/index.d.ts +1 -2
  110. package/lib/MyNdla/Resource/index.js +0 -7
  111. package/lib/MyNdla/index.d.ts +1 -2
  112. package/lib/MyNdla/index.js +0 -7
  113. package/lib/Notion/Notion.js +4 -4
  114. package/lib/Resource/BlockResource.js +13 -15
  115. package/lib/Resource/ListResource.js +13 -15
  116. package/lib/Search/ContentTypeResult.js +4 -4
  117. package/lib/Search/SearchResult.js +10 -10
  118. package/lib/Search/SearchResultSleeve.js +16 -16
  119. package/lib/TreeStructure/TreeStructure.js +6 -6
  120. package/lib/all.css +1 -1
  121. package/lib/index.d.ts +6 -21
  122. package/lib/index.js +31 -249
  123. package/lib/locale/messages-en.d.ts +11 -0
  124. package/lib/locale/messages-en.js +14 -3
  125. package/lib/locale/messages-nb.d.ts +11 -0
  126. package/lib/locale/messages-nb.js +14 -3
  127. package/lib/locale/messages-nn.d.ts +11 -0
  128. package/lib/locale/messages-nn.js +15 -4
  129. package/lib/locale/messages-se.d.ts +11 -0
  130. package/lib/locale/messages-se.js +13 -2
  131. package/lib/locale/messages-sma.d.ts +11 -0
  132. package/lib/locale/messages-sma.js +14 -3
  133. package/lib/types.d.ts +0 -51
  134. package/lib/types.js +1 -10
  135. package/package.json +16 -21
  136. package/src/Article/Article.tsx +14 -18
  137. package/src/Article/ArticleHeaderWrapper.tsx +1 -12
  138. package/src/Article/ArticleNotions.tsx +3 -3
  139. package/src/Article/ArticleParagraph.tsx +22 -0
  140. package/src/Article/component.article.scss +0 -7
  141. package/src/Article/index.ts +2 -0
  142. package/src/AudioPlayer/AudioPlayer.tsx +2 -2
  143. package/src/AudioPlayer/Controls.tsx +5 -5
  144. package/src/Breadcrumb/Breadcrumb.stories.tsx +0 -4
  145. package/src/Breadcrumb/Breadcrumb.tsx +1 -38
  146. package/src/Breadcrumb/BreadcrumbItem.tsx +5 -19
  147. package/src/Breadcrumb/index.ts +0 -2
  148. package/src/CodeBlock/CodeBlock.stories.tsx +113 -0
  149. package/src/CodeBlock/CodeBlock.tsx +228 -0
  150. package/src/CodeBlock/codeLanguageOptions.ts +115 -0
  151. package/src/CodeBlock/index.ts +10 -0
  152. package/src/CreatedBy/CreatedBy.tsx +2 -2
  153. package/src/Embed/AudioEmbed.stories.tsx +6 -4
  154. package/src/Embed/BrightcoveEmbed.stories.tsx +6 -4
  155. package/src/Embed/BrightcoveEmbed.tsx +2 -2
  156. package/src/Embed/CodeEmbed.tsx +2 -2
  157. package/src/Embed/ConceptEmbed.stories.tsx +6 -4
  158. package/src/Embed/ConceptEmbed.tsx +103 -96
  159. package/src/Embed/ExternalEmbed.stories.tsx +6 -4
  160. package/src/Embed/ExternalEmbed.tsx +2 -2
  161. package/src/Embed/H5pEmbed.stories.tsx +6 -4
  162. package/src/Embed/IframeEmbed.stories.tsx +6 -4
  163. package/src/Embed/IframeEmbed.tsx +1 -1
  164. package/src/Embed/ImageEmbed.stories.tsx +6 -4
  165. package/src/Embed/ImageEmbed.tsx +20 -11
  166. package/src/Embed/RelatedContentEmbed.stories.tsx +6 -4
  167. package/src/Embed/RelatedContentEmbed.tsx +3 -3
  168. package/src/Embed/UuDisclaimerEmbed.stories.tsx +23 -4
  169. package/src/Embed/UuDisclaimerEmbed.tsx +1 -1
  170. package/src/Embed/conceptComponents.tsx +1 -0
  171. package/src/Embed/index.ts +1 -1
  172. package/src/Figure/Figure.tsx +57 -18
  173. package/src/Footer/Footer.stories.tsx +7 -105
  174. package/src/Footer/FooterBlock.tsx +30 -0
  175. package/src/Footer/index.ts +1 -5
  176. package/src/FrontpageArticle/FrontpageArticle.tsx +3 -3
  177. package/src/Gloss/Gloss.tsx +4 -2
  178. package/src/Hero/Hero.tsx +1 -1
  179. package/src/Image/Image.tsx +2 -2
  180. package/src/LanguageSelector/LanguageSelector.tsx +1 -1
  181. package/src/Layout/LayoutItem.tsx +2 -1
  182. package/src/Layout/OneColumn.tsx +25 -35
  183. package/src/Layout/PageContainer.tsx +19 -23
  184. package/src/LicenseByline/LicenseLink.tsx +1 -2
  185. package/src/Messages/MessageBox.tsx +3 -2
  186. package/src/MyNdla/Resource/index.ts +1 -2
  187. package/src/MyNdla/index.ts +1 -2
  188. package/src/Notion/Notion.tsx +2 -2
  189. package/src/Resource/BlockResource.tsx +4 -8
  190. package/src/Resource/ListResource.tsx +4 -6
  191. package/src/Search/ContentTypeResult.tsx +4 -4
  192. package/src/Search/SearchResult.tsx +2 -2
  193. package/src/Search/SearchResultSleeve.tsx +7 -9
  194. package/src/Table/Table.stories.tsx +8 -8
  195. package/src/TreeStructure/TreeStructure.stories.tsx +85 -28
  196. package/src/TreeStructure/TreeStructure.tsx +1 -1
  197. package/src/index.ts +8 -47
  198. package/src/locale/messages-en.ts +15 -1
  199. package/src/locale/messages-nb.ts +15 -1
  200. package/src/locale/messages-nn.ts +16 -2
  201. package/src/locale/messages-se.ts +14 -0
  202. package/src/locale/messages-sma.ts +15 -1
  203. package/src/main.scss +0 -2
  204. package/src/types.ts +0 -62
  205. package/es/Article/ArticleAccessMessage.js +0 -43
  206. package/es/Aside/Aside.js +0 -75
  207. package/es/Aside/index.js +0 -10
  208. package/es/BannerCard/BannerCard.js +0 -84
  209. package/es/BannerCard/index.js +0 -10
  210. package/es/Breadcrumb/HeaderBreadcrumb.js +0 -57
  211. package/es/CompetenceGoalTab/CompetenceGoalItem.js +0 -42
  212. package/es/CompetenceGoalTab/CompetenceGoalTab.js +0 -75
  213. package/es/CompetenceGoalTab/CompetenceItem.js +0 -108
  214. package/es/CompetenceGoalTab/CoreElementItem.js +0 -44
  215. package/es/CompetenceGoalTab/SearchButton.js +0 -43
  216. package/es/CompetenceGoalTab/index.js +0 -10
  217. package/es/CompetenceGoalTab/styles.js +0 -57
  218. package/es/Filter/FilterButtons.js +0 -185
  219. package/es/Filter/FilterCarousel.js +0 -166
  220. package/es/Filter/ToggleItem.js +0 -68
  221. package/es/Filter/index.js +0 -10
  222. package/es/Footer/EditorName.js +0 -20
  223. package/es/Footer/Footer.js +0 -83
  224. package/es/Footer/FooterLinks.js +0 -108
  225. package/es/Footer/FooterText.js +0 -25
  226. package/es/Frontpage/FrontpageAllSubjects.js +0 -254
  227. package/es/LearningPaths/LearningPathContent.js +0 -25
  228. package/es/LearningPaths/LearningPathInformation.js +0 -74
  229. package/es/LearningPaths/LearningPathLastStepNavigation.js +0 -65
  230. package/es/LearningPaths/LearningPathMenu.js +0 -103
  231. package/es/LearningPaths/LearningPathMenuAside.js +0 -62
  232. package/es/LearningPaths/LearningPathMenuContent.js +0 -109
  233. package/es/LearningPaths/LearningPathMenuIntro.js +0 -72
  234. package/es/LearningPaths/LearningPathMenuModalWrapper.js +0 -63
  235. package/es/LearningPaths/LearningPathMobileHeader.js +0 -35
  236. package/es/LearningPaths/LearningPathMobileStepInfo.js +0 -34
  237. package/es/LearningPaths/LearningPathSticky.js +0 -74
  238. package/es/LearningPaths/LearningPathWrapper.js +0 -27
  239. package/es/LearningPaths/index.js +0 -18
  240. package/es/MyNdla/Resource/FolderInput.js +0 -94
  241. package/es/NDLAFilm/AllMoviesAlphabetically.js +0 -127
  242. package/es/NDLAFilm/FilmContentCard.js +0 -93
  243. package/es/NDLAFilm/FilmContentCardTags.js +0 -44
  244. package/es/NDLAFilm/FilmMovieList.js +0 -52
  245. package/es/NDLAFilm/FilmMovieSearch.js +0 -106
  246. package/es/NDLAFilm/FilmSlideshow.js +0 -138
  247. package/es/NDLAFilm/MovieGrid.js +0 -54
  248. package/es/NDLAFilm/VisualElement.js +0 -48
  249. package/es/NDLAFilm/filmStyles.js +0 -31
  250. package/es/NDLAFilm/index.js +0 -14
  251. package/es/NDLAFilm/isLetter.js +0 -13
  252. package/es/NDLAFilm/types.js +0 -1
  253. package/es/Navigation/NavigationBox.js +0 -187
  254. package/es/Navigation/index.js +0 -10
  255. package/es/NoContentBox/NoContentBox.js +0 -31
  256. package/es/NoContentBox/index.js +0 -10
  257. package/es/Programme/Programme.js +0 -104
  258. package/es/Programme/ProgrammeSubjects.js +0 -60
  259. package/es/Programme/index.js +0 -12
  260. package/es/ResourceGroup/ResourceGroup.js +0 -46
  261. package/es/ResourceGroup/ResourceItem.js +0 -196
  262. package/es/ResourceGroup/ResourceList.js +0 -57
  263. package/es/ResourceGroup/index.js +0 -10
  264. package/es/ResourcesWrapper/ResourcesTopicTitle.js +0 -160
  265. package/es/ResourcesWrapper/ResourcesWrapper.js +0 -27
  266. package/es/ResourcesWrapper/index.js +0 -11
  267. package/es/SearchTypeResult/ActiveFilterContent.js +0 -53
  268. package/es/SearchTypeResult/ActiveFilters.js +0 -124
  269. package/es/SearchTypeResult/PopupFilter.js +0 -133
  270. package/es/SearchTypeResult/ResultNavigation.js +0 -75
  271. package/es/SearchTypeResult/SearchFieldHeader.js +0 -103
  272. package/es/SearchTypeResult/SearchFilterContent.js +0 -59
  273. package/es/SearchTypeResult/SearchHeader.js +0 -160
  274. package/es/SearchTypeResult/SearchItem.js +0 -97
  275. package/es/SearchTypeResult/SearchItemList.js +0 -142
  276. package/es/SearchTypeResult/SearchItems.js +0 -60
  277. package/es/SearchTypeResult/SearchSubjectItem.js +0 -62
  278. package/es/SearchTypeResult/SearchSubjectResult.js +0 -34
  279. package/es/SearchTypeResult/SearchTypeHeader.js +0 -118
  280. package/es/SearchTypeResult/SearchTypeResult.js +0 -55
  281. package/es/SearchTypeResult/SearchViewType.js +0 -90
  282. package/es/SearchTypeResult/components/ItemContexts.js +0 -122
  283. package/es/SearchTypeResult/components/ItemResourceHeader.js +0 -96
  284. package/es/SearchTypeResult/components/ItemTopicHeader.js +0 -66
  285. package/es/SearchTypeResult/components/SubjectFilters.js +0 -130
  286. package/es/SearchTypeResult/index.js +0 -14
  287. package/es/Subject/SubjectBanner.js +0 -30
  288. package/es/Subject/SubjectHeader.js +0 -66
  289. package/es/Subject/index.js +0 -10
  290. package/es/ToolboxPage/ToolboxInfo.js +0 -43
  291. package/es/ToolboxPage/index.js +0 -10
  292. package/es/Topic/Loader.js +0 -107
  293. package/es/Topic/Topic.js +0 -221
  294. package/es/Topic/index.js +0 -10
  295. package/es/locale/LocaleProvider.js +0 -38
  296. package/lib/Article/ArticleAccessMessage.d.ts +0 -12
  297. package/lib/Article/ArticleAccessMessage.js +0 -50
  298. package/lib/Aside/Aside.d.ts +0 -15
  299. package/lib/Aside/Aside.js +0 -80
  300. package/lib/Aside/index.d.ts +0 -9
  301. package/lib/Aside/index.js +0 -16
  302. package/lib/BannerCard/BannerCard.d.ts +0 -29
  303. package/lib/BannerCard/BannerCard.js +0 -92
  304. package/lib/BannerCard/index.d.ts +0 -9
  305. package/lib/BannerCard/index.js +0 -13
  306. package/lib/Breadcrumb/HeaderBreadcrumb.d.ts +0 -14
  307. package/lib/Breadcrumb/HeaderBreadcrumb.js +0 -64
  308. package/lib/CompetenceGoalTab/CompetenceGoalItem.d.ts +0 -10
  309. package/lib/CompetenceGoalTab/CompetenceGoalItem.js +0 -49
  310. package/lib/CompetenceGoalTab/CompetenceGoalTab.d.ts +0 -14
  311. package/lib/CompetenceGoalTab/CompetenceGoalTab.js +0 -82
  312. package/lib/CompetenceGoalTab/CompetenceItem.d.ts +0 -30
  313. package/lib/CompetenceGoalTab/CompetenceItem.js +0 -113
  314. package/lib/CompetenceGoalTab/CoreElementItem.d.ts +0 -10
  315. package/lib/CompetenceGoalTab/CoreElementItem.js +0 -51
  316. package/lib/CompetenceGoalTab/SearchButton.d.ts +0 -14
  317. package/lib/CompetenceGoalTab/SearchButton.js +0 -50
  318. package/lib/CompetenceGoalTab/index.d.ts +0 -9
  319. package/lib/CompetenceGoalTab/index.js +0 -16
  320. package/lib/CompetenceGoalTab/styles.d.ts +0 -28
  321. package/lib/CompetenceGoalTab/styles.js +0 -62
  322. package/lib/Filter/FilterButtons.d.ts +0 -16
  323. package/lib/Filter/FilterButtons.js +0 -192
  324. package/lib/Filter/FilterCarousel.d.ts +0 -13
  325. package/lib/Filter/FilterCarousel.js +0 -171
  326. package/lib/Filter/ToggleItem.d.ts +0 -21
  327. package/lib/Filter/ToggleItem.js +0 -75
  328. package/lib/Filter/index.d.ts +0 -9
  329. package/lib/Filter/index.js +0 -20
  330. package/lib/Footer/EditorName.d.ts +0 -13
  331. package/lib/Footer/EditorName.js +0 -27
  332. package/lib/Footer/Footer.d.ts +0 -30
  333. package/lib/Footer/Footer.js +0 -88
  334. package/lib/Footer/FooterLinks.d.ts +0 -26
  335. package/lib/Footer/FooterLinks.js +0 -115
  336. package/lib/Footer/FooterText.d.ts +0 -13
  337. package/lib/Footer/FooterText.js +0 -33
  338. package/lib/Frontpage/FrontpageAllSubjects.d.ts +0 -27
  339. package/lib/Frontpage/FrontpageAllSubjects.js +0 -259
  340. package/lib/LearningPaths/LearningPathContent.d.ts +0 -13
  341. package/lib/LearningPaths/LearningPathContent.js +0 -33
  342. package/lib/LearningPaths/LearningPathInformation.d.ts +0 -18
  343. package/lib/LearningPaths/LearningPathInformation.js +0 -80
  344. package/lib/LearningPaths/LearningPathLastStepNavigation.d.ts +0 -22
  345. package/lib/LearningPaths/LearningPathLastStepNavigation.js +0 -72
  346. package/lib/LearningPaths/LearningPathMenu.d.ts +0 -38
  347. package/lib/LearningPaths/LearningPathMenu.js +0 -110
  348. package/lib/LearningPaths/LearningPathMenuAside.d.ts +0 -24
  349. package/lib/LearningPaths/LearningPathMenuAside.js +0 -69
  350. package/lib/LearningPaths/LearningPathMenuContent.d.ts +0 -22
  351. package/lib/LearningPaths/LearningPathMenuContent.js +0 -116
  352. package/lib/LearningPaths/LearningPathMenuIntro.d.ts +0 -17
  353. package/lib/LearningPaths/LearningPathMenuIntro.js +0 -77
  354. package/lib/LearningPaths/LearningPathMenuModalWrapper.d.ts +0 -14
  355. package/lib/LearningPaths/LearningPathMenuModalWrapper.js +0 -70
  356. package/lib/LearningPaths/LearningPathMobileHeader.d.ts +0 -9
  357. package/lib/LearningPaths/LearningPathMobileHeader.js +0 -42
  358. package/lib/LearningPaths/LearningPathMobileStepInfo.d.ts +0 -13
  359. package/lib/LearningPaths/LearningPathMobileStepInfo.js +0 -41
  360. package/lib/LearningPaths/LearningPathSticky.d.ts +0 -22
  361. package/lib/LearningPaths/LearningPathSticky.js +0 -84
  362. package/lib/LearningPaths/LearningPathWrapper.d.ts +0 -14
  363. package/lib/LearningPaths/LearningPathWrapper.js +0 -35
  364. package/lib/LearningPaths/index.d.ts +0 -17
  365. package/lib/LearningPaths/index.js +0 -74
  366. package/lib/MyNdla/Resource/FolderInput.d.ts +0 -19
  367. package/lib/MyNdla/Resource/FolderInput.js +0 -101
  368. package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +0 -13
  369. package/lib/NDLAFilm/AllMoviesAlphabetically.js +0 -134
  370. package/lib/NDLAFilm/FilmContentCard.d.ts +0 -19
  371. package/lib/NDLAFilm/FilmContentCard.js +0 -98
  372. package/lib/NDLAFilm/FilmContentCardTags.d.ts +0 -15
  373. package/lib/NDLAFilm/FilmContentCardTags.js +0 -51
  374. package/lib/NDLAFilm/FilmMovieList.d.ts +0 -17
  375. package/lib/NDLAFilm/FilmMovieList.js +0 -59
  376. package/lib/NDLAFilm/FilmMovieSearch.d.ts +0 -21
  377. package/lib/NDLAFilm/FilmMovieSearch.js +0 -113
  378. package/lib/NDLAFilm/FilmSlideshow.d.ts +0 -13
  379. package/lib/NDLAFilm/FilmSlideshow.js +0 -143
  380. package/lib/NDLAFilm/MovieGrid.d.ts +0 -17
  381. package/lib/NDLAFilm/MovieGrid.js +0 -61
  382. package/lib/NDLAFilm/VisualElement.d.ts +0 -16
  383. package/lib/NDLAFilm/VisualElement.js +0 -53
  384. package/lib/NDLAFilm/filmStyles.d.ts +0 -17
  385. package/lib/NDLAFilm/filmStyles.js +0 -39
  386. package/lib/NDLAFilm/index.d.ts +0 -13
  387. package/lib/NDLAFilm/index.js +0 -41
  388. package/lib/NDLAFilm/isLetter.js +0 -20
  389. package/lib/NDLAFilm/types.d.ts +0 -22
  390. package/lib/NDLAFilm/types.js +0 -5
  391. package/lib/Navigation/NavigationBox.d.ts +0 -30
  392. package/lib/Navigation/NavigationBox.js +0 -193
  393. package/lib/Navigation/index.d.ts +0 -9
  394. package/lib/Navigation/index.js +0 -13
  395. package/lib/NoContentBox/NoContentBox.d.ts +0 -14
  396. package/lib/NoContentBox/NoContentBox.js +0 -38
  397. package/lib/NoContentBox/index.d.ts +0 -9
  398. package/lib/NoContentBox/index.js +0 -16
  399. package/lib/Programme/Programme.d.ts +0 -16
  400. package/lib/Programme/Programme.js +0 -112
  401. package/lib/Programme/ProgrammeSubjects.d.ts +0 -26
  402. package/lib/Programme/ProgrammeSubjects.js +0 -67
  403. package/lib/Programme/index.d.ts +0 -11
  404. package/lib/Programme/index.js +0 -23
  405. package/lib/ResourceGroup/ResourceGroup.d.ts +0 -18
  406. package/lib/ResourceGroup/ResourceGroup.js +0 -53
  407. package/lib/ResourceGroup/ResourceItem.d.ts +0 -22
  408. package/lib/ResourceGroup/ResourceItem.js +0 -203
  409. package/lib/ResourceGroup/ResourceList.d.ts +0 -19
  410. package/lib/ResourceGroup/ResourceList.js +0 -64
  411. package/lib/ResourceGroup/index.d.ts +0 -9
  412. package/lib/ResourceGroup/index.js +0 -16
  413. package/lib/ResourcesWrapper/ResourcesTopicTitle.d.ts +0 -20
  414. package/lib/ResourcesWrapper/ResourcesTopicTitle.js +0 -165
  415. package/lib/ResourcesWrapper/ResourcesWrapper.d.ts +0 -16
  416. package/lib/ResourcesWrapper/ResourcesWrapper.js +0 -34
  417. package/lib/ResourcesWrapper/index.d.ts +0 -10
  418. package/lib/ResourcesWrapper/index.js +0 -23
  419. package/lib/SearchTypeResult/ActiveFilterContent.d.ts +0 -23
  420. package/lib/SearchTypeResult/ActiveFilterContent.js +0 -58
  421. package/lib/SearchTypeResult/ActiveFilters.d.ts +0 -18
  422. package/lib/SearchTypeResult/ActiveFilters.js +0 -131
  423. package/lib/SearchTypeResult/PopupFilter.d.ts +0 -26
  424. package/lib/SearchTypeResult/PopupFilter.js +0 -138
  425. package/lib/SearchTypeResult/ResultNavigation.d.ts +0 -18
  426. package/lib/SearchTypeResult/ResultNavigation.js +0 -82
  427. package/lib/SearchTypeResult/SearchFieldHeader.d.ts +0 -17
  428. package/lib/SearchTypeResult/SearchFieldHeader.js +0 -109
  429. package/lib/SearchTypeResult/SearchFilterContent.d.ts +0 -16
  430. package/lib/SearchTypeResult/SearchFilterContent.js +0 -64
  431. package/lib/SearchTypeResult/SearchHeader.d.ts +0 -26
  432. package/lib/SearchTypeResult/SearchHeader.js +0 -166
  433. package/lib/SearchTypeResult/SearchItem.d.ts +0 -30
  434. package/lib/SearchTypeResult/SearchItem.js +0 -104
  435. package/lib/SearchTypeResult/SearchItemList.d.ts +0 -10
  436. package/lib/SearchTypeResult/SearchItemList.js +0 -147
  437. package/lib/SearchTypeResult/SearchItems.d.ts +0 -17
  438. package/lib/SearchTypeResult/SearchItems.js +0 -65
  439. package/lib/SearchTypeResult/SearchSubjectItem.d.ts +0 -20
  440. package/lib/SearchTypeResult/SearchSubjectItem.js +0 -67
  441. package/lib/SearchTypeResult/SearchSubjectResult.d.ts +0 -13
  442. package/lib/SearchTypeResult/SearchSubjectResult.js +0 -41
  443. package/lib/SearchTypeResult/SearchTypeHeader.d.ts +0 -22
  444. package/lib/SearchTypeResult/SearchTypeHeader.js +0 -123
  445. package/lib/SearchTypeResult/SearchTypeResult.d.ts +0 -26
  446. package/lib/SearchTypeResult/SearchTypeResult.js +0 -62
  447. package/lib/SearchTypeResult/SearchViewType.d.ts +0 -13
  448. package/lib/SearchTypeResult/SearchViewType.js +0 -95
  449. package/lib/SearchTypeResult/components/ItemContexts.d.ts +0 -19
  450. package/lib/SearchTypeResult/components/ItemContexts.js +0 -127
  451. package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +0 -16
  452. package/lib/SearchTypeResult/components/ItemResourceHeader.js +0 -101
  453. package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +0 -17
  454. package/lib/SearchTypeResult/components/ItemTopicHeader.js +0 -71
  455. package/lib/SearchTypeResult/components/SubjectFilters.d.ts +0 -32
  456. package/lib/SearchTypeResult/components/SubjectFilters.js +0 -135
  457. package/lib/SearchTypeResult/index.d.ts +0 -14
  458. package/lib/SearchTypeResult/index.js +0 -41
  459. package/lib/Subject/SubjectBanner.d.ts +0 -14
  460. package/lib/Subject/SubjectBanner.js +0 -37
  461. package/lib/Subject/SubjectHeader.d.ts +0 -17
  462. package/lib/Subject/SubjectHeader.js +0 -73
  463. package/lib/Subject/index.d.ts +0 -9
  464. package/lib/Subject/index.js +0 -20
  465. package/lib/ToolboxPage/ToolboxInfo.d.ts +0 -18
  466. package/lib/ToolboxPage/ToolboxInfo.js +0 -49
  467. package/lib/ToolboxPage/index.d.ts +0 -9
  468. package/lib/ToolboxPage/index.js +0 -13
  469. package/lib/Topic/Loader.d.ts +0 -9
  470. package/lib/Topic/Loader.js +0 -114
  471. package/lib/Topic/Topic.d.ts +0 -34
  472. package/lib/Topic/Topic.js +0 -228
  473. package/lib/Topic/index.d.ts +0 -10
  474. package/lib/Topic/index.js +0 -16
  475. package/lib/locale/LocaleProvider.d.ts +0 -15
  476. package/lib/locale/LocaleProvider.js +0 -44
  477. package/src/Article/ArticleAccessMessage.tsx +0 -44
  478. package/src/Aside/Aside.tsx +0 -113
  479. package/src/Aside/index.ts +0 -11
  480. package/src/BannerCard/BannerCard.tsx +0 -99
  481. package/src/BannerCard/index.ts +0 -11
  482. package/src/Breadcrumb/HeaderBreadcrumb.tsx +0 -56
  483. package/src/CompetenceGoalTab/CompetenceGoalItem.tsx +0 -39
  484. package/src/CompetenceGoalTab/CompetenceGoalTab.tsx +0 -85
  485. package/src/CompetenceGoalTab/CompetenceItem.tsx +0 -130
  486. package/src/CompetenceGoalTab/CoreElementItem.tsx +0 -39
  487. package/src/CompetenceGoalTab/SearchButton.tsx +0 -50
  488. package/src/CompetenceGoalTab/index.ts +0 -10
  489. package/src/CompetenceGoalTab/styles.ts +0 -37
  490. package/src/Figure/component.figure.scss +0 -60
  491. package/src/Filter/FilterButtons.tsx +0 -199
  492. package/src/Filter/FilterCarousel.tsx +0 -172
  493. package/src/Filter/ToggleItem.tsx +0 -180
  494. package/src/Filter/index.ts +0 -10
  495. package/src/Footer/EditorName.tsx +0 -19
  496. package/src/Footer/Footer.tsx +0 -107
  497. package/src/Footer/FooterLinks.tsx +0 -144
  498. package/src/Footer/FooterText.tsx +0 -35
  499. package/src/Frontpage/FrontpageAllSubjects.tsx +0 -231
  500. package/src/LearningPaths/LearningPathContent.tsx +0 -33
  501. package/src/LearningPaths/LearningPathInformation.tsx +0 -82
  502. package/src/LearningPaths/LearningPathLastStepNavigation.tsx +0 -89
  503. package/src/LearningPaths/LearningPathMenu.stories.tsx +0 -65
  504. package/src/LearningPaths/LearningPathMenu.tsx +0 -166
  505. package/src/LearningPaths/LearningPathMenuAside.tsx +0 -100
  506. package/src/LearningPaths/LearningPathMenuContent.tsx +0 -277
  507. package/src/LearningPaths/LearningPathMenuIntro.tsx +0 -126
  508. package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +0 -71
  509. package/src/LearningPaths/LearningPathMobileHeader.tsx +0 -37
  510. package/src/LearningPaths/LearningPathMobileStepInfo.tsx +0 -38
  511. package/src/LearningPaths/LearningPathSticky.tsx +0 -122
  512. package/src/LearningPaths/LearningPathWrapper.tsx +0 -36
  513. package/src/LearningPaths/index.ts +0 -19
  514. package/src/MyNdla/Resource/FolderInput.stories.tsx +0 -27
  515. package/src/MyNdla/Resource/FolderInput.tsx +0 -89
  516. package/src/NDLAFilm/AllMoviesAlphabetically.tsx +0 -160
  517. package/src/NDLAFilm/FilmContentCard.tsx +0 -138
  518. package/src/NDLAFilm/FilmContentCardTags.tsx +0 -57
  519. package/src/NDLAFilm/FilmMovieList.tsx +0 -54
  520. package/src/NDLAFilm/FilmMovieSearch.tsx +0 -135
  521. package/src/NDLAFilm/FilmSlideshow.tsx +0 -177
  522. package/src/NDLAFilm/MovieGrid.tsx +0 -86
  523. package/src/NDLAFilm/VisualElement.tsx +0 -38
  524. package/src/NDLAFilm/__tests__/isLetter-test.ts +0 -20
  525. package/src/NDLAFilm/filmStyles.ts +0 -49
  526. package/src/NDLAFilm/index.ts +0 -15
  527. package/src/NDLAFilm/isLetter.ts +0 -13
  528. package/src/NDLAFilm/types.ts +0 -24
  529. package/src/Navigation/NavigationBox.tsx +0 -252
  530. package/src/Navigation/index.ts +0 -11
  531. package/src/NoContentBox/NoContentBox.tsx +0 -32
  532. package/src/NoContentBox/index.ts +0 -11
  533. package/src/Programme/Programme.tsx +0 -101
  534. package/src/Programme/ProgrammeSubjects.tsx +0 -83
  535. package/src/Programme/index.ts +0 -13
  536. package/src/ResourceGroup/ResourceGroup.tsx +0 -65
  537. package/src/ResourceGroup/ResourceItem.stories.tsx +0 -101
  538. package/src/ResourceGroup/ResourceItem.tsx +0 -318
  539. package/src/ResourceGroup/ResourceList.tsx +0 -80
  540. package/src/ResourceGroup/index.ts +0 -11
  541. package/src/ResourcesWrapper/ResourcesTopicTitle.tsx +0 -223
  542. package/src/ResourcesWrapper/ResourcesWrapper.tsx +0 -32
  543. package/src/ResourcesWrapper/index.ts +0 -13
  544. package/src/SearchTypeResult/ActiveFilterContent.tsx +0 -55
  545. package/src/SearchTypeResult/ActiveFilters.tsx +0 -163
  546. package/src/SearchTypeResult/PopupFilter.tsx +0 -149
  547. package/src/SearchTypeResult/ResultNavigation.tsx +0 -105
  548. package/src/SearchTypeResult/SearchFieldHeader.tsx +0 -129
  549. package/src/SearchTypeResult/SearchFilterContent.tsx +0 -61
  550. package/src/SearchTypeResult/SearchHeader.tsx +0 -180
  551. package/src/SearchTypeResult/SearchItem.tsx +0 -144
  552. package/src/SearchTypeResult/SearchItemList.tsx +0 -161
  553. package/src/SearchTypeResult/SearchItems.tsx +0 -72
  554. package/src/SearchTypeResult/SearchSubjectItem.tsx +0 -74
  555. package/src/SearchTypeResult/SearchSubjectResult.tsx +0 -58
  556. package/src/SearchTypeResult/SearchTypeHeader.tsx +0 -148
  557. package/src/SearchTypeResult/SearchTypeResult.tsx +0 -89
  558. package/src/SearchTypeResult/SearchViewType.tsx +0 -111
  559. package/src/SearchTypeResult/components/ItemContexts.tsx +0 -131
  560. package/src/SearchTypeResult/components/ItemResourceHeader.tsx +0 -130
  561. package/src/SearchTypeResult/components/ItemTopicHeader.tsx +0 -88
  562. package/src/SearchTypeResult/components/SubjectFilters.tsx +0 -149
  563. package/src/SearchTypeResult/index.ts +0 -17
  564. package/src/Subject/SubjectBanner.tsx +0 -39
  565. package/src/Subject/SubjectHeader.tsx +0 -100
  566. package/src/Subject/index.ts +0 -10
  567. package/src/ToolboxPage/ToolboxInfo.tsx +0 -42
  568. package/src/ToolboxPage/index.ts +0 -11
  569. package/src/Topic/Loader.tsx +0 -29
  570. package/src/Topic/Topic.tsx +0 -348
  571. package/src/Topic/index.ts +0 -13
  572. package/src/locale/LocaleProvider.tsx +0 -31
@@ -50,10 +50,6 @@ export const CollapseLast: StoryObj<typeof Breadcrumb> = {
50
50
  args: { collapseLast: true },
51
51
  };
52
52
 
53
- export const AutoCollapse: StoryObj<typeof Breadcrumb> = {
54
- args: { autoCollapse: true },
55
- };
56
-
57
53
  export const CustomSeparator: StoryObj<typeof Breadcrumb> = {
58
54
  args: {
59
55
  renderSeparator: (item, totalCount) => (
@@ -9,12 +9,10 @@
9
9
  import { ReactNode, useRef } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
11
  import styled from "@emotion/styled";
12
- import { useComponentSize, useIsomorphicLayoutEffect } from "@ndla/hooks";
13
12
  import BreadcrumbItem, { IndexedBreadcrumbItem, SimpleBreadcrumbItem } from "./BreadcrumbItem";
14
13
 
15
14
  interface Props {
16
15
  items: SimpleBreadcrumbItem[];
17
- autoCollapse?: boolean;
18
16
  collapseFirst?: boolean;
19
17
  collapseLast?: boolean;
20
18
  renderItem?: (item: IndexedBreadcrumbItem, totalCount: number) => ReactNode;
@@ -31,50 +29,18 @@ const StyledList = styled.ol`
31
29
  list-style: none;
32
30
  `;
33
31
 
34
- const Breadcrumb = ({
35
- items,
36
- autoCollapse,
37
- renderItem,
38
- renderSeparator,
39
- collapseFirst,
40
- collapseLast = true,
41
- }: Props) => {
32
+ const Breadcrumb = ({ items, renderItem, renderSeparator, collapseFirst, collapseLast = true }: Props) => {
42
33
  const { t } = useTranslation();
43
34
  const olRef = useRef<any>();
44
35
  const containerRef = useRef<HTMLDivElement>(null);
45
36
  // No idiomatic way of dealing with sets of refs yet
46
37
  // See: https://github.com/facebook/react/issues/14072#issuecomment-446777406
47
- const breadcrumbItemRefs = useRef(new Map()).current;
48
- const size = useComponentSize(containerRef);
49
-
50
- useIsomorphicLayoutEffect(() => {
51
- if (!autoCollapse) {
52
- return;
53
- }
54
- // Create an array of all breadcrumb item refs
55
- const items = Array.from(breadcrumbItemRefs).map(([key, value]) => value);
56
-
57
- // Clear max width on all items
58
- items.forEach((el) => {
59
- el.setMaxWidth("none");
60
- });
61
-
62
- // Set maxWidth on breadcrumb text items iteratively until
63
- // the ordered list fits on a single line. It's on a single line
64
- // if the height of the list is less then 70.
65
- items.forEach((el) => {
66
- if (olRef.current.offsetHeight > 60) {
67
- el.setMaxWidth("40px");
68
- }
69
- });
70
- }, [size, items]);
71
38
 
72
39
  return (
73
40
  <BreadcrumbNav ref={containerRef} aria-label={t("breadcrumb.breadcrumb")}>
74
41
  <StyledList ref={olRef}>
75
42
  {items.map((item, index) => (
76
43
  <BreadcrumbItem
77
- autoCollapse={autoCollapse}
78
44
  renderItem={renderItem}
79
45
  renderSeparator={renderSeparator}
80
46
  ref={(element) => {
@@ -86,9 +52,6 @@ const Breadcrumb = ({
86
52
  if (element) {
87
53
  element.setMaxWidth("none");
88
54
  }
89
- breadcrumbItemRefs.delete(item.to);
90
- } else {
91
- breadcrumbItemRefs.set(item.to, element);
92
55
  }
93
56
  }}
94
57
  key={typeof item.to === "string" ? item.to : item.to.pathname}
@@ -7,7 +7,6 @@
7
7
  */
8
8
 
9
9
  import { useRef, useImperativeHandle, ReactNode, forwardRef } from "react";
10
- import { css } from "@emotion/react";
11
10
  import styled from "@emotion/styled";
12
11
  import { mq, spacing, breakpoints } from "@ndla/core";
13
12
  import { ChevronRight } from "@ndla/icons/common";
@@ -38,27 +37,14 @@ const StyledListItem = styled.li<AutoCollapseProps>`
38
37
  :before {
39
38
  display: none;
40
39
  }
41
-
42
- ${({ autoCollapse }) =>
43
- !autoCollapse &&
44
- css`
45
- ${mq.range({ until: breakpoints.tablet })} {
46
- display: block;
47
- }
48
- `}
40
+ ${mq.range({ until: breakpoints.tablet })} {
41
+ display: block;
42
+ }
49
43
  `;
50
44
 
51
- const CollapseContainer = styled.div<AutoCollapseProps>`
45
+ const CollapseContainer = styled.div`
52
46
  display: inline-block;
53
47
  color: inherit;
54
- ${({ autoCollapse }) =>
55
- autoCollapse &&
56
- css`
57
- text-overflow: ellipsis;
58
- white-space: nowrap;
59
- overflow: hidden;
60
- display: inline-block;
61
- `}
62
48
  `;
63
49
 
64
50
  const StyledChevron = styled(ChevronRight)`
@@ -92,7 +78,7 @@ const BreadcrumbItem = forwardRef<any, Props>(
92
78
  const isLast = index === totalCount - 1;
93
79
  return (
94
80
  <StyledListItem ref={liRef} autoCollapse={autoCollapse} aria-current={isLast ? "page" : undefined}>
95
- <CollapseContainer autoCollapse={autoCollapse}>
81
+ <CollapseContainer>
96
82
  {renderItem ? (
97
83
  renderItem(item, totalCount)
98
84
  ) : isLast ? (
@@ -10,8 +10,6 @@ import Breadcrumb from "./Breadcrumb";
10
10
 
11
11
  export type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from "./BreadcrumbItem";
12
12
 
13
- export { default as HeaderBreadcrumb } from "./HeaderBreadcrumb";
14
-
15
13
  export { default as HomeBreadcrumb } from "./HomeBreadcrumb";
16
14
 
17
15
  export default Breadcrumb;
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Copyright (c) 2023-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 { Meta, StoryFn, StoryObj } from "@storybook/react";
10
+ import { IconButtonV2 } from "@ndla/button";
11
+ import { DeleteForever } from "@ndla/icons/editor";
12
+ import CodeBlock from "./CodeBlock";
13
+
14
+ export default {
15
+ title: "Components/CodeBlock",
16
+ component: CodeBlock,
17
+ tags: ["autodocs"],
18
+ parameters: {
19
+ inlineStories: true,
20
+ },
21
+ args: {
22
+ title: "CodeBlock",
23
+ format: "html",
24
+ highlightedCode: `<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>demo-content<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
25
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>h2</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>h2</span><span class="token punctuation">></span></span>
26
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>
27
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>b</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>b</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>br</span><span class="token punctuation">/></span></span>
28
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">></span></span>is simply dummy text of the printing and typesetting industry<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">></span></span>
29
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span>
30
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>
31
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>b</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>b</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>br</span><span class="token punctuation">/></span></span>
32
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">></span></span>is simply dummy text of the printing and typesetting industry<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">></span></span>
33
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span>
34
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">></span></span>
35
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>b</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>b</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>br</span><span class="token punctuation">/></span></span>
36
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">></span></span>is simply dummy text of the printing and typesetting industry<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">></span></span>
37
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">></span></span>
38
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">></span></span>`,
39
+ code: `<div class="demo-content">
40
+ <h2>Lorem ipsum</h2>
41
+ <p>
42
+ <b>Lorem ipsum</b><br/>
43
+ <span>is simply dummy text of the printing and typesetting industry</span>
44
+ </p>
45
+ <p>
46
+ <b>Lorem ipsum</b><br/>
47
+ <span>is simply dummy text of the printing and typesetting industry</span>
48
+ </p>
49
+ <p>
50
+ <b>Lorem ipsum</b><br/>
51
+ <span>is simply dummy text of the printing and typesetting industry</span>
52
+ </p>
53
+ </div>`,
54
+ actionButton: (
55
+ <IconButtonV2 aria-label="Slett" variant="ghost" colorTheme="danger">
56
+ <DeleteForever />
57
+ </IconButtonV2>
58
+ ),
59
+ showCopy: true,
60
+ },
61
+ argTypes: {
62
+ actionButton: {
63
+ table: {
64
+ type: {
65
+ detail: "Takes any ReactNode, but as the name implies: use a button component, preferably an icon-button",
66
+ },
67
+ },
68
+ control: {
69
+ type: null,
70
+ },
71
+ },
72
+ },
73
+ } as Meta<typeof CodeBlock>;
74
+
75
+ export const HTML: StoryFn<typeof CodeBlock> = (args) => {
76
+ return <CodeBlock {...args} />;
77
+ };
78
+
79
+ export const CSS: StoryObj<typeof CodeBlock> = {
80
+ args: {
81
+ highlightedCode: `<span class="token selector">body</span> <span class="token punctuation">{</span>
82
+ <span class="token property">padding</span><span class="token punctuation">:</span> <span class="token number">20</span><span class="token unit">px</span><span class="token punctuation">;</span>
83
+ <span class="token property">margin</span><span class="token punctuation">:</span> <span class="token number">10</span><span class="token unit">px</span><span class="token punctuation">;</span>
84
+ <span class="token property">background</span><span class="token punctuation">:</span> <span class="token hexcode color">#ccc</span><span class="token punctuation">;</span>
85
+ <span class="token punctuation">}</span>`,
86
+ code: `body {
87
+ padding: 20px;
88
+ margin: 10px;
89
+ background: #ccc;
90
+ }`,
91
+ format: "css",
92
+ },
93
+ };
94
+
95
+ export const JS: StoryObj<typeof CodeBlock> = {
96
+ args: {
97
+ highlightedCode: `<span class="token keyword">const</span> arr <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token string">"This"</span><span class="token punctuation">,</span> <span class="token string">"Little"</span><span class="token punctuation">,</span> <span class="token string">"Piggy"</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
98
+ <span class="token keyword">const</span> first <span class="token operator">=</span> arr<span class="token punctuation">.</span><span class="token method function property-access">shift</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
99
+ <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span>first<span class="token punctuation">)</span><span class="token punctuation">;</span>`,
100
+ code: `const arr = ["This", "Little", "Piggy"];
101
+ const first = arr.shift();
102
+ console.log(first);`,
103
+ format: "js",
104
+ },
105
+ };
106
+
107
+ export const Text: StoryObj<typeof CodeBlock> = {
108
+ args: {
109
+ highlightedCode: `Pure text without highlighting and no title`,
110
+ code: `Pure text without highlighting and no title`,
111
+ format: "text",
112
+ },
113
+ };
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Copyright (c) 2020-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 { useState, useEffect, ReactNode, useMemo } from "react";
10
+ import { useTranslation } from "react-i18next";
11
+ import styled from "@emotion/styled";
12
+ import { ButtonV2 } from "@ndla/button";
13
+ import { colors, fonts, spacing } from "@ndla/core";
14
+ import { Copy } from "@ndla/icons/action";
15
+ import { Done } from "@ndla/icons/editor";
16
+ import { copyTextToClipboard } from "@ndla/util";
17
+ import { ICodeLangugeOption, codeLanguageOptions } from "./codeLanguageOptions";
18
+
19
+ const Wrapper = styled.div`
20
+ margin: 15px 0;
21
+ `;
22
+
23
+ const TitleBar = styled.div`
24
+ display: flex;
25
+ justify-content: space-between;
26
+ width: 100%;
27
+ `;
28
+
29
+ const Title = styled.h3`
30
+ font-style: normal;
31
+ font-weight: normal;
32
+ font-size: 16px;
33
+ line-height: 32px;
34
+ letter-spacing: 1px;
35
+ text-transform: uppercase;
36
+ color: ${colors.text.primary};
37
+ margin: 5px 0;
38
+ `;
39
+
40
+ type Props = {
41
+ code: string;
42
+ highlightedCode: string;
43
+ format: string;
44
+ title?: string | null;
45
+ actionButton?: ReactNode;
46
+ showCopy?: boolean;
47
+ };
48
+
49
+ const StyledPre = styled.pre`
50
+ border-left: 4px solid ${colors.brand.dark};
51
+ background-color: ${colors.brand.greyLighter};
52
+ box-sizing: border-box;
53
+ overflow-x: auto;
54
+ .linenumber {
55
+ display: inline-block;
56
+ padding: 0 ${spacing.small};
57
+ border-right: 1px solid #d8d8d8;
58
+ margin-right: ${spacing.small};
59
+ color: #7d8b99;
60
+ text-align: right;
61
+ width: 40px;
62
+ }
63
+ .linenumber[data-first] {
64
+ padding-top: ${spacing.small};
65
+ }
66
+ .linenumber[data-last] {
67
+ padding-bottom: ${spacing.small};
68
+ }
69
+ code {
70
+ display: block;
71
+ ${fonts.sizes("14px", "20px")};
72
+ font-family:
73
+ Source Code Pro,
74
+ Monaco;
75
+ margin: 0;
76
+ padding: 0;
77
+ white-space: pre;
78
+ }
79
+ code::before {
80
+ content: none;
81
+ }
82
+ &::before,
83
+ &::after {
84
+ content: none !important;
85
+ }
86
+
87
+ /* The remaining css is copied from the coy theme in prismjs. A lot of css is omitted due to styling clashes */
88
+ .token.comment,
89
+ .token.block-comment,
90
+ .token.prolog,
91
+ .token.doctype,
92
+ .token.cdata {
93
+ color: #7d8b99;
94
+ }
95
+
96
+ .token.punctuation {
97
+ color: #5f6364;
98
+ }
99
+
100
+ .token.property,
101
+ .token.tag,
102
+ .token.boolean,
103
+ .token.number,
104
+ .token.function-name,
105
+ .token.constant,
106
+ .token.symbol,
107
+ .token.deleted {
108
+ color: #c92c2c;
109
+ }
110
+
111
+ .token.selector,
112
+ .token.attr-name,
113
+ .token.string,
114
+ .token.char,
115
+ .token.function,
116
+ .token.builtin,
117
+ .token.inserted {
118
+ color: #2f9c0a;
119
+ }
120
+
121
+ .token.operator,
122
+ .token.entity,
123
+ .token.url,
124
+ .token.variable {
125
+ color: #a67f59;
126
+ background: rgba(255, 255, 255, 0.5);
127
+ }
128
+
129
+ .token.atrule,
130
+ .token.attr-value,
131
+ .token.keyword,
132
+ .token.class-name {
133
+ color: #1990b8;
134
+ }
135
+
136
+ .token.regex,
137
+ .token.important {
138
+ color: #e90;
139
+ }
140
+
141
+ .language-css .token.string,
142
+ .style .token.string {
143
+ color: #a67f59;
144
+ background: rgba(255, 255, 255, 0.5);
145
+ }
146
+
147
+ .token.important {
148
+ font-weight: normal;
149
+ }
150
+
151
+ .token.bold {
152
+ font-weight: bold;
153
+ }
154
+ .token.italic {
155
+ font-style: italic;
156
+ }
157
+
158
+ .token.entity {
159
+ cursor: help;
160
+ }
161
+
162
+ .token.namespace {
163
+ opacity: 0.7;
164
+ }
165
+ `;
166
+
167
+ const getTitleFromFormat = (format: string) => {
168
+ const selectedLanguage = codeLanguageOptions.find((item: ICodeLangugeOption) => item.format === format);
169
+ if (selectedLanguage) {
170
+ return selectedLanguage.title;
171
+ }
172
+ return;
173
+ };
174
+
175
+ export const Codeblock = ({ actionButton, code, highlightedCode, format, showCopy = false, title }: Props) => {
176
+ const { t } = useTranslation();
177
+ const [isCopied, setIsCopied] = useState(false);
178
+
179
+ const codeWithLineNumbers = useMemo(() => {
180
+ return highlightedCode
181
+ .split("\n")
182
+ .map((line, i, arr) => {
183
+ return `<span><span class="linenumber" ${i === 0 ? 'data-first=""' : ""} ${
184
+ i === arr.length - 1 ? 'data-last=""' : ""
185
+ }>${i + 1}</span>${line}</span>`;
186
+ })
187
+ .join("\n");
188
+ }, [highlightedCode]);
189
+
190
+ useEffect(() => {
191
+ if (isCopied) {
192
+ const timer = setInterval(() => setIsCopied(false), 3000);
193
+ // ensure interval is cleared - also if unmounted
194
+ return () => {
195
+ clearTimeout(timer);
196
+ };
197
+ }
198
+ }, [isCopied]);
199
+
200
+ return (
201
+ <Wrapper>
202
+ <TitleBar>
203
+ <Title>{title || getTitleFromFormat(format)}</Title>
204
+ {actionButton}
205
+ </TitleBar>
206
+ <StyledPre>
207
+ <code className={`language-${format}`} dangerouslySetInnerHTML={{ __html: codeWithLineNumbers }} />
208
+ </StyledPre>
209
+ {showCopy && (
210
+ <ButtonV2
211
+ title={t("codeBlock.copyButton")}
212
+ disabled={isCopied}
213
+ data-copied-title={t("codeBlock.copiedCode")}
214
+ data-copy-string={code}
215
+ onClick={() => {
216
+ copyTextToClipboard(code);
217
+ setIsCopied(true);
218
+ }}
219
+ >
220
+ {isCopied ? <Done aria-hidden="true" /> : <Copy aria-hidden="true" />}{" "}
221
+ {isCopied ? t("codeBlock.copiedCode") : t("codeBlock.copyCode")}
222
+ </ButtonV2>
223
+ )}
224
+ </Wrapper>
225
+ );
226
+ };
227
+
228
+ export default Codeblock;
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright (c) 2019-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
+ export const codeLanguageOptions: Array<ICodeLangugeOption> = [
10
+ {
11
+ title: "Bash",
12
+ format: "bash",
13
+ },
14
+ {
15
+ title: "C",
16
+ format: "c",
17
+ },
18
+ {
19
+ title: "CSharp",
20
+ format: "csharp",
21
+ },
22
+ {
23
+ title: "CSS",
24
+ format: "css",
25
+ },
26
+ {
27
+ title: "Diff",
28
+ format: "diff",
29
+ },
30
+ {
31
+ title: "HTML",
32
+ format: "markup",
33
+ },
34
+ {
35
+ title: "Ini",
36
+ format: "ini",
37
+ },
38
+ {
39
+ title: "Java",
40
+ format: "java",
41
+ },
42
+ {
43
+ title: "Javascript",
44
+ format: "js",
45
+ },
46
+ {
47
+ title: "JSON",
48
+ format: "json",
49
+ },
50
+ {
51
+ title: "JSX",
52
+ format: "jsx",
53
+ },
54
+ {
55
+ title: "Kotlin",
56
+ format: "kotlin",
57
+ },
58
+ {
59
+ title: "LUA",
60
+ format: "lua",
61
+ },
62
+ {
63
+ title: "Markdown",
64
+ format: "markdown",
65
+ },
66
+ {
67
+ title: "Matlab",
68
+ format: "matlab",
69
+ },
70
+ {
71
+ title: "NSIS",
72
+ format: "nsis",
73
+ },
74
+ {
75
+ title: "PHP",
76
+ format: "php",
77
+ },
78
+ {
79
+ title: "Powershell",
80
+ format: "powershell",
81
+ },
82
+ {
83
+ title: "Python",
84
+ format: "python",
85
+ },
86
+ {
87
+ title: "Ruby",
88
+ format: "ruby",
89
+ },
90
+ {
91
+ title: "Rust",
92
+ format: "rust",
93
+ },
94
+ {
95
+ title: "SQL",
96
+ format: "sql",
97
+ },
98
+ {
99
+ title: "Text",
100
+ format: "text",
101
+ },
102
+ {
103
+ title: "VHDL",
104
+ format: "vhdl",
105
+ },
106
+ {
107
+ title: "XML",
108
+ format: "xml",
109
+ },
110
+ ];
111
+
112
+ export interface ICodeLangugeOption {
113
+ title: string;
114
+ format: string;
115
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2024-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
+ export { default as CodeBlock } from "./CodeBlock";
10
+ export { codeLanguageOptions } from "./codeLanguageOptions";
@@ -51,11 +51,11 @@ const CreatedBy = ({ name, description, url, target = "_blank" }: Props) => (
51
51
  name
52
52
  )}
53
53
  &nbsp;{description}&nbsp;
54
- <StyledSafeLink to={`https://ndla.no`} target={target}>
54
+ <StyledSafeLink to={"https://ndla.no"} target={target}>
55
55
  NDLA
56
56
  </StyledSafeLink>
57
57
  </Text>
58
- <Logo label={`NDLA`} to={`https://ndla.no`} />
58
+ <Logo label={"NDLA"} to={"https://ndla.no"} />
59
59
  </Wrapper>
60
60
  </Container>
61
61
  );
@@ -10,6 +10,8 @@ import { Meta, StoryObj } from "@storybook/react";
10
10
  import { AudioEmbedData, AudioMeta } from "@ndla/types-embed";
11
11
  import AudioEmbed from "./AudioEmbed";
12
12
  import StoryFavoriteButton from "../../../../stories/StoryFavoriteButton";
13
+ import { ArticleWrapper } from "../Article";
14
+ import { OneColumn } from "../Layout";
13
15
 
14
16
  const embedData: AudioEmbedData = {
15
17
  resource: "audio",
@@ -186,15 +188,15 @@ const meta: Meta<typeof AudioEmbed> = {
186
188
  tags: ["autodocs"],
187
189
  decorators: [
188
190
  (Story) => (
189
- <div className="o-wrapper">
190
- <article className="c-article c-article--clean">
191
+ <OneColumn>
192
+ <ArticleWrapper modifier="clean">
191
193
  <section className="u-4/6@desktop u-push-1/6@desktop u-10/12@tablet u-push-1/12@tablet">
192
194
  <section>
193
195
  <Story />
194
196
  </section>
195
197
  </section>
196
- </article>
197
- </div>
198
+ </ArticleWrapper>
199
+ </OneColumn>
198
200
  ),
199
201
  ],
200
202
  };