@ndla/ui 30.1.0 → 30.2.1
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/es/Article/ArticleHeaderWrapper.js +75 -112
- package/es/Footer/FooterLinks.js +13 -10
- package/es/Frontpage/FrontpageFilm.js +11 -8
- package/es/Frontpage/FrontpageMultidisciplinarySubject.js +13 -10
- package/es/Frontpage/FrontpageToolbox.js +11 -8
- package/es/LearningPaths/LearningPathLastStepNavigation.js +11 -8
- package/es/LearningPaths/LearningPathMenuAside.js +13 -10
- package/es/LearningPaths/LearningPathMobileHeader.js +8 -6
- package/es/LearningPaths/LearningPathMobileStepInfo.js +8 -5
- package/es/Masthead/MastheadSearchModal.js +10 -7
- package/es/Messages/MessageBox.js +11 -12
- package/es/MyNdla/Resource/Folder.js +118 -57
- package/es/NDLAFilm/CategorySelect.js +106 -146
- package/es/Resource/BlockResource.js +45 -30
- package/es/Resource/ListResource.js +46 -41
- package/es/Resource/resourceComponents.js +29 -34
- package/es/SearchTypeResult/ActiveFilterContent.js +9 -6
- package/es/SearchTypeResult/SearchHeader.js +14 -12
- package/es/SearchTypeResult/SearchNotionsResult.js +5 -6
- package/es/SearchTypeResult/SearchTypeHeader.js +17 -15
- package/es/Subject/SubjectCarousel.js +11 -8
- package/es/ToolboxPage/ToolboxInfo.js +9 -6
- package/es/User/UserInfo.js +23 -2
- package/es/User/parseUserObject.js +22 -12
- package/es/locale/messages-en.js +5 -1
- package/es/locale/messages-nb.js +5 -1
- package/es/locale/messages-nn.js +5 -1
- package/es/locale/messages-se.js +33 -29
- package/es/locale/messages-sma.js +5 -1
- package/es/utils/createUniversalPortal.js +1 -1
- package/lib/Animation/DisplayOnPageYOffset.d.ts +2 -2
- package/lib/Animation/Fade.d.ts +2 -2
- package/lib/Article/Article.d.ts +3 -3
- package/lib/Article/ArticleAccessMessage.d.ts +1 -1
- package/lib/Article/ArticleByline.d.ts +1 -1
- package/lib/Article/ArticleContent.d.ts +1 -1
- package/lib/Article/ArticleFootNotes.d.ts +1 -1
- package/lib/Article/ArticleHeaderWrapper.d.ts +4 -5
- package/lib/Article/ArticleHeaderWrapper.js +73 -108
- package/lib/Article/ArticleNotions.d.ts +1 -1
- package/lib/Article/ArticleSideBar.d.ts +1 -1
- package/lib/Aside/Aside.d.ts +1 -1
- package/lib/AudioPlayer/AudioPlayer.d.ts +1 -1
- package/lib/AudioPlayer/Controls.d.ts +1 -1
- package/lib/AudioPlayer/SpeechControl.d.ts +1 -1
- package/lib/AuthorInfo/AuthorInfo.d.ts +1 -1
- package/lib/BannerCard/BannerCard.d.ts +1 -1
- package/lib/BlogPosts/BlogPost.d.ts +1 -1
- package/lib/BlogPosts/BlogPostWrapper.d.ts +1 -1
- package/lib/Breadcrumb/ActionBreadcrumb.d.ts +1 -1
- package/lib/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/lib/Breadcrumb/HeaderBreadcrumb.d.ts +1 -1
- package/lib/Breadcrumb/HomeBreadcrumb.d.ts +1 -1
- package/lib/Breadcrumblist/Breadcrumblist.d.ts +1 -1
- package/lib/CompetenceGoalTab/CompetenceGoalItem.d.ts +1 -1
- package/lib/CompetenceGoalTab/CompetenceGoalTab.d.ts +1 -1
- package/lib/CompetenceGoalTab/CompetenceItem.d.ts +1 -1
- package/lib/CompetenceGoalTab/SearchButton.d.ts +1 -1
- package/lib/CompetenceGoals/CompetenceGoalsDialog.d.ts +1 -1
- package/lib/ComponentCursor/ComponentCursor.d.ts +1 -1
- package/lib/ContentCard/ContentCard.d.ts +1 -1
- package/lib/ContentLoader/index.d.ts +1 -1
- package/lib/ContentPlaceholder/ContentPlaceholder.d.ts +1 -1
- package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +9 -9
- package/lib/CopyParagraphButton/CopyParagraphButton.d.ts +1 -1
- package/lib/CreatedBy/CreatedBy.d.ts +1 -1
- package/lib/Dialog/Dialog.d.ts +1 -1
- package/lib/ErrorMessage/ErrorMessage.d.ts +1 -1
- package/lib/ErrorMessage/ErrorResourceAccessDenied.d.ts +1 -1
- package/lib/FactBox/FactBox.d.ts +1 -1
- package/lib/Figure/Figure.d.ts +2 -2
- package/lib/Figure/FigureBylineExpandButton.d.ts +1 -1
- package/lib/Figure/FigureExpandButton.d.ts +1 -1
- package/lib/Figure/FigureLicense.d.ts +2 -2
- package/lib/Figure/FigureLicenseDialog.d.ts +1 -1
- package/lib/Figure/FigureOpenDialogButton.d.ts +1 -1
- package/lib/FileList/File.d.ts +1 -1
- package/lib/FileList/FileList.d.ts +1 -1
- package/lib/Filter/FilterButtons.d.ts +1 -1
- package/lib/Filter/FilterCarousel.d.ts +1 -1
- package/lib/Filter/FilterList.d.ts +1 -1
- package/lib/Filter/FilterListPhone.d.ts +1 -1
- package/lib/Filter/ToggleItem.d.ts +1 -1
- package/lib/Footer/EditorName.d.ts +1 -1
- package/lib/Footer/Footer.d.ts +1 -1
- package/lib/Footer/FooterAuth.d.ts +1 -1
- package/lib/Footer/FooterLinks.d.ts +3 -4
- package/lib/Footer/FooterLinks.js +12 -10
- package/lib/Footer/FooterPrivacy.d.ts +1 -1
- package/lib/Footer/FooterText.d.ts +1 -1
- package/lib/Footer/privacy_en.d.ts +1 -1
- package/lib/Footer/privacy_nb.d.ts +1 -1
- package/lib/Footer/privacy_nn.d.ts +1 -1
- package/lib/Frontpage/FrontpageAllSubjects.d.ts +1 -1
- package/lib/Frontpage/FrontpageFilm.d.ts +2 -4
- package/lib/Frontpage/FrontpageFilm.js +10 -8
- package/lib/Frontpage/FrontpageHeader.d.ts +1 -1
- package/lib/Frontpage/FrontpageInfo.d.ts +1 -1
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.d.ts +7 -8
- package/lib/Frontpage/FrontpageMultidisciplinarySubject.js +12 -10
- package/lib/Frontpage/FrontpageProgramMenu.d.ts +1 -1
- package/lib/Frontpage/FrontpageSearch.d.ts +1 -1
- package/lib/Frontpage/FrontpageToolbox.d.ts +2 -4
- package/lib/Frontpage/FrontpageToolbox.js +10 -8
- package/lib/Frontpage/illustrations/Fellesfag.d.ts +1 -1
- package/lib/Frontpage/illustrations/FrontpageHeaderIllustration.d.ts +1 -1
- package/lib/Frontpage/illustrations/FrontpageIllustrations.d.ts +2 -2
- package/lib/Frontpage/illustrations/FrontpageSubjectIllustration.d.ts +1 -1
- package/lib/Frontpage/illustrations/MenuFellesfag.d.ts +1 -1
- package/lib/Frontpage/illustrations/MenuStudiespesialiserende.d.ts +1 -1
- package/lib/Frontpage/illustrations/MenuYrkesfag.d.ts +1 -1
- package/lib/Frontpage/illustrations/Studiespesialiserende.d.ts +1 -1
- package/lib/Frontpage/illustrations/Yrkesfag.d.ts +1 -1
- package/lib/Frontpage/illustrations/index.d.ts +6 -6
- package/lib/Hero/Hero.d.ts +8 -8
- package/lib/Image/Image.d.ts +2 -2
- package/lib/Image/ImageLink.d.ts +1 -1
- package/lib/Image/LazyLoadImage.d.ts +1 -1
- package/lib/InfoBlock/InfoBlock.d.ts +1 -1
- package/lib/InfoBox/InfoBox.d.ts +1 -1
- package/lib/InfoWidget/InfoWidget.d.ts +1 -1
- package/lib/LanguageSelector/LanguageSelector.d.ts +1 -1
- package/lib/LanguageSelector/LanguageSelectorContent.d.ts +1 -1
- package/lib/Layout/Content.d.ts +2 -2
- package/lib/Layout/LayoutItem.d.ts +1 -1
- package/lib/Layout/OneColumn.d.ts +1 -1
- package/lib/Layout/PageContainer.d.ts +1 -1
- package/lib/LearningPaths/LearningPathContent.d.ts +1 -1
- package/lib/LearningPaths/LearningPathInformation.d.ts +1 -1
- package/lib/LearningPaths/LearningPathLastStepNavigation.d.ts +3 -4
- package/lib/LearningPaths/LearningPathLastStepNavigation.js +10 -8
- package/lib/LearningPaths/LearningPathMenu.d.ts +1 -1
- package/lib/LearningPaths/LearningPathMenuAside.d.ts +2 -4
- package/lib/LearningPaths/LearningPathMenuAside.js +12 -10
- package/lib/LearningPaths/LearningPathMenuAsideCopyright.d.ts +1 -1
- package/lib/LearningPaths/LearningPathMenuContent.d.ts +1 -1
- package/lib/LearningPaths/LearningPathMenuIntro.d.ts +1 -1
- package/lib/LearningPaths/LearningPathMenuModalWrapper.d.ts +1 -1
- package/lib/LearningPaths/LearningPathMobileHeader.d.ts +2 -4
- package/lib/LearningPaths/LearningPathMobileHeader.js +7 -6
- package/lib/LearningPaths/LearningPathMobileStepInfo.d.ts +2 -4
- package/lib/LearningPaths/LearningPathMobileStepInfo.js +7 -5
- package/lib/LearningPaths/LearningPathSticky.d.ts +3 -3
- package/lib/LearningPaths/LearningPathWrapper.d.ts +1 -1
- package/lib/Logo/Logo.d.ts +1 -1
- package/lib/Logo/SvgLogo.d.ts +1 -1
- package/lib/Masthead/Masthead.d.ts +2 -2
- package/lib/Masthead/MastheadAuthModal.d.ts +1 -1
- package/lib/Masthead/MastheadSearchModal.d.ts +3 -4
- package/lib/Masthead/MastheadSearchModal.js +9 -7
- package/lib/Masthead/SkipToMainContent.d.ts +1 -1
- package/lib/MediaList/MediaList.d.ts +8 -8
- package/lib/Messages/MessageBanner.d.ts +1 -1
- package/lib/Messages/MessageBox.d.ts +2 -5
- package/lib/Messages/MessageBox.js +10 -14
- package/lib/Messages/MessageBoxTag.d.ts +1 -1
- package/lib/MultidisciplinarySubject/Illustrations.d.ts +7 -7
- package/lib/MultidisciplinarySubject/List.d.ts +1 -1
- package/lib/MultidisciplinarySubject/ListItem.d.ts +1 -1
- package/lib/MultidisciplinarySubject/MultidisciplinarySubject.d.ts +1 -1
- package/lib/MultidisciplinarySubject/MultidisciplinarySubjectHeader.d.ts +1 -1
- package/lib/MyNdla/Resource/Folder.d.ts +2 -2
- package/lib/MyNdla/Resource/Folder.js +115 -57
- package/lib/MyNdla/Resource/FolderInput.d.ts +1 -1
- package/lib/NDLAFilm/AboutNdlaFilm.d.ts +1 -1
- package/lib/NDLAFilm/AllMoviesAlphabetically.d.ts +1 -1
- package/lib/NDLAFilm/CategorySelect.d.ts +10 -5
- package/lib/NDLAFilm/CategorySelect.js +99 -145
- package/lib/NDLAFilm/FilmContentCard.d.ts +1 -1
- package/lib/NDLAFilm/FilmContentCardTags.d.ts +1 -1
- package/lib/NDLAFilm/FilmMovieList.d.ts +1 -1
- package/lib/NDLAFilm/FilmMovieSearch.d.ts +1 -1
- package/lib/NDLAFilm/FilmSlideshow.d.ts +1 -1
- package/lib/NDLAFilm/MovieGrid.d.ts +1 -1
- package/lib/NDLAFilm/NavigationArrow.d.ts +2 -2
- package/lib/NDLAFilm/SlideshowIndicator.d.ts +1 -1
- package/lib/NDLAFilm/VisualElement.d.ts +1 -1
- package/lib/NDLAFilm/filmStyles.d.ts +2 -2
- package/lib/Navigation/NavigationBox.d.ts +1 -1
- package/lib/Navigation/NavigationHeading.d.ts +1 -1
- package/lib/Navigation/NavigationTopicAbout.d.ts +1 -1
- package/lib/NoContentBox/NoContentBox.d.ts +1 -1
- package/lib/Notion/ConceptNotion.d.ts +1 -1
- package/lib/Notion/FigureNotion.d.ts +1 -1
- package/lib/Notion/Notion.d.ts +1 -1
- package/lib/Notion/NotionImage.d.ts +1 -1
- package/lib/Notion/NotionVisualElement.d.ts +1 -1
- package/lib/Portrait/Portrait.d.ts +1 -1
- package/lib/Programme/Programme.d.ts +1 -1
- package/lib/Programme/ProgrammeSubjects.d.ts +1 -1
- package/lib/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +2 -2
- package/lib/Resource/BlockResource.d.ts +2 -2
- package/lib/Resource/BlockResource.js +44 -30
- package/lib/Resource/ListResource.d.ts +1 -1
- package/lib/Resource/ListResource.js +40 -36
- package/lib/Resource/resourceComponents.d.ts +7 -7
- package/lib/Resource/resourceComponents.js +28 -31
- package/lib/ResourceBox/ResourceBox.d.ts +1 -1
- package/lib/ResourceGroup/ResourceGroup.d.ts +1 -1
- package/lib/ResourceGroup/ResourceItem.d.ts +1 -1
- package/lib/ResourceGroup/ResourceList.d.ts +1 -1
- package/lib/ResourcesWrapper/ResourcesTitle.d.ts +1 -1
- package/lib/ResourcesWrapper/ResourcesTopicTitle.d.ts +1 -1
- package/lib/ResourcesWrapper/ResourcesWrapper.d.ts +1 -1
- package/lib/Search/ActiveFilterContent.d.ts +2 -2
- package/lib/Search/ActiveFilters.d.ts +1 -1
- package/lib/Search/ContentTypeResult.d.ts +1 -1
- package/lib/Search/ContentTypeResultStyles.d.ts +6 -6
- package/lib/Search/LoadingWrapper.d.ts +1 -1
- package/lib/Search/SearchField.d.ts +1 -1
- package/lib/Search/SearchFieldForm.d.ts +1 -1
- package/lib/Search/SearchResult.d.ts +2 -2
- package/lib/Search/SearchResultSleeve.d.ts +1 -1
- package/lib/Search/ToggleSearchButton.d.ts +1 -1
- package/lib/SearchTypeResult/ActiveFilterContent.d.ts +3 -4
- package/lib/SearchTypeResult/ActiveFilterContent.js +8 -6
- package/lib/SearchTypeResult/ActiveFilters.d.ts +1 -1
- package/lib/SearchTypeResult/PopupFilter.d.ts +1 -1
- package/lib/SearchTypeResult/ResultNavigation.d.ts +1 -1
- package/lib/SearchTypeResult/SearchFieldHeader.d.ts +1 -1
- package/lib/SearchTypeResult/SearchFilterContent.d.ts +1 -1
- package/lib/SearchTypeResult/SearchHeader.d.ts +3 -4
- package/lib/SearchTypeResult/SearchHeader.js +13 -12
- package/lib/SearchTypeResult/SearchItem.d.ts +1 -1
- package/lib/SearchTypeResult/SearchItemList.d.ts +1 -1
- package/lib/SearchTypeResult/SearchItems.d.ts +1 -1
- package/lib/SearchTypeResult/SearchNotionItem.d.ts +1 -1
- package/lib/SearchTypeResult/SearchNotionsResult.d.ts +3 -4
- package/lib/SearchTypeResult/SearchNotionsResult.js +5 -6
- package/lib/SearchTypeResult/SearchSubjectItem.d.ts +1 -1
- package/lib/SearchTypeResult/SearchSubjectResult.d.ts +1 -1
- package/lib/SearchTypeResult/SearchTypeHeader.d.ts +1 -2
- package/lib/SearchTypeResult/SearchTypeHeader.js +15 -12
- package/lib/SearchTypeResult/SearchTypeResult.d.ts +1 -1
- package/lib/SearchTypeResult/SearchViewType.d.ts +1 -1
- package/lib/SearchTypeResult/components/ItemContexts.d.ts +1 -1
- package/lib/SearchTypeResult/components/ItemResourceHeader.d.ts +1 -1
- package/lib/SearchTypeResult/components/ItemTopicHeader.d.ts +1 -1
- package/lib/SearchTypeResult/components/SubjectFilters.d.ts +1 -1
- package/lib/SectionHeading/SectionHeading.d.ts +1 -1
- package/lib/SnackBar/DefaultSnackbar.d.ts +1 -1
- package/lib/SnackBar/SnackbarProvider.d.ts +2 -2
- package/lib/Subject/Subject.d.ts +8 -8
- package/lib/Subject/SubjectAbout.d.ts +1 -1
- package/lib/Subject/SubjectArchive.d.ts +1 -1
- package/lib/Subject/SubjectBanner.d.ts +1 -1
- package/lib/Subject/SubjectCarousel.d.ts +2 -4
- package/lib/Subject/SubjectCarousel.js +10 -8
- package/lib/Subject/SubjectHeader.d.ts +1 -1
- package/lib/Subject/SubjectLinks.d.ts +1 -1
- package/lib/Subject/SubjectNewContent.d.ts +1 -1
- package/lib/Subject/SubjectShortcuts.d.ts +1 -1
- package/lib/Subject/SubjectSocial.d.ts +2 -2
- package/lib/Table/Table.d.ts +1 -1
- package/lib/TagSelector/Control.d.ts +1 -1
- package/lib/TagSelector/DropdownIndicator.d.ts +1 -1
- package/lib/TagSelector/Input.d.ts +1 -1
- package/lib/TagSelector/Menu.d.ts +1 -1
- package/lib/TagSelector/MenuList.d.ts +2 -2
- package/lib/TagSelector/Option.d.ts +1 -1
- package/lib/TagSelector/SelectContainer.d.ts +1 -1
- package/lib/TagSelector/TagSelector.d.ts +1 -1
- package/lib/TagSelector/ValueButton.d.ts +2 -2
- package/lib/ToolboxPage/ToolboxInfo.d.ts +3 -4
- package/lib/ToolboxPage/ToolboxInfo.js +8 -6
- package/lib/Topic/Loader.d.ts +1 -1
- package/lib/Topic/Topic.d.ts +1 -1
- package/lib/TopicIntroductionList/TopicIntroduction.d.ts +1 -1
- package/lib/TopicIntroductionList/TopicIntroductionList.d.ts +1 -1
- package/lib/TopicIntroductionList/TopicIntroductionShortcuts.d.ts +1 -1
- package/lib/TopicIntroductionList/TopicShortcutItem.d.ts +1 -1
- package/lib/Translation/Translation.d.ts +1 -1
- package/lib/Translation/TranslationBox.d.ts +1 -1
- package/lib/Translation/TranslationLine.d.ts +1 -1
- package/lib/TreeStructure/AddFolderButton.d.ts +1 -1
- package/lib/TreeStructure/FolderItem.d.ts +1 -1
- package/lib/TreeStructure/FolderItems.d.ts +1 -1
- package/lib/TreeStructure/NavigationLink.d.ts +1 -1
- package/lib/TreeStructure/TreeStructure.d.ts +1 -1
- package/lib/TreeStructure/helperFunctions.d.ts +1 -1
- package/lib/User/AuthModal.d.ts +1 -1
- package/lib/User/UserInfo.d.ts +1 -1
- package/lib/User/UserInfo.js +23 -2
- package/lib/User/apiTypes.d.ts +10 -2
- package/lib/User/parseUserObject.d.ts +2 -1
- package/lib/User/parseUserObject.js +22 -12
- package/lib/locale/LocaleProvider.d.ts +1 -1
- package/lib/locale/messages-en.d.ts +4 -0
- package/lib/locale/messages-en.js +5 -1
- package/lib/locale/messages-nb.d.ts +4 -0
- package/lib/locale/messages-nb.js +5 -1
- package/lib/locale/messages-nn.d.ts +4 -0
- package/lib/locale/messages-nn.js +5 -1
- package/lib/locale/messages-se.d.ts +4 -0
- package/lib/locale/messages-se.js +33 -29
- package/lib/locale/messages-sma.d.ts +4 -0
- package/lib/locale/messages-sma.js +5 -1
- package/lib/utils/createUniversalPortal.d.ts +1 -1
- package/lib/utils/createUniversalPortal.js +1 -1
- package/package.json +10 -10
- package/src/Article/ArticleHeaderWrapper.tsx +53 -66
- package/src/Footer/FooterLinks.tsx +43 -40
- package/src/Frontpage/FrontpageFilm.tsx +20 -17
- package/src/Frontpage/FrontpageMultidisciplinarySubject.tsx +33 -30
- package/src/Frontpage/FrontpageToolbox.tsx +21 -18
- package/src/LearningPaths/LearningPathLastStepNavigation.tsx +32 -29
- package/src/LearningPaths/LearningPathMenuAside.tsx +25 -29
- package/src/LearningPaths/LearningPathMobileHeader.tsx +11 -8
- package/src/LearningPaths/LearningPathMobileStepInfo.tsx +13 -10
- package/src/Masthead/MastheadSearchModal.tsx +36 -35
- package/src/Messages/MessageBox.tsx +2 -3
- package/src/MyNdla/Resource/Folder.tsx +118 -84
- package/src/NDLAFilm/CategorySelect.tsx +77 -97
- package/src/Resource/BlockResource.tsx +34 -28
- package/src/Resource/ListResource.tsx +76 -74
- package/src/Resource/resourceComponents.tsx +15 -20
- package/src/SearchTypeResult/ActiveFilterContent.tsx +18 -15
- package/src/SearchTypeResult/SearchHeader.tsx +4 -4
- package/src/SearchTypeResult/SearchNotionsResult.tsx +2 -3
- package/src/SearchTypeResult/SearchTypeHeader.tsx +48 -45
- package/src/Subject/SubjectCarousel.tsx +93 -96
- package/src/ToolboxPage/ToolboxInfo.tsx +19 -16
- package/src/User/UserInfo.tsx +22 -0
- package/src/User/__tests__/parseUserObject-test.ts +1 -0
- package/src/User/apiTypes.ts +11 -2
- package/src/User/parseUserObject.ts +17 -11
- package/src/locale/messages-en.ts +4 -0
- package/src/locale/messages-nb.ts +4 -0
- package/src/locale/messages-nn.ts +4 -0
- package/src/locale/messages-se.ts +32 -28
- package/src/locale/messages-sma.ts +4 -0
- package/src/utils/createUniversalPortal.tsx +1 -6
|
@@ -25,27 +25,12 @@ import {
|
|
|
25
25
|
import ContentLoader from '../ContentLoader';
|
|
26
26
|
import { contentTypeMapping } from '../model/ContentType';
|
|
27
27
|
|
|
28
|
-
interface BlockResourceProps {
|
|
29
|
-
id: string;
|
|
30
|
-
link: string;
|
|
31
|
-
tagLinkPrefix?: string;
|
|
32
|
-
title: string;
|
|
33
|
-
resourceImage: ResourceImageProps;
|
|
34
|
-
tags?: string[];
|
|
35
|
-
description?: string;
|
|
36
|
-
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
37
|
-
menuItems?: MenuItemProps[];
|
|
38
|
-
isLoading?: boolean;
|
|
39
|
-
targetBlank?: boolean;
|
|
40
|
-
resourceTypes?: { id: string; name: string }[];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
28
|
const BlockElementWrapper = styled.div`
|
|
44
29
|
display: flex;
|
|
45
30
|
text-decoration: none;
|
|
46
31
|
box-shadow: none;
|
|
47
32
|
flex-direction: column;
|
|
48
|
-
max-width:
|
|
33
|
+
max-width: 450px;
|
|
49
34
|
max-height: 240px;
|
|
50
35
|
border: 1px solid ${colors.brand.light};
|
|
51
36
|
border-radius: 2px;
|
|
@@ -83,14 +68,18 @@ const BlockDescription = styled.p`
|
|
|
83
68
|
|
|
84
69
|
const RightRow = styled(Row)`
|
|
85
70
|
justify-content: flex-end;
|
|
86
|
-
margin
|
|
71
|
+
margin: 0 -${spacing.small} -${spacing.small} 0;
|
|
87
72
|
`;
|
|
88
73
|
|
|
89
74
|
const BlockInfoWrapper = styled.div`
|
|
90
75
|
display: flex;
|
|
91
76
|
flex-direction: column;
|
|
92
77
|
padding: ${spacing.small};
|
|
93
|
-
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
const ContentWrapper = styled.div`
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: column;
|
|
94
83
|
`;
|
|
95
84
|
|
|
96
85
|
const ImageWrapper = styled.div`
|
|
@@ -99,11 +88,11 @@ const ImageWrapper = styled.div`
|
|
|
99
88
|
justify-content: center;
|
|
100
89
|
overflow: hidden;
|
|
101
90
|
align-items: center;
|
|
102
|
-
aspect-ratio: 3/4;
|
|
103
91
|
img {
|
|
104
92
|
min-width: 100%;
|
|
105
93
|
}
|
|
106
94
|
`;
|
|
95
|
+
|
|
107
96
|
interface BlockImageProps {
|
|
108
97
|
image: ResourceImageProps;
|
|
109
98
|
loading?: boolean;
|
|
@@ -142,6 +131,21 @@ const ResourceTypeAndTitleLoader = ({ children, loading }: LoaderProps) => {
|
|
|
142
131
|
return <>{children}</>;
|
|
143
132
|
};
|
|
144
133
|
|
|
134
|
+
interface Props {
|
|
135
|
+
id: string;
|
|
136
|
+
link: string;
|
|
137
|
+
tagLinkPrefix?: string;
|
|
138
|
+
title: string;
|
|
139
|
+
resourceImage: ResourceImageProps;
|
|
140
|
+
tags?: string[];
|
|
141
|
+
description?: string;
|
|
142
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
143
|
+
menuItems?: MenuItemProps[];
|
|
144
|
+
isLoading?: boolean;
|
|
145
|
+
targetBlank?: boolean;
|
|
146
|
+
resourceTypes?: { id: string; name: string }[];
|
|
147
|
+
}
|
|
148
|
+
|
|
145
149
|
const BlockResource = ({
|
|
146
150
|
id,
|
|
147
151
|
link,
|
|
@@ -155,7 +159,7 @@ const BlockResource = ({
|
|
|
155
159
|
headingLevel = 'h2',
|
|
156
160
|
targetBlank,
|
|
157
161
|
resourceTypes,
|
|
158
|
-
}:
|
|
162
|
+
}: Props) => {
|
|
159
163
|
const linkRef = useRef<HTMLAnchorElement>(null);
|
|
160
164
|
const firstResourceType = resourceTypes?.[0].id ?? '';
|
|
161
165
|
const Title = ResourceTitle.withComponent(headingLevel);
|
|
@@ -176,15 +180,17 @@ const BlockResource = ({
|
|
|
176
180
|
/>
|
|
177
181
|
</ImageWrapper>
|
|
178
182
|
<BlockInfoWrapper>
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
<ContentWrapper>
|
|
184
|
+
<ResourceTypeAndTitleLoader loading={isLoading}>
|
|
185
|
+
<ResourceTitleLink title={title} target={targetBlank ? '_blank' : undefined} to={link} ref={linkRef}>
|
|
186
|
+
<Title>{title}</Title>
|
|
187
|
+
</ResourceTitleLink>
|
|
188
|
+
</ResourceTypeAndTitleLoader>
|
|
189
|
+
<ResourceTypeList resourceTypes={resourceTypes} />
|
|
190
|
+
<BlockDescription>{description}</BlockDescription>
|
|
191
|
+
</ContentWrapper>
|
|
186
192
|
<RightRow>
|
|
187
|
-
{tags && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
193
|
+
{tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
188
194
|
{menuItems && menuItems.length > 0 && <MenuButton alignRight size="small" menuItems={menuItems} />}
|
|
189
195
|
</RightRow>
|
|
190
196
|
</BlockInfoWrapper>
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
CompressedTagList,
|
|
16
16
|
ResourceImageProps,
|
|
17
17
|
ResourceTitle,
|
|
18
|
-
ResourceTitleLink,
|
|
18
|
+
ResourceTitleLink as StyledLink,
|
|
19
19
|
ResourceTypeList,
|
|
20
20
|
StyledContentIconWrapper,
|
|
21
21
|
LoaderProps,
|
|
@@ -24,30 +24,13 @@ import ContentLoader from '../ContentLoader';
|
|
|
24
24
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
25
25
|
import { contentTypeMapping } from '../model/ContentType';
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
grid-area: description;
|
|
29
|
-
line-clamp: 2;
|
|
30
|
-
line-height: 1em;
|
|
31
|
-
height: 3.1em;
|
|
32
|
-
margin: 0;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
${fonts.sizes(16)};
|
|
35
|
-
text-overflow: ellipsis;
|
|
36
|
-
// Unfortunate css needed for multi-line text overflow ellipsis.
|
|
37
|
-
display: -webkit-box;
|
|
38
|
-
-webkit-line-clamp: 2;
|
|
39
|
-
line-clamp: 2;
|
|
40
|
-
-webkit-box-orient: vertical;
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
const ResourceWrapper = styled.div`
|
|
27
|
+
const ListResourceWrapper = styled.div`
|
|
44
28
|
flex: 1;
|
|
45
29
|
display: grid;
|
|
46
30
|
grid-template-columns: auto 1fr auto;
|
|
47
31
|
grid-template-areas:
|
|
48
32
|
'image topicAndTitle tags'
|
|
49
33
|
'image description description';
|
|
50
|
-
|
|
51
34
|
${mq.range({ until: breakpoints.mobileWide })} {
|
|
52
35
|
grid-template-columns: auto 1fr;
|
|
53
36
|
grid-template-areas:
|
|
@@ -56,46 +39,31 @@ const ResourceWrapper = styled.div`
|
|
|
56
39
|
'tags tags';
|
|
57
40
|
}
|
|
58
41
|
|
|
59
|
-
cursor: pointer;
|
|
60
42
|
padding: ${spacing.small};
|
|
43
|
+
column-gap: ${spacing.small};
|
|
44
|
+
cursor: pointer;
|
|
61
45
|
border: 1px solid ${colors.brand.neutral7};
|
|
62
46
|
border-radius: 2px;
|
|
63
|
-
gap: 0 ${spacing.small};
|
|
64
47
|
|
|
65
48
|
&:hover {
|
|
66
49
|
box-shadow: 1px 1px 6px 2px rgba(9, 55, 101, 0.08);
|
|
67
50
|
transition-duration: 0.2s;
|
|
68
|
-
${() =>
|
|
51
|
+
${() => StyledLink} {
|
|
69
52
|
color: ${colors.brand.primary};
|
|
70
53
|
text-decoration: underline;
|
|
71
54
|
}
|
|
72
55
|
}
|
|
73
56
|
`;
|
|
74
57
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
grid-area: tags;
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: center;
|
|
81
|
-
width: 100%;
|
|
82
|
-
overflow: hidden;
|
|
83
|
-
align-self: flex-start;
|
|
84
|
-
justify-self: flex-end;
|
|
85
|
-
justify-content: flex-end;
|
|
86
|
-
|
|
87
|
-
${mq.range({ from: breakpoints.mobileWide })} {
|
|
88
|
-
margin-top: -${spacing.xsmall};
|
|
89
|
-
margin-right: -${spacing.xxsmall};
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
58
|
+
interface StyledImageProps {
|
|
59
|
+
imageSize: 'normal' | 'compact';
|
|
60
|
+
}
|
|
92
61
|
|
|
93
|
-
const
|
|
62
|
+
const ImageWrapper = styled.div<StyledImageProps>`
|
|
94
63
|
grid-area: image;
|
|
95
64
|
width: ${(p) => (p.imageSize === 'normal' ? '136px' : '56px')};
|
|
96
65
|
${mq.range({ until: breakpoints.mobileWide })} {
|
|
97
|
-
width:
|
|
98
|
-
height: 40px;
|
|
66
|
+
width: 56px;
|
|
99
67
|
}
|
|
100
68
|
overflow: hidden;
|
|
101
69
|
border-radius: 2px;
|
|
@@ -110,29 +78,48 @@ const StyledImage = styled(Image)`
|
|
|
110
78
|
aspect-ratio: 4/3;
|
|
111
79
|
`;
|
|
112
80
|
|
|
81
|
+
const StyledResourceDescription = styled.p`
|
|
82
|
+
grid-area: description;
|
|
83
|
+
line-clamp: 2;
|
|
84
|
+
line-height: 1em;
|
|
85
|
+
height: 3.1em;
|
|
86
|
+
margin: 0;
|
|
87
|
+
margin-top: ${spacing.xxsmall};
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
${fonts.sizes(16)};
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
// Unfortunate css needed for multi-line text overflow ellipsis.
|
|
92
|
+
display: -webkit-box;
|
|
93
|
+
-webkit-line-clamp: 2;
|
|
94
|
+
line-clamp: 2;
|
|
95
|
+
-webkit-box-orient: vertical;
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const TagsandActionMenu = styled.div`
|
|
99
|
+
box-sizing: content-box;
|
|
100
|
+
grid-area: tags;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
width: 100%;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
align-self: flex-start;
|
|
106
|
+
justify-self: flex-end;
|
|
107
|
+
justify-content: flex-end;
|
|
108
|
+
margin: -${spacing.small} -${spacing.small} 0 0;
|
|
109
|
+
${mq.range({ until: breakpoints.mobileWide })} {
|
|
110
|
+
margin: 0 -${spacing.small} -${spacing.small} 0;
|
|
111
|
+
}
|
|
112
|
+
`;
|
|
113
|
+
|
|
113
114
|
const TopicAndTitleWrapper = styled.div`
|
|
114
115
|
grid-area: topicAndTitle;
|
|
115
|
-
margin-top: 2px;
|
|
116
116
|
`;
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
id: string;
|
|
124
|
-
link: string;
|
|
125
|
-
tagLinkPrefix?: string;
|
|
126
|
-
title: string;
|
|
127
|
-
resourceImage: ResourceImageProps;
|
|
128
|
-
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
129
|
-
resourceTypes: { id: string; name: string }[];
|
|
130
|
-
tags?: string[];
|
|
131
|
-
description?: string;
|
|
132
|
-
menuItems?: MenuItemProps[];
|
|
133
|
-
isLoading?: boolean;
|
|
134
|
-
targetBlank?: boolean;
|
|
135
|
-
}
|
|
118
|
+
const StyledMenuButton = styled(MenuButton)`
|
|
119
|
+
:only-child {
|
|
120
|
+
margin-left: ${spacing.small};
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
136
123
|
|
|
137
124
|
interface ListResourceImageProps {
|
|
138
125
|
resourceImage: ResourceImageProps;
|
|
@@ -170,7 +157,7 @@ const ListResourceImage = ({ resourceImage, loading, type, contentType }: ListRe
|
|
|
170
157
|
);
|
|
171
158
|
};
|
|
172
159
|
|
|
173
|
-
const
|
|
160
|
+
const TypeAndTitleLoader = ({ loading, children }: LoaderProps) => {
|
|
174
161
|
if (loading) {
|
|
175
162
|
return (
|
|
176
163
|
<ContentLoader height={'40px'} width={'100%'} viewBox={null} preserveAspectRatio="none">
|
|
@@ -188,7 +175,7 @@ interface ResourceDescriptionProps {
|
|
|
188
175
|
loading?: boolean;
|
|
189
176
|
}
|
|
190
177
|
|
|
191
|
-
const
|
|
178
|
+
const Description = ({ description, loading }: ResourceDescriptionProps) => {
|
|
192
179
|
if (loading) {
|
|
193
180
|
return (
|
|
194
181
|
<ContentLoader height={'20px'} width={'100%'} viewBox={null} preserveAspectRatio="none">
|
|
@@ -199,6 +186,21 @@ const ResourceDescription = ({ description, loading }: ResourceDescriptionProps)
|
|
|
199
186
|
return <StyledResourceDescription>{description}</StyledResourceDescription>;
|
|
200
187
|
};
|
|
201
188
|
|
|
189
|
+
export interface ListResourceProps {
|
|
190
|
+
id: string;
|
|
191
|
+
link: string;
|
|
192
|
+
tagLinkPrefix?: string;
|
|
193
|
+
title: string;
|
|
194
|
+
resourceImage: ResourceImageProps;
|
|
195
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
196
|
+
resourceTypes: { id: string; name: string }[];
|
|
197
|
+
tags?: string[];
|
|
198
|
+
description?: string;
|
|
199
|
+
menuItems?: MenuItemProps[];
|
|
200
|
+
isLoading?: boolean;
|
|
201
|
+
targetBlank?: boolean;
|
|
202
|
+
}
|
|
203
|
+
|
|
202
204
|
const ListResource = ({
|
|
203
205
|
id,
|
|
204
206
|
link,
|
|
@@ -225,29 +227,29 @@ const ListResource = ({
|
|
|
225
227
|
};
|
|
226
228
|
|
|
227
229
|
return (
|
|
228
|
-
<
|
|
229
|
-
<
|
|
230
|
+
<ListResourceWrapper onClick={handleClick} id={id}>
|
|
231
|
+
<ImageWrapper imageSize={imageType}>
|
|
230
232
|
<ListResourceImage
|
|
231
233
|
resourceImage={resourceImage}
|
|
232
234
|
loading={isLoading}
|
|
233
235
|
type={imageType}
|
|
234
236
|
contentType={contentTypeMapping[firstContentType] ?? contentTypeMapping['default']}
|
|
235
237
|
/>
|
|
236
|
-
</
|
|
238
|
+
</ImageWrapper>
|
|
237
239
|
<TopicAndTitleWrapper>
|
|
238
|
-
<
|
|
239
|
-
<
|
|
240
|
+
<TypeAndTitleLoader loading={isLoading}>
|
|
241
|
+
<StyledLink to={link} target={targetBlank ? '_blank' : undefined} ref={linkRef}>
|
|
240
242
|
<Title>{title}</Title>
|
|
241
|
-
</
|
|
243
|
+
</StyledLink>
|
|
242
244
|
<ResourceTypeList resourceTypes={resourceTypes} />
|
|
243
|
-
</
|
|
245
|
+
</TypeAndTitleLoader>
|
|
244
246
|
</TopicAndTitleWrapper>
|
|
245
|
-
{showDescription && <
|
|
247
|
+
{showDescription && <Description description={description} loading={isLoading} />}
|
|
246
248
|
<TagsandActionMenu>
|
|
247
|
-
{tags && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
248
|
-
{menuItems && menuItems.length > 0 && <
|
|
249
|
+
{tags && tags.length > 0 && <CompressedTagList tagLinkPrefix={tagLinkPrefix} tags={tags} />}
|
|
250
|
+
{menuItems && menuItems.length > 0 && <StyledMenuButton alignRight size="small" menuItems={menuItems} />}
|
|
249
251
|
</TagsandActionMenu>
|
|
250
|
-
</
|
|
252
|
+
</ListResourceWrapper>
|
|
251
253
|
);
|
|
252
254
|
};
|
|
253
255
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
|
-
import { colors, fonts,
|
|
10
|
+
import { colors, fonts, spacing } from '@ndla/core';
|
|
11
11
|
import React, { MouseEvent, ReactNode } from 'react';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { MenuButton } from '@ndla/button';
|
|
@@ -38,7 +38,7 @@ export const ResourceTitle = styled.h2`
|
|
|
38
38
|
line-clamp: 1;
|
|
39
39
|
-webkit-box-orient: vertical;
|
|
40
40
|
grid-area: resourceTitle;
|
|
41
|
-
${fonts.sizes('
|
|
41
|
+
${fonts.sizes('16px', '20px')};
|
|
42
42
|
`;
|
|
43
43
|
|
|
44
44
|
const StyledTagList = styled.ul`
|
|
@@ -48,6 +48,10 @@ const StyledTagList = styled.ul`
|
|
|
48
48
|
padding: 2px;
|
|
49
49
|
gap: ${spacing.xsmall};
|
|
50
50
|
overflow: hidden;
|
|
51
|
+
padding-right: 14px;
|
|
52
|
+
:only-child {
|
|
53
|
+
margin-right: ${spacing.small};
|
|
54
|
+
}
|
|
51
55
|
`;
|
|
52
56
|
|
|
53
57
|
const StyledTagListElement = styled.li`
|
|
@@ -60,6 +64,8 @@ const StyledSafeLink = styled(SafeLink)`
|
|
|
60
64
|
align-items: center;
|
|
61
65
|
box-shadow: none;
|
|
62
66
|
color: ${colors.brand.grey};
|
|
67
|
+
min-height: 44px;
|
|
68
|
+
min-width: 44px;
|
|
63
69
|
&:hover {
|
|
64
70
|
color: ${colors.brand.primary};
|
|
65
71
|
}
|
|
@@ -94,12 +100,9 @@ export const Row = styled.div`
|
|
|
94
100
|
`;
|
|
95
101
|
|
|
96
102
|
const TagCounterWrapper = styled.span`
|
|
97
|
-
|
|
98
|
-
box-shadow: none;
|
|
99
|
-
margin: 0;
|
|
103
|
+
display: flex;
|
|
100
104
|
font-weight: ${fonts.weight.semibold};
|
|
101
105
|
${fonts.sizes('14px', '14px')};
|
|
102
|
-
padding: 5px;
|
|
103
106
|
`;
|
|
104
107
|
|
|
105
108
|
export interface ContentIconProps {
|
|
@@ -149,15 +152,6 @@ interface CompressedTagListProps {
|
|
|
149
152
|
tagLinkPrefix?: string;
|
|
150
153
|
}
|
|
151
154
|
|
|
152
|
-
const TagMenuButton = styled(MenuButton)`
|
|
153
|
-
&:hover,
|
|
154
|
-
&:active,
|
|
155
|
-
&:focus {
|
|
156
|
-
transition: ${misc.transition.default};
|
|
157
|
-
border-radius: 100%;
|
|
158
|
-
background-color: ${colors.brand.light};
|
|
159
|
-
}
|
|
160
|
-
`;
|
|
161
155
|
export const CompressedTagList = ({ tags, tagLinkPrefix }: CompressedTagListProps) => {
|
|
162
156
|
const navigate = useNavigate();
|
|
163
157
|
const { t } = useTranslation();
|
|
@@ -175,12 +169,13 @@ export const CompressedTagList = ({ tags, tagLinkPrefix }: CompressedTagListProp
|
|
|
175
169
|
<>
|
|
176
170
|
<TagList tagLinkPrefix={tagLinkPrefix} tags={visibleTags} />
|
|
177
171
|
{remainingTags.length > 0 && (
|
|
178
|
-
<
|
|
179
|
-
|
|
172
|
+
<MenuButton
|
|
173
|
+
size="small"
|
|
174
|
+
menuIcon={<TagCounterWrapper>{`+${remainingTags.length}`}</TagCounterWrapper>}
|
|
180
175
|
menuItems={remainingTags}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
alignRight
|
|
177
|
+
aria-label={t('myNdla.moreTags', { count: remainingTags.length })}
|
|
178
|
+
/>
|
|
184
179
|
)}
|
|
185
180
|
</>
|
|
186
181
|
);
|
|
@@ -11,7 +11,7 @@ import styled from '@emotion/styled';
|
|
|
11
11
|
import { Cross } from '@ndla/icons/action';
|
|
12
12
|
import { spacing, fonts } from '@ndla/core';
|
|
13
13
|
import Button from '@ndla/button';
|
|
14
|
-
import {
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
15
|
|
|
16
16
|
export const StyledActiveFilterTitle = styled.span`
|
|
17
17
|
white-space: nowrap;
|
|
@@ -35,18 +35,21 @@ type Props = {
|
|
|
35
35
|
onFilterRemove: (value: string, name: string) => void;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const ActiveFilterContent = ({ filter, onFilterRemove
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
const ActiveFilterContent = ({ filter, onFilterRemove }: Props) => {
|
|
39
|
+
const { t } = useTranslation();
|
|
40
|
+
return (
|
|
41
|
+
<StyledButton
|
|
42
|
+
aria-label={t('searchPage.searchFilterMessages.removeFilter', {
|
|
43
|
+
filterName: filter.title,
|
|
44
|
+
})}
|
|
45
|
+
type="button"
|
|
46
|
+
size="normal"
|
|
47
|
+
borderShape="rounded"
|
|
48
|
+
onClick={() => onFilterRemove(filter.value, filter.name)}>
|
|
49
|
+
<StyledActiveFilterTitle>{filter.title}</StyledActiveFilterTitle>
|
|
50
|
+
<Cross />
|
|
51
|
+
</StyledButton>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
51
54
|
|
|
52
|
-
export default
|
|
55
|
+
export default ActiveFilterContent;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import React, { FormEvent, useEffect, useState } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
12
12
|
import Button from '@ndla/button';
|
|
@@ -84,8 +84,8 @@ const SearchHeader = ({
|
|
|
84
84
|
filters,
|
|
85
85
|
competenceGoals,
|
|
86
86
|
noResults,
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
}: Props) => {
|
|
88
|
+
const { t } = useTranslation();
|
|
89
89
|
const [isNarrowScreen, setIsNarrowScreen] = useState<boolean | undefined>();
|
|
90
90
|
|
|
91
91
|
useEffect(() => {
|
|
@@ -158,4 +158,4 @@ const SearchHeader = ({
|
|
|
158
158
|
);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
export default
|
|
161
|
+
export default SearchHeader;
|
|
@@ -11,7 +11,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
11
11
|
import styled from '@emotion/styled';
|
|
12
12
|
import { fonts, mq, breakpoints, spacing, colors } from '@ndla/core';
|
|
13
13
|
import { ModalCloseButton } from '@ndla/modal';
|
|
14
|
-
import { withTranslation, WithTranslation } from 'react-i18next';
|
|
15
14
|
|
|
16
15
|
const Wrapper = styled.div`
|
|
17
16
|
display: flex;
|
|
@@ -59,7 +58,7 @@ type Props = {
|
|
|
59
58
|
children: ReactNode;
|
|
60
59
|
};
|
|
61
60
|
|
|
62
|
-
const SearchNotionsResult = ({ totalCount, onRemove, children }: Props
|
|
61
|
+
const SearchNotionsResult = ({ totalCount, onRemove, children }: Props) => {
|
|
63
62
|
const { t } = useTranslation();
|
|
64
63
|
return (
|
|
65
64
|
<Wrapper>
|
|
@@ -75,4 +74,4 @@ const SearchNotionsResult = ({ totalCount, onRemove, children }: Props & WithTra
|
|
|
75
74
|
);
|
|
76
75
|
};
|
|
77
76
|
|
|
78
|
-
export default
|
|
77
|
+
export default SearchNotionsResult;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React, { MouseEvent, memo } from 'react';
|
|
9
|
+
import React, { MouseEvent, memo } from 'react';
|
|
10
10
|
import styled from '@emotion/styled';
|
|
11
11
|
import Button from '@ndla/button';
|
|
12
12
|
import { breakpoints, fonts, mq, spacing } from '@ndla/core';
|
|
13
|
-
import {
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { Cross } from '@ndla/icons/action';
|
|
15
15
|
import ContentTypeBadge from '../ContentTypeBadge';
|
|
16
16
|
import { ContentType } from './SearchTypeResult';
|
|
@@ -85,47 +85,50 @@ type Props = {
|
|
|
85
85
|
totalCount: number;
|
|
86
86
|
type?: ContentType;
|
|
87
87
|
};
|
|
88
|
-
const SearchTypeHeader = ({ filters = [], onFilterClick, totalCount, type
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
)
|
|
88
|
+
const SearchTypeHeader = ({ filters = [], onFilterClick, totalCount, type }: Props) => {
|
|
89
|
+
const { t } = useTranslation();
|
|
90
|
+
return (
|
|
91
|
+
<Wrapper>
|
|
92
|
+
<HeaderWrapper>
|
|
93
|
+
<TypeWrapper>
|
|
94
|
+
{type && (
|
|
95
|
+
<BadgeWrapper>
|
|
96
|
+
<ContentTypeBadge type={type} title={t(`contentTypes.${type}`)} background border={false} size="large" />
|
|
97
|
+
</BadgeWrapper>
|
|
98
|
+
)}
|
|
99
|
+
<SubjectName>
|
|
100
|
+
<b>{type ? t(`contentTypes.${type}`) : t(`searchPage.resultType.allContentTypes`)}</b>{' '}
|
|
101
|
+
{totalCount && <Count>{t(`searchPage.resultType.hits`, { count: totalCount })}</Count>}
|
|
102
|
+
</SubjectName>
|
|
103
|
+
</TypeWrapper>
|
|
104
|
+
</HeaderWrapper>
|
|
105
|
+
{filters.length > 0 && (
|
|
106
|
+
<CategoryItems>
|
|
107
|
+
{filters.map((option: FilterOptionsType) => (
|
|
108
|
+
<CategoryTypeButtonWrapper key={option.id}>
|
|
109
|
+
<Button
|
|
110
|
+
size="xsmall"
|
|
111
|
+
borderShape="rounded"
|
|
112
|
+
greyLighter={!option.active}
|
|
113
|
+
onClick={(e: MouseEvent<HTMLButtonElement>) => {
|
|
114
|
+
if (e.currentTarget && option.active) {
|
|
115
|
+
e.currentTarget.blur();
|
|
116
|
+
}
|
|
117
|
+
onFilterClick?.(option.id);
|
|
118
|
+
}}>
|
|
119
|
+
{option.name}
|
|
120
|
+
{option.active && (
|
|
121
|
+
<CategoryTypeCrossWrapper>
|
|
122
|
+
<Cross />
|
|
123
|
+
</CategoryTypeCrossWrapper>
|
|
124
|
+
)}
|
|
125
|
+
</Button>
|
|
126
|
+
</CategoryTypeButtonWrapper>
|
|
127
|
+
))}
|
|
128
|
+
</CategoryItems>
|
|
129
|
+
)}
|
|
130
|
+
</Wrapper>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
130
133
|
|
|
131
|
-
export default memo(
|
|
134
|
+
export default memo(SearchTypeHeader);
|