@ndla/ui 51.0.0 → 53.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.
- package/README.md +2 -2
- package/es/Article/Article.js +113 -120
- package/es/Article/ArticleHeaderWrapper.js +14 -20
- package/es/Article/ArticleParagraph.js +25 -0
- package/es/Article/index.js +1 -0
- package/es/AudioPlayer/AudioPlayer.js +13 -13
- package/es/AudioPlayer/Controls.js +22 -38
- package/es/Breadcrumb/Breadcrumb.js +2 -33
- package/es/Breadcrumb/BreadcrumbItem.js +16 -29
- package/es/Breadcrumb/index.js +0 -1
- package/es/CodeBlock/CodeBlock.js +115 -0
- package/es/CodeBlock/codeLanguageOptions.js +84 -0
- package/es/CodeBlock/index.js +10 -0
- package/es/CreatedBy/CreatedBy.js +4 -4
- package/es/Embed/BrightcoveEmbed.js +3 -3
- package/es/Embed/CodeEmbed.js +2 -2
- package/es/Embed/ConceptEmbed.js +37 -33
- package/es/Embed/ExternalEmbed.js +2 -2
- package/es/Embed/IframeEmbed.js +1 -1
- package/es/Embed/ImageEmbed.js +17 -14
- package/es/Embed/RelatedContentEmbed.js +3 -3
- package/es/Embed/UuDisclaimerEmbed.js +4 -3
- package/es/Embed/conceptComponents.js +10 -10
- package/es/Figure/Figure.js +32 -19
- package/es/FrontpageArticle/FrontpageArticle.js +3 -3
- package/es/Gloss/Gloss.js +12 -10
- package/es/Hero/Hero.js +1 -1
- package/es/Image/Image.js +3 -3
- package/es/LanguageSelector/LanguageSelector.js +5 -5
- package/es/Layout/LayoutItem.js +2 -1
- package/es/Layout/OneColumn.js +22 -28
- package/es/Layout/PageContainer.js +21 -17
- package/es/LicenseByline/LicenseLink.js +5 -6
- package/es/Messages/MessageBox.js +9 -7
- package/es/MyNdla/Resource/index.js +1 -2
- package/es/MyNdla/index.js +1 -2
- package/es/Notion/Notion.js +4 -4
- package/es/Resource/BlockResource.js +13 -15
- package/es/Resource/ListResource.js +13 -15
- package/es/Search/ContentTypeResult.js +4 -4
- package/es/Search/SearchResult.js +11 -11
- package/es/Search/SearchResultSleeve.js +16 -16
- package/es/TreeStructure/TreeStructure.js +6 -6
- package/es/all.css +1 -1
- package/es/index.js +5 -20
- package/es/locale/messages-en.js +15 -2
- package/es/locale/messages-nb.js +15 -2
- package/es/locale/messages-nn.js +16 -3
- package/es/locale/messages-se.js +14 -1
- package/es/locale/messages-sma.js +15 -2
- package/es/types.js +0 -9
- package/lib/Article/Article.d.ts +8 -11
- package/lib/Article/Article.js +111 -118
- package/lib/Article/ArticleHeaderWrapper.js +14 -20
- package/lib/Article/ArticleParagraph.d.ts +13 -0
- package/lib/Article/ArticleParagraph.js +32 -0
- package/lib/Article/index.d.ts +2 -0
- package/lib/Article/index.js +7 -0
- package/lib/AudioPlayer/AudioPlayer.js +13 -13
- package/lib/AudioPlayer/Controls.js +21 -37
- package/lib/Breadcrumb/Breadcrumb.d.ts +1 -2
- package/lib/Breadcrumb/Breadcrumb.js +2 -33
- package/lib/Breadcrumb/BreadcrumbItem.js +16 -29
- package/lib/Breadcrumb/index.d.ts +0 -1
- package/lib/Breadcrumb/index.js +0 -7
- package/lib/CodeBlock/CodeBlock.d.ts +18 -0
- package/lib/CodeBlock/CodeBlock.js +121 -0
- package/lib/{Navigation/index.d.ts → CodeBlock/codeLanguageOptions.d.ts} +5 -2
- package/lib/CodeBlock/codeLanguageOptions.js +90 -0
- package/lib/CodeBlock/index.d.ts +9 -0
- package/lib/CodeBlock/index.js +20 -0
- package/lib/CreatedBy/CreatedBy.js +4 -4
- package/lib/Embed/BrightcoveEmbed.js +3 -3
- package/lib/Embed/CodeEmbed.js +2 -2
- package/lib/Embed/ConceptEmbed.d.ts +1 -1
- package/lib/Embed/ConceptEmbed.js +36 -33
- package/lib/Embed/ExternalEmbed.js +2 -2
- package/lib/Embed/IframeEmbed.js +1 -1
- package/lib/Embed/ImageEmbed.js +17 -14
- package/lib/Embed/RelatedContentEmbed.js +3 -3
- package/lib/Embed/UuDisclaimerEmbed.js +4 -3
- package/lib/Embed/conceptComponents.js +10 -10
- package/lib/Figure/Figure.d.ts +2 -5
- package/lib/Figure/Figure.js +32 -23
- package/lib/FrontpageArticle/FrontpageArticle.js +3 -3
- package/lib/Gloss/Gloss.js +12 -10
- package/lib/Hero/Hero.js +1 -1
- package/lib/Image/Image.js +2 -2
- package/lib/LanguageSelector/LanguageSelector.js +5 -5
- package/lib/Layout/LayoutItem.js +2 -1
- package/lib/Layout/OneColumn.d.ts +3 -8
- package/lib/Layout/OneColumn.js +22 -30
- package/lib/Layout/PageContainer.d.ts +3 -7
- package/lib/Layout/PageContainer.js +21 -19
- package/lib/LicenseByline/LicenseLink.js +5 -6
- package/lib/Messages/MessageBox.d.ts +2 -1
- package/lib/Messages/MessageBox.js +9 -7
- package/lib/MyNdla/Resource/index.d.ts +1 -2
- package/lib/MyNdla/Resource/index.js +0 -7
- package/lib/MyNdla/index.d.ts +1 -2
- package/lib/MyNdla/index.js +0 -7
- package/lib/Notion/Notion.js +4 -4
- package/lib/Resource/BlockResource.js +13 -15
- package/lib/Resource/ListResource.js +13 -15
- package/lib/Search/ContentTypeResult.js +4 -4
- package/lib/Search/SearchResult.js +10 -10
- package/lib/Search/SearchResultSleeve.js +16 -16
- package/lib/TreeStructure/TreeStructure.js +6 -6
- package/lib/all.css +1 -1
- package/lib/index.d.ts +5 -20
- package/lib/index.js +17 -254
- package/lib/locale/messages-en.d.ts +13 -0
- package/lib/locale/messages-en.js +15 -2
- package/lib/locale/messages-nb.d.ts +13 -0
- package/lib/locale/messages-nb.js +15 -2
- package/lib/locale/messages-nn.d.ts +13 -0
- package/lib/locale/messages-nn.js +16 -3
- package/lib/locale/messages-se.d.ts +13 -0
- package/lib/locale/messages-se.js +14 -1
- package/lib/locale/messages-sma.d.ts +13 -0
- package/lib/locale/messages-sma.js +15 -2
- package/lib/types.d.ts +0 -51
- package/lib/types.js +1 -10
- package/package.json +16 -22
- package/src/Article/Article.tsx +179 -119
- package/src/Article/ArticleHeaderWrapper.tsx +17 -21
- package/src/Article/ArticleParagraph.tsx +22 -0
- package/src/Article/index.ts +4 -0
- package/src/AudioPlayer/AudioPlayer.tsx +2 -2
- package/src/AudioPlayer/Controls.tsx +5 -5
- package/src/Breadcrumb/Breadcrumb.stories.tsx +0 -4
- package/src/Breadcrumb/Breadcrumb.tsx +1 -38
- package/src/Breadcrumb/BreadcrumbItem.tsx +5 -19
- package/src/Breadcrumb/index.ts +0 -2
- package/src/CodeBlock/CodeBlock.stories.tsx +113 -0
- package/src/CodeBlock/CodeBlock.tsx +228 -0
- package/src/CodeBlock/codeLanguageOptions.ts +115 -0
- package/src/CodeBlock/index.ts +10 -0
- package/src/CreatedBy/CreatedBy.tsx +2 -2
- package/src/Embed/AudioEmbed.stories.tsx +6 -4
- package/src/Embed/BrightcoveEmbed.stories.tsx +6 -4
- package/src/Embed/BrightcoveEmbed.tsx +2 -2
- package/src/Embed/CodeEmbed.tsx +2 -2
- package/src/Embed/ConceptEmbed.stories.tsx +6 -4
- package/src/Embed/ConceptEmbed.tsx +103 -96
- package/src/Embed/ExternalEmbed.stories.tsx +6 -4
- package/src/Embed/ExternalEmbed.tsx +2 -2
- package/src/Embed/H5pEmbed.stories.tsx +6 -4
- package/src/Embed/IframeEmbed.stories.tsx +6 -4
- package/src/Embed/IframeEmbed.tsx +1 -1
- package/src/Embed/ImageEmbed.stories.tsx +6 -4
- package/src/Embed/ImageEmbed.tsx +19 -11
- package/src/Embed/RelatedContentEmbed.stories.tsx +6 -4
- package/src/Embed/RelatedContentEmbed.tsx +3 -3
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +23 -4
- package/src/Embed/UuDisclaimerEmbed.tsx +1 -1
- package/src/Embed/conceptComponents.tsx +1 -0
- package/src/Figure/Figure.tsx +57 -18
- package/src/Footer/Footer.stories.tsx +1 -1
- package/src/FrontpageArticle/FrontpageArticle.tsx +3 -3
- package/src/Gloss/Gloss.tsx +4 -2
- package/src/Hero/Hero.tsx +1 -1
- package/src/Image/Image.tsx +2 -2
- package/src/LanguageSelector/LanguageSelector.tsx +1 -1
- package/src/Layout/LayoutItem.tsx +2 -1
- package/src/Layout/OneColumn.tsx +25 -35
- package/src/Layout/PageContainer.tsx +19 -23
- package/src/LicenseByline/LicenseLink.tsx +1 -2
- package/src/Messages/MessageBox.tsx +3 -2
- package/src/MyNdla/Resource/index.ts +1 -2
- package/src/MyNdla/index.ts +1 -2
- package/src/Notion/Notion.tsx +2 -2
- package/src/Resource/BlockResource.tsx +4 -8
- package/src/Resource/ListResource.tsx +4 -6
- package/src/Search/ContentTypeResult.tsx +4 -4
- package/src/Search/SearchResult.tsx +2 -2
- package/src/Search/SearchResultSleeve.tsx +7 -9
- package/src/Table/Table.stories.tsx +8 -8
- package/src/TreeStructure/TreeStructure.stories.tsx +85 -28
- package/src/TreeStructure/TreeStructure.tsx +1 -1
- package/src/all.scss +2 -3
- package/src/index.ts +7 -48
- package/src/locale/messages-en.ts +17 -1
- package/src/locale/messages-nb.ts +17 -1
- package/src/locale/messages-nn.ts +18 -2
- package/src/locale/messages-se.ts +16 -0
- package/src/locale/messages-sma.ts +17 -1
- package/src/types.ts +0 -62
- package/es/Article/ArticleAccessMessage.js +0 -43
- package/es/Article/ArticleNotions.js +0 -90
- package/es/Aside/Aside.js +0 -75
- package/es/Aside/index.js +0 -10
- package/es/BannerCard/BannerCard.js +0 -84
- package/es/BannerCard/index.js +0 -10
- package/es/Breadcrumb/HeaderBreadcrumb.js +0 -57
- package/es/CompetenceGoalTab/CompetenceGoalItem.js +0 -42
- package/es/CompetenceGoalTab/CompetenceGoalTab.js +0 -75
- package/es/CompetenceGoalTab/CompetenceItem.js +0 -108
- package/es/CompetenceGoalTab/CoreElementItem.js +0 -44
- package/es/CompetenceGoalTab/SearchButton.js +0 -43
- package/es/CompetenceGoalTab/index.js +0 -10
- package/es/CompetenceGoalTab/styles.js +0 -57
- package/es/Filter/FilterButtons.js +0 -185
- package/es/Filter/FilterCarousel.js +0 -166
- package/es/Filter/ToggleItem.js +0 -68
- package/es/Filter/index.js +0 -10
- package/es/Frontpage/FrontpageAllSubjects.js +0 -254
- package/es/LearningPaths/LearningPathContent.js +0 -25
- package/es/LearningPaths/LearningPathInformation.js +0 -74
- package/es/LearningPaths/LearningPathLastStepNavigation.js +0 -65
- package/es/LearningPaths/LearningPathMenu.js +0 -103
- package/es/LearningPaths/LearningPathMenuAside.js +0 -62
- package/es/LearningPaths/LearningPathMenuContent.js +0 -109
- package/es/LearningPaths/LearningPathMenuIntro.js +0 -72
- package/es/LearningPaths/LearningPathMenuModalWrapper.js +0 -63
- package/es/LearningPaths/LearningPathMobileHeader.js +0 -35
- package/es/LearningPaths/LearningPathMobileStepInfo.js +0 -34
- package/es/LearningPaths/LearningPathSticky.js +0 -74
- package/es/LearningPaths/LearningPathWrapper.js +0 -27
- package/es/LearningPaths/index.js +0 -18
- package/es/Masthead/Masthead.js +0 -62
- package/es/Masthead/SkipToMainContent.js +0 -30
- package/es/Masthead/index.js +0 -13
- package/es/Masthead/utils.js +0 -38
- package/es/MyNdla/Resource/FolderInput.js +0 -94
- package/es/NDLAFilm/AllMoviesAlphabetically.js +0 -127
- package/es/NDLAFilm/FilmContentCard.js +0 -93
- package/es/NDLAFilm/FilmContentCardTags.js +0 -44
- package/es/NDLAFilm/FilmMovieList.js +0 -52
- package/es/NDLAFilm/FilmMovieSearch.js +0 -106
- package/es/NDLAFilm/FilmSlideshow.js +0 -138
- package/es/NDLAFilm/MovieGrid.js +0 -54
- package/es/NDLAFilm/VisualElement.js +0 -48
- package/es/NDLAFilm/filmStyles.js +0 -31
- package/es/NDLAFilm/index.js +0 -14
- package/es/NDLAFilm/isLetter.js +0 -13
- package/es/NDLAFilm/types.js +0 -1
- package/es/Navigation/NavigationBox.js +0 -187
- package/es/Navigation/index.js +0 -10
- package/es/NoContentBox/NoContentBox.js +0 -31
- package/es/NoContentBox/index.js +0 -10
- package/es/Programme/Programme.js +0 -104
- package/es/Programme/ProgrammeSubjects.js +0 -60
- package/es/Programme/index.js +0 -12
- package/es/ResourceGroup/ResourceGroup.js +0 -46
- package/es/ResourceGroup/ResourceItem.js +0 -196
- package/es/ResourceGroup/ResourceList.js +0 -57
- package/es/ResourceGroup/index.js +0 -10
- package/es/ResourcesWrapper/ResourcesTopicTitle.js +0 -160
- package/es/ResourcesWrapper/ResourcesWrapper.js +0 -27
- package/es/ResourcesWrapper/index.js +0 -11
- package/es/SearchTypeResult/ActiveFilterContent.js +0 -53
- package/es/SearchTypeResult/ActiveFilters.js +0 -124
- package/es/SearchTypeResult/PopupFilter.js +0 -133
- package/es/SearchTypeResult/ResultNavigation.js +0 -75
- package/es/SearchTypeResult/SearchFieldHeader.js +0 -103
- package/es/SearchTypeResult/SearchFilterContent.js +0 -59
- package/es/SearchTypeResult/SearchHeader.js +0 -160
- package/es/SearchTypeResult/SearchItem.js +0 -97
- package/es/SearchTypeResult/SearchItemList.js +0 -142
- package/es/SearchTypeResult/SearchItems.js +0 -60
- package/es/SearchTypeResult/SearchSubjectItem.js +0 -62
- package/es/SearchTypeResult/SearchSubjectResult.js +0 -34
- package/es/SearchTypeResult/SearchTypeHeader.js +0 -118
- package/es/SearchTypeResult/SearchTypeResult.js +0 -55
- package/es/SearchTypeResult/SearchViewType.js +0 -90
- package/es/SearchTypeResult/components/ItemContexts.js +0 -122
- package/es/SearchTypeResult/components/ItemResourceHeader.js +0 -96
- package/es/SearchTypeResult/components/ItemTopicHeader.js +0 -66
- package/es/SearchTypeResult/components/SubjectFilters.js +0 -130
- package/es/SearchTypeResult/index.js +0 -14
- package/es/Subject/SubjectBanner.js +0 -30
- package/es/Subject/index.js +0 -9
- package/es/ToolboxPage/ToolboxInfo.js +0 -43
- package/es/ToolboxPage/index.js +0 -10
- package/es/Topic/Loader.js +0 -107
- package/es/Topic/Topic.js +0 -221
- package/es/Topic/index.js +0 -10
- package/es/locale/LocaleProvider.js +0 -38
- package/lib/Article/ArticleAccessMessage.d.ts +0 -12
- package/lib/Article/ArticleAccessMessage.js +0 -50
- package/lib/Article/ArticleNotions.d.ts +0 -14
- package/lib/Article/ArticleNotions.js +0 -96
- package/lib/Aside/Aside.d.ts +0 -15
- package/lib/Aside/Aside.js +0 -80
- package/lib/Aside/index.d.ts +0 -9
- package/lib/Aside/index.js +0 -16
- package/lib/BannerCard/BannerCard.d.ts +0 -29
- package/lib/BannerCard/BannerCard.js +0 -92
- package/lib/BannerCard/index.d.ts +0 -9
- package/lib/BannerCard/index.js +0 -13
- package/lib/Breadcrumb/HeaderBreadcrumb.d.ts +0 -14
- package/lib/Breadcrumb/HeaderBreadcrumb.js +0 -64
- package/lib/CompetenceGoalTab/CompetenceGoalItem.d.ts +0 -10
- package/lib/CompetenceGoalTab/CompetenceGoalItem.js +0 -49
- package/lib/CompetenceGoalTab/CompetenceGoalTab.d.ts +0 -14
- package/lib/CompetenceGoalTab/CompetenceGoalTab.js +0 -82
- package/lib/CompetenceGoalTab/CompetenceItem.d.ts +0 -30
- package/lib/CompetenceGoalTab/CompetenceItem.js +0 -113
- package/lib/CompetenceGoalTab/CoreElementItem.d.ts +0 -10
- package/lib/CompetenceGoalTab/CoreElementItem.js +0 -51
- package/lib/CompetenceGoalTab/SearchButton.d.ts +0 -14
- package/lib/CompetenceGoalTab/SearchButton.js +0 -50
- package/lib/CompetenceGoalTab/index.d.ts +0 -9
- package/lib/CompetenceGoalTab/index.js +0 -16
- package/lib/CompetenceGoalTab/styles.d.ts +0 -28
- package/lib/CompetenceGoalTab/styles.js +0 -62
- package/lib/Filter/FilterButtons.d.ts +0 -16
- package/lib/Filter/FilterButtons.js +0 -192
- package/lib/Filter/FilterCarousel.d.ts +0 -13
- package/lib/Filter/FilterCarousel.js +0 -171
- package/lib/Filter/ToggleItem.d.ts +0 -21
- package/lib/Filter/ToggleItem.js +0 -75
- package/lib/Filter/index.d.ts +0 -9
- package/lib/Filter/index.js +0 -20
- package/lib/Frontpage/FrontpageAllSubjects.d.ts +0 -27
- package/lib/Frontpage/FrontpageAllSubjects.js +0 -259
- package/lib/LearningPaths/LearningPathContent.d.ts +0 -13
- package/lib/LearningPaths/LearningPathContent.js +0 -33
- package/lib/LearningPaths/LearningPathInformation.d.ts +0 -18
- package/lib/LearningPaths/LearningPathInformation.js +0 -80
- package/lib/LearningPaths/LearningPathLastStepNavigation.d.ts +0 -22
- package/lib/LearningPaths/LearningPathLastStepNavigation.js +0 -72
- package/lib/LearningPaths/LearningPathMenu.d.ts +0 -38
- package/lib/LearningPaths/LearningPathMenu.js +0 -110
- package/lib/LearningPaths/LearningPathMenuAside.d.ts +0 -24
- package/lib/LearningPaths/LearningPathMenuAside.js +0 -69
- package/lib/LearningPaths/LearningPathMenuContent.d.ts +0 -22
- package/lib/LearningPaths/LearningPathMenuContent.js +0 -116
- package/lib/LearningPaths/LearningPathMenuIntro.d.ts +0 -17
- package/lib/LearningPaths/LearningPathMenuIntro.js +0 -77
- package/lib/LearningPaths/LearningPathMenuModalWrapper.d.ts +0 -14
- package/lib/LearningPaths/LearningPathMenuModalWrapper.js +0 -70
- package/lib/LearningPaths/LearningPathMobileHeader.d.ts +0 -9
- package/lib/LearningPaths/LearningPathMobileHeader.js +0 -42
- package/lib/LearningPaths/LearningPathMobileStepInfo.d.ts +0 -13
- package/lib/LearningPaths/LearningPathMobileStepInfo.js +0 -41
- package/lib/LearningPaths/LearningPathSticky.d.ts +0 -22
- package/lib/LearningPaths/LearningPathSticky.js +0 -84
- package/lib/LearningPaths/LearningPathWrapper.d.ts +0 -14
- package/lib/LearningPaths/LearningPathWrapper.js +0 -35
- package/lib/LearningPaths/index.d.ts +0 -17
- package/lib/LearningPaths/index.js +0 -74
- package/lib/Masthead/Masthead.d.ts +0 -23
- package/lib/Masthead/Masthead.js +0 -68
- package/lib/Masthead/SkipToMainContent.d.ts +0 -12
- package/lib/Masthead/SkipToMainContent.js +0 -37
- package/lib/Masthead/index.d.ts +0 -12
- package/lib/Masthead/index.js +0 -36
- package/lib/Masthead/utils.d.ts +0 -11
- package/lib/Masthead/utils.js +0 -46
- package/lib/MyNdla/Resource/FolderInput.d.ts +0 -19
- package/lib/MyNdla/Resource/FolderInput.js +0 -101
- package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +0 -13
- package/lib/NDLAFilm/AllMoviesAlphabetically.js +0 -134
- package/lib/NDLAFilm/FilmContentCard.d.ts +0 -19
- package/lib/NDLAFilm/FilmContentCard.js +0 -98
- package/lib/NDLAFilm/FilmContentCardTags.d.ts +0 -15
- package/lib/NDLAFilm/FilmContentCardTags.js +0 -51
- package/lib/NDLAFilm/FilmMovieList.d.ts +0 -17
- package/lib/NDLAFilm/FilmMovieList.js +0 -59
- package/lib/NDLAFilm/FilmMovieSearch.d.ts +0 -21
- package/lib/NDLAFilm/FilmMovieSearch.js +0 -113
- package/lib/NDLAFilm/FilmSlideshow.d.ts +0 -13
- package/lib/NDLAFilm/FilmSlideshow.js +0 -143
- package/lib/NDLAFilm/MovieGrid.d.ts +0 -17
- package/lib/NDLAFilm/MovieGrid.js +0 -61
- package/lib/NDLAFilm/VisualElement.d.ts +0 -16
- package/lib/NDLAFilm/VisualElement.js +0 -53
- package/lib/NDLAFilm/filmStyles.d.ts +0 -17
- package/lib/NDLAFilm/filmStyles.js +0 -39
- package/lib/NDLAFilm/index.d.ts +0 -13
- package/lib/NDLAFilm/index.js +0 -41
- package/lib/NDLAFilm/isLetter.d.ts +0 -8
- package/lib/NDLAFilm/isLetter.js +0 -20
- package/lib/NDLAFilm/types.d.ts +0 -22
- package/lib/NDLAFilm/types.js +0 -5
- package/lib/Navigation/NavigationBox.d.ts +0 -30
- package/lib/Navigation/NavigationBox.js +0 -193
- package/lib/Navigation/index.js +0 -13
- package/lib/NoContentBox/NoContentBox.d.ts +0 -14
- package/lib/NoContentBox/NoContentBox.js +0 -38
- package/lib/NoContentBox/index.d.ts +0 -9
- package/lib/NoContentBox/index.js +0 -16
- package/lib/Programme/Programme.d.ts +0 -16
- package/lib/Programme/Programme.js +0 -112
- package/lib/Programme/ProgrammeSubjects.d.ts +0 -26
- package/lib/Programme/ProgrammeSubjects.js +0 -67
- package/lib/Programme/index.d.ts +0 -11
- package/lib/Programme/index.js +0 -23
- package/lib/ResourceGroup/ResourceGroup.d.ts +0 -18
- package/lib/ResourceGroup/ResourceGroup.js +0 -53
- package/lib/ResourceGroup/ResourceItem.d.ts +0 -22
- package/lib/ResourceGroup/ResourceItem.js +0 -203
- package/lib/ResourceGroup/ResourceList.d.ts +0 -19
- package/lib/ResourceGroup/ResourceList.js +0 -64
- package/lib/ResourceGroup/index.d.ts +0 -9
- package/lib/ResourceGroup/index.js +0 -16
- package/lib/ResourcesWrapper/ResourcesTopicTitle.d.ts +0 -20
- package/lib/ResourcesWrapper/ResourcesTopicTitle.js +0 -165
- package/lib/ResourcesWrapper/ResourcesWrapper.d.ts +0 -16
- package/lib/ResourcesWrapper/ResourcesWrapper.js +0 -34
- package/lib/ResourcesWrapper/index.d.ts +0 -10
- package/lib/ResourcesWrapper/index.js +0 -23
- package/lib/SearchTypeResult/ActiveFilterContent.d.ts +0 -23
- package/lib/SearchTypeResult/ActiveFilterContent.js +0 -58
- package/lib/SearchTypeResult/ActiveFilters.d.ts +0 -18
- package/lib/SearchTypeResult/ActiveFilters.js +0 -131
- package/lib/SearchTypeResult/PopupFilter.d.ts +0 -26
- package/lib/SearchTypeResult/PopupFilter.js +0 -138
- package/lib/SearchTypeResult/ResultNavigation.d.ts +0 -18
- package/lib/SearchTypeResult/ResultNavigation.js +0 -82
- package/lib/SearchTypeResult/SearchFieldHeader.d.ts +0 -17
- package/lib/SearchTypeResult/SearchFieldHeader.js +0 -109
- package/lib/SearchTypeResult/SearchFilterContent.d.ts +0 -16
- package/lib/SearchTypeResult/SearchFilterContent.js +0 -64
- package/lib/SearchTypeResult/SearchHeader.d.ts +0 -26
- package/lib/SearchTypeResult/SearchHeader.js +0 -166
- package/lib/SearchTypeResult/SearchItem.d.ts +0 -30
- package/lib/SearchTypeResult/SearchItem.js +0 -104
- package/lib/SearchTypeResult/SearchItemList.d.ts +0 -10
- package/lib/SearchTypeResult/SearchItemList.js +0 -147
- package/lib/SearchTypeResult/SearchItems.d.ts +0 -17
- package/lib/SearchTypeResult/SearchItems.js +0 -65
- package/lib/SearchTypeResult/SearchSubjectItem.d.ts +0 -20
- package/lib/SearchTypeResult/SearchSubjectItem.js +0 -67
- package/lib/SearchTypeResult/SearchSubjectResult.d.ts +0 -13
- package/lib/SearchTypeResult/SearchSubjectResult.js +0 -41
- package/lib/SearchTypeResult/SearchTypeHeader.d.ts +0 -22
- package/lib/SearchTypeResult/SearchTypeHeader.js +0 -123
- package/lib/SearchTypeResult/SearchTypeResult.d.ts +0 -26
- package/lib/SearchTypeResult/SearchTypeResult.js +0 -62
- package/lib/SearchTypeResult/SearchViewType.d.ts +0 -13
- package/lib/SearchTypeResult/SearchViewType.js +0 -95
- package/lib/SearchTypeResult/components/ItemContexts.d.ts +0 -19
- package/lib/SearchTypeResult/components/ItemContexts.js +0 -127
- package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +0 -16
- package/lib/SearchTypeResult/components/ItemResourceHeader.js +0 -101
- package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +0 -17
- package/lib/SearchTypeResult/components/ItemTopicHeader.js +0 -71
- package/lib/SearchTypeResult/components/SubjectFilters.d.ts +0 -32
- package/lib/SearchTypeResult/components/SubjectFilters.js +0 -135
- package/lib/SearchTypeResult/index.d.ts +0 -14
- package/lib/SearchTypeResult/index.js +0 -41
- package/lib/Subject/SubjectBanner.d.ts +0 -14
- package/lib/Subject/SubjectBanner.js +0 -37
- package/lib/Subject/index.d.ts +0 -8
- package/lib/Subject/index.js +0 -13
- package/lib/ToolboxPage/ToolboxInfo.d.ts +0 -18
- package/lib/ToolboxPage/ToolboxInfo.js +0 -49
- package/lib/ToolboxPage/index.d.ts +0 -9
- package/lib/ToolboxPage/index.js +0 -13
- package/lib/Topic/Loader.d.ts +0 -9
- package/lib/Topic/Loader.js +0 -114
- package/lib/Topic/Topic.d.ts +0 -34
- package/lib/Topic/Topic.js +0 -228
- package/lib/Topic/index.d.ts +0 -10
- package/lib/Topic/index.js +0 -16
- package/lib/locale/LocaleProvider.d.ts +0 -15
- package/lib/locale/LocaleProvider.js +0 -44
- package/src/Article/ArticleAccessMessage.tsx +0 -44
- package/src/Article/ArticleNotions.tsx +0 -139
- package/src/Article/component.article.scss +0 -156
- package/src/Aside/Aside.tsx +0 -113
- package/src/Aside/index.ts +0 -11
- package/src/BannerCard/BannerCard.tsx +0 -99
- package/src/BannerCard/index.ts +0 -11
- package/src/Breadcrumb/HeaderBreadcrumb.tsx +0 -56
- package/src/CompetenceGoalTab/CompetenceGoalItem.tsx +0 -39
- package/src/CompetenceGoalTab/CompetenceGoalTab.tsx +0 -85
- package/src/CompetenceGoalTab/CompetenceItem.tsx +0 -130
- package/src/CompetenceGoalTab/CoreElementItem.tsx +0 -39
- package/src/CompetenceGoalTab/SearchButton.tsx +0 -50
- package/src/CompetenceGoalTab/index.ts +0 -10
- package/src/CompetenceGoalTab/styles.ts +0 -37
- package/src/Figure/component.figure.scss +0 -60
- package/src/Filter/FilterButtons.tsx +0 -199
- package/src/Filter/FilterCarousel.tsx +0 -172
- package/src/Filter/ToggleItem.tsx +0 -180
- package/src/Filter/index.ts +0 -10
- package/src/Frontpage/FrontpageAllSubjects.tsx +0 -231
- package/src/LearningPaths/LearningPathContent.tsx +0 -33
- package/src/LearningPaths/LearningPathInformation.tsx +0 -82
- package/src/LearningPaths/LearningPathLastStepNavigation.tsx +0 -89
- package/src/LearningPaths/LearningPathMenu.stories.tsx +0 -65
- package/src/LearningPaths/LearningPathMenu.tsx +0 -166
- package/src/LearningPaths/LearningPathMenuAside.tsx +0 -100
- package/src/LearningPaths/LearningPathMenuContent.tsx +0 -277
- package/src/LearningPaths/LearningPathMenuIntro.tsx +0 -126
- package/src/LearningPaths/LearningPathMenuModalWrapper.tsx +0 -71
- package/src/LearningPaths/LearningPathMobileHeader.tsx +0 -37
- package/src/LearningPaths/LearningPathMobileStepInfo.tsx +0 -38
- package/src/LearningPaths/LearningPathSticky.tsx +0 -122
- package/src/LearningPaths/LearningPathWrapper.tsx +0 -36
- package/src/LearningPaths/index.ts +0 -19
- package/src/Masthead/Masthead.tsx +0 -100
- package/src/Masthead/SkipToMainContent.tsx +0 -54
- package/src/Masthead/index.ts +0 -16
- package/src/Masthead/utils.ts +0 -45
- package/src/MyNdla/Resource/FolderInput.stories.tsx +0 -27
- package/src/MyNdla/Resource/FolderInput.tsx +0 -89
- package/src/NDLAFilm/AllMoviesAlphabetically.tsx +0 -160
- package/src/NDLAFilm/FilmContentCard.tsx +0 -138
- package/src/NDLAFilm/FilmContentCardTags.tsx +0 -57
- package/src/NDLAFilm/FilmMovieList.tsx +0 -54
- package/src/NDLAFilm/FilmMovieSearch.tsx +0 -135
- package/src/NDLAFilm/FilmSlideshow.tsx +0 -177
- package/src/NDLAFilm/MovieGrid.tsx +0 -86
- package/src/NDLAFilm/VisualElement.tsx +0 -38
- package/src/NDLAFilm/__tests__/isLetter-test.ts +0 -20
- package/src/NDLAFilm/filmStyles.ts +0 -49
- package/src/NDLAFilm/index.ts +0 -15
- package/src/NDLAFilm/isLetter.ts +0 -13
- package/src/NDLAFilm/types.ts +0 -24
- package/src/Navigation/NavigationBox.tsx +0 -252
- package/src/Navigation/index.ts +0 -11
- package/src/NoContentBox/NoContentBox.tsx +0 -32
- package/src/NoContentBox/index.ts +0 -11
- package/src/Programme/Programme.tsx +0 -101
- package/src/Programme/ProgrammeSubjects.tsx +0 -83
- package/src/Programme/index.ts +0 -13
- package/src/ResourceGroup/ResourceGroup.tsx +0 -65
- package/src/ResourceGroup/ResourceItem.stories.tsx +0 -101
- package/src/ResourceGroup/ResourceItem.tsx +0 -318
- package/src/ResourceGroup/ResourceList.tsx +0 -80
- package/src/ResourceGroup/index.ts +0 -11
- package/src/ResourcesWrapper/ResourcesTopicTitle.tsx +0 -223
- package/src/ResourcesWrapper/ResourcesWrapper.tsx +0 -32
- package/src/ResourcesWrapper/index.ts +0 -13
- package/src/SearchTypeResult/ActiveFilterContent.tsx +0 -55
- package/src/SearchTypeResult/ActiveFilters.tsx +0 -163
- package/src/SearchTypeResult/PopupFilter.tsx +0 -149
- package/src/SearchTypeResult/ResultNavigation.tsx +0 -105
- package/src/SearchTypeResult/SearchFieldHeader.tsx +0 -129
- package/src/SearchTypeResult/SearchFilterContent.tsx +0 -61
- package/src/SearchTypeResult/SearchHeader.tsx +0 -180
- package/src/SearchTypeResult/SearchItem.tsx +0 -144
- package/src/SearchTypeResult/SearchItemList.tsx +0 -161
- package/src/SearchTypeResult/SearchItems.tsx +0 -72
- package/src/SearchTypeResult/SearchSubjectItem.tsx +0 -74
- package/src/SearchTypeResult/SearchSubjectResult.tsx +0 -58
- package/src/SearchTypeResult/SearchTypeHeader.tsx +0 -148
- package/src/SearchTypeResult/SearchTypeResult.tsx +0 -89
- package/src/SearchTypeResult/SearchViewType.tsx +0 -111
- package/src/SearchTypeResult/components/ItemContexts.tsx +0 -131
- package/src/SearchTypeResult/components/ItemResourceHeader.tsx +0 -130
- package/src/SearchTypeResult/components/ItemTopicHeader.tsx +0 -88
- package/src/SearchTypeResult/components/SubjectFilters.tsx +0 -149
- package/src/SearchTypeResult/index.ts +0 -17
- package/src/Subject/SubjectBanner.tsx +0 -39
- package/src/Subject/index.ts +0 -9
- package/src/ToolboxPage/ToolboxInfo.tsx +0 -42
- package/src/ToolboxPage/index.ts +0 -11
- package/src/Topic/Loader.tsx +0 -29
- package/src/Topic/Topic.tsx +0 -348
- package/src/Topic/index.ts +0 -13
- package/src/locale/LocaleProvider.tsx +0 -31
- package/src/main.scss +0 -6
|
@@ -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"><</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"><</span>h2</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>h2</span><span class="token punctuation">></span></span>
|
|
26
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>
|
|
27
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>b</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>b</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span><span class="token punctuation">/></span></span>
|
|
28
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</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"></</span>span</span><span class="token punctuation">></span></span>
|
|
29
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
|
|
30
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>
|
|
31
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>b</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>b</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span><span class="token punctuation">/></span></span>
|
|
32
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</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"></</span>span</span><span class="token punctuation">></span></span>
|
|
33
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
|
|
34
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>p</span><span class="token punctuation">></span></span>
|
|
35
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>b</span><span class="token punctuation">></span></span>Lorem ipsum<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>b</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>br</span><span class="token punctuation">/></span></span>
|
|
36
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</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"></</span>span</span><span class="token punctuation">></span></span>
|
|
37
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>p</span><span class="token punctuation">></span></span>
|
|
38
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"></</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
|
{description}
|
|
54
|
-
<StyledSafeLink to={
|
|
54
|
+
<StyledSafeLink to={"https://ndla.no"} target={target}>
|
|
55
55
|
NDLA
|
|
56
56
|
</StyledSafeLink>
|
|
57
57
|
</Text>
|
|
58
|
-
<Logo label={
|
|
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
|
-
<
|
|
190
|
-
<
|
|
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
|
-
</
|
|
197
|
-
</
|
|
198
|
+
</ArticleWrapper>
|
|
199
|
+
</OneColumn>
|
|
198
200
|
),
|
|
199
201
|
],
|
|
200
202
|
};
|
|
@@ -10,6 +10,8 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
|
10
10
|
import { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData } from "@ndla/types-embed";
|
|
11
11
|
import BrightcoveEmbed from "./BrightcoveEmbed";
|
|
12
12
|
import StoryFavoriteButton from "../../../../stories/StoryFavoriteButton";
|
|
13
|
+
import { ArticleWrapper } from "../Article";
|
|
14
|
+
import { OneColumn } from "../Layout";
|
|
13
15
|
|
|
14
16
|
const embedData: BrightcoveEmbedData = {
|
|
15
17
|
resource: "brightcove",
|
|
@@ -159,15 +161,15 @@ const meta: Meta<typeof BrightcoveEmbed> = {
|
|
|
159
161
|
},
|
|
160
162
|
decorators: [
|
|
161
163
|
(Story) => (
|
|
162
|
-
<
|
|
163
|
-
<
|
|
164
|
+
<OneColumn>
|
|
165
|
+
<ArticleWrapper modifier="clean">
|
|
164
166
|
<section className="u-4/6@desktop u-push-1/6@desktop u-10/12@tablet u-push-1/12@tablet">
|
|
165
167
|
<section>
|
|
166
168
|
<Story />
|
|
167
169
|
</section>
|
|
168
170
|
</section>
|
|
169
|
-
</
|
|
170
|
-
</
|
|
171
|
+
</ArticleWrapper>
|
|
172
|
+
</OneColumn>
|
|
171
173
|
),
|
|
172
174
|
],
|
|
173
175
|
};
|
|
@@ -34,14 +34,14 @@ const BrightcoveIframe = styled.iframe`
|
|
|
34
34
|
height: auto;
|
|
35
35
|
`;
|
|
36
36
|
|
|
37
|
-
export const makeIframeString = (url: string, width: string | number, height: string | number, title
|
|
37
|
+
export const makeIframeString = (url: string, width: string | number, height: string | number, title = "") => {
|
|
38
38
|
const strippedWidth = typeof width === "number" ? width : width.replace(/\s*px/, "");
|
|
39
39
|
const strippedHeight = typeof height === "number" ? height : height.replace(/\s*px/, "");
|
|
40
40
|
const urlOrTitle = title || url;
|
|
41
41
|
return `<iframe title="${urlOrTitle}" aria-label="${urlOrTitle}" src="${url}" width="${strippedWidth}" height="${strippedHeight}" allowfullscreen scrolling="no" frameborder="0" loading="lazy"></iframe>`;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export const isNumeric = (value: any) => !Number.isNaN(value - parseFloat(value));
|
|
44
|
+
export const isNumeric = (value: any) => !Number.isNaN(value - Number.parseFloat(value));
|
|
45
45
|
|
|
46
46
|
const getIframeProps = (data: BrightcoveEmbedData, sources: BrightcoveVideoSource[]) => {
|
|
47
47
|
const { account, videoid, player = "default" } = data;
|
package/src/Embed/CodeEmbed.tsx
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Codeblock } from "@ndla/code";
|
|
10
9
|
import { CodeMetaData } from "@ndla/types-embed";
|
|
10
|
+
import { CodeBlock } from "../CodeBlock";
|
|
11
11
|
import { Figure } from "../Figure";
|
|
12
12
|
|
|
13
13
|
interface Props {
|
|
@@ -16,7 +16,7 @@ interface Props {
|
|
|
16
16
|
const CodeEmbed = ({ embed }: Props) => {
|
|
17
17
|
return (
|
|
18
18
|
<Figure>
|
|
19
|
-
<
|
|
19
|
+
<CodeBlock
|
|
20
20
|
title={embed.embedData.title}
|
|
21
21
|
code={embed.status === "success" ? embed.data.decodedContent : ""}
|
|
22
22
|
highlightedCode={embed.status === "success" ? embed.data.highlightedCode : ""}
|
|
@@ -10,6 +10,8 @@ import { Meta, StoryObj } from "@storybook/react";
|
|
|
10
10
|
import { ConceptData, ConceptEmbedData } from "@ndla/types-embed";
|
|
11
11
|
import ConceptEmbed from "./ConceptEmbed";
|
|
12
12
|
import StoryFavoriteButton from "../../../../stories/StoryFavoriteButton";
|
|
13
|
+
import { ArticleWrapper } from "../Article";
|
|
14
|
+
import { OneColumn } from "../Layout";
|
|
13
15
|
|
|
14
16
|
const blockEmbedData: ConceptEmbedData = {
|
|
15
17
|
contentId: "35",
|
|
@@ -231,15 +233,15 @@ const meta: Meta<typeof ConceptEmbed> = {
|
|
|
231
233
|
},
|
|
232
234
|
decorators: [
|
|
233
235
|
(Story) => (
|
|
234
|
-
<
|
|
235
|
-
<
|
|
236
|
+
<OneColumn>
|
|
237
|
+
<ArticleWrapper modifier="clean">
|
|
236
238
|
<section className="u-4/6@desktop u-push-1/6@desktop u-10/12@tablet u-push-1/12@tablet">
|
|
237
239
|
<section>
|
|
238
240
|
<Story />
|
|
239
241
|
</section>
|
|
240
242
|
</section>
|
|
241
|
-
</
|
|
242
|
-
</
|
|
243
|
+
</ArticleWrapper>
|
|
244
|
+
</OneColumn>
|
|
243
245
|
),
|
|
244
246
|
],
|
|
245
247
|
};
|