@ndla/ui 55.0.15-alpha.0 → 55.0.17-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/panda.buildinfo.json +125 -29
- package/dist/styles.css +453 -103
- package/es/Article/Article.js +101 -162
- package/es/Article/ArticleByline.js +89 -56
- package/es/Article/ArticleFootNotes.js +35 -23
- package/es/Article/ArticleParagraph.js +2 -2
- package/es/Article/index.js +3 -5
- package/es/AudioPlayer/AudioPlayer.js +20 -20
- package/es/AudioPlayer/Controls.js +45 -45
- package/es/AudioPlayer/SpeechControl.js +8 -8
- package/es/BlogPost/BlogPost.js +6 -6
- package/es/Breadcrumb/Breadcrumb.js +19 -29
- package/es/Breadcrumb/BreadcrumbItem.js +20 -49
- package/es/Breadcrumb/HomeBreadcrumb.js +36 -82
- package/es/CampaignBlock/CampaignBlock.js +12 -12
- package/es/CodeBlock/CodeBlock.js +2 -2
- package/es/Concept/Concept.js +11 -11
- package/es/ContactBlock/ContactBlock.js +170 -185
- package/es/ContactBlock/index.js +3 -3
- package/es/ContentLoader/index.js +12 -12
- package/es/ContentPlaceholder/ContentPlaceholder.js +3 -3
- package/es/ContentTypeBadge/ContentTypeBadge.js +81 -80
- package/es/ContentTypeBadge/ContentTypeBadgeNew.js +3 -2
- package/es/ContentTypeHero/ContentTypeHero.js +50 -0
- package/es/{Logo → ContentTypeHero}/index.js +2 -3
- package/es/CopyParagraphButton/CopyParagraphButton.js +13 -12
- package/es/Embed/AudioEmbed.js +7 -7
- package/es/Embed/BrightcoveEmbed.js +8 -8
- package/es/Embed/CodeEmbed.js +6 -6
- package/es/Embed/ConceptEmbed.js +13 -13
- package/es/Embed/ConceptListEmbed.js +9 -9
- package/es/Embed/ContentLinkEmbed.js +6 -6
- package/es/Embed/CopyrightEmbed.js +3 -3
- package/es/Embed/EmbedErrorPlaceholder.js +5 -5
- package/es/Embed/ExternalEmbed.js +5 -5
- package/es/Embed/FootnoteEmbed.js +5 -5
- package/es/Embed/GlossEmbed.js +11 -11
- package/es/Embed/H5pEmbed.js +5 -5
- package/es/Embed/IframeEmbed.js +6 -6
- package/es/Embed/ImageEmbed.js +10 -10
- package/es/Embed/InlineTriggerButton.js +2 -2
- package/es/Embed/RelatedContentEmbed.js +5 -5
- package/es/Embed/UnknownEmbed.js +3 -3
- package/es/Embed/UuDisclaimerEmbed.js +6 -6
- package/es/ErrorMessage/ErrorMessage.js +14 -14
- package/es/ErrorMessage/ErrorResourceAccessDenied.js +6 -6
- package/es/FactBox/FactBox.js +5 -5
- package/es/FileList/File.js +3 -3
- package/es/FileList/FileList.js +6 -6
- package/es/FileList/Format.js +6 -6
- package/es/FileList/PdfFile.js +5 -5
- package/es/FrontpageArticle/FrontpageArticle.js +7 -8
- package/es/Gloss/Gloss.js +23 -23
- package/es/Gloss/GlossExample.js +9 -9
- package/es/Grid/Grid.js +4 -4
- package/es/KeyFigure/KeyFigure.js +5 -5
- package/es/Layout/LayoutItem.js +25 -37
- package/es/Layout/OneColumn.js +33 -31
- package/es/Layout/PageContainer.js +21 -30
- package/es/LicenseByline/EmbedByline.js +21 -21
- package/es/LicenseByline/LicenseLink.js +3 -3
- package/es/LinkBlock/LinkBlock.js +8 -8
- package/es/LinkBlock/LinkBlockSection.js +4 -4
- package/es/Messages/MessageBox.js +11 -11
- package/es/Messages/index.js +1 -2
- package/es/ProgrammeCard/ProgrammeCard.js +5 -5
- package/es/RelatedArticleList/RelatedArticleList.js +15 -15
- package/es/ResourceBox/ResourceBox.js +9 -9
- package/es/SnackBar/DefaultSnackbar.js +5 -5
- package/es/SnackBar/SnackbarProvider.js +7 -7
- package/es/TagSelector/TagSelector.js +17 -17
- package/es/TreeStructure/AddFolderButton.js +4 -4
- package/es/TreeStructure/ComboboxButton.js +7 -7
- package/es/TreeStructure/FolderItem.js +13 -13
- package/es/TreeStructure/FolderItems.js +6 -6
- package/es/TreeStructure/TreeStructure.js +9 -9
- package/es/ZendeskButton/ZendeskButton.js +2 -2
- package/es/i18n/index.js +1 -1
- package/es/index.js +5 -12
- package/es/locale/messages-en.js +1 -1
- package/es/locale/messages-nb.js +1 -1
- package/es/locale/messages-nn.js +1 -1
- package/es/locale/messages-se.js +1 -1
- package/es/locale/messages-sma.js +1 -1
- package/es/model/ContentType.js +3 -1
- package/es/styles.css +453 -103
- package/lib/Article/Article.d.ts +9 -30
- package/lib/Article/Article.js +104 -164
- package/lib/Article/ArticleByline.d.ts +1 -3
- package/lib/Article/ArticleByline.js +89 -56
- package/lib/Article/ArticleFootNotes.js +35 -24
- package/lib/Article/ArticleParagraph.js +2 -2
- package/lib/Article/index.d.ts +2 -5
- package/lib/Article/index.js +18 -24
- package/lib/AudioPlayer/AudioPlayer.js +20 -20
- package/lib/AudioPlayer/Controls.js +45 -45
- package/lib/AudioPlayer/SpeechControl.js +8 -8
- package/lib/BlogPost/BlogPost.js +6 -6
- package/lib/Breadcrumb/Breadcrumb.js +21 -29
- package/lib/Breadcrumb/BreadcrumbItem.js +22 -50
- package/lib/Breadcrumb/HomeBreadcrumb.d.ts +1 -2
- package/lib/Breadcrumb/HomeBreadcrumb.js +38 -82
- package/lib/CampaignBlock/CampaignBlock.js +12 -12
- package/lib/CodeBlock/CodeBlock.js +2 -2
- package/lib/Concept/Concept.js +11 -11
- package/lib/ContactBlock/ContactBlock.d.ts +6 -7
- package/lib/ContactBlock/ContactBlock.js +173 -184
- package/lib/ContactBlock/index.d.ts +3 -3
- package/lib/ContactBlock/index.js +13 -11
- package/lib/ContentLoader/index.js +12 -12
- package/lib/ContentPlaceholder/ContentPlaceholder.js +3 -3
- package/lib/ContentTypeBadge/ContentTypeBadge.d.ts +11 -12
- package/lib/ContentTypeBadge/ContentTypeBadge.js +83 -80
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +1 -2
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +3 -2
- package/lib/ContentTypeHero/ContentTypeHero.d.ts +15 -0
- package/lib/ContentTypeHero/ContentTypeHero.js +57 -0
- package/lib/ContentTypeHero/index.d.ts +9 -0
- package/lib/ContentTypeHero/index.js +12 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js +13 -12
- package/lib/Embed/AudioEmbed.js +7 -7
- package/lib/Embed/BrightcoveEmbed.js +8 -8
- package/lib/Embed/CodeEmbed.js +6 -6
- package/lib/Embed/ConceptEmbed.js +13 -13
- package/lib/Embed/ConceptListEmbed.js +9 -9
- package/lib/Embed/ContentLinkEmbed.js +6 -6
- package/lib/Embed/CopyrightEmbed.js +3 -3
- package/lib/Embed/EmbedErrorPlaceholder.js +5 -5
- package/lib/Embed/ExternalEmbed.js +5 -5
- package/lib/Embed/FootnoteEmbed.js +5 -5
- package/lib/Embed/GlossEmbed.js +11 -11
- package/lib/Embed/H5pEmbed.js +5 -5
- package/lib/Embed/IframeEmbed.js +6 -6
- package/lib/Embed/ImageEmbed.js +10 -10
- package/lib/Embed/InlineTriggerButton.js +2 -2
- package/lib/Embed/RelatedContentEmbed.js +5 -5
- package/lib/Embed/UnknownEmbed.js +3 -3
- package/lib/Embed/UuDisclaimerEmbed.js +6 -6
- package/lib/ErrorMessage/ErrorMessage.js +14 -14
- package/lib/ErrorMessage/ErrorResourceAccessDenied.js +6 -6
- package/lib/FactBox/FactBox.js +5 -5
- package/lib/FileList/File.js +3 -3
- package/lib/FileList/FileList.js +6 -6
- package/lib/FileList/Format.js +6 -6
- package/lib/FileList/PdfFile.js +5 -5
- package/lib/FrontpageArticle/FrontpageArticle.js +7 -8
- package/lib/Gloss/Gloss.js +23 -23
- package/lib/Gloss/GlossExample.js +9 -9
- package/lib/Grid/Grid.js +4 -4
- package/lib/KeyFigure/KeyFigure.js +5 -5
- package/lib/Layout/LayoutItem.d.ts +3 -7
- package/lib/Layout/LayoutItem.js +27 -38
- package/lib/Layout/OneColumn.d.ts +3 -6
- package/lib/Layout/OneColumn.js +36 -33
- package/lib/Layout/PageContainer.d.ts +3 -6
- package/lib/Layout/PageContainer.js +24 -32
- package/lib/LicenseByline/EmbedByline.js +21 -21
- package/lib/LicenseByline/LicenseLink.js +3 -3
- package/lib/LinkBlock/LinkBlock.js +8 -8
- package/lib/LinkBlock/LinkBlockSection.js +4 -4
- package/lib/Messages/MessageBox.js +11 -11
- package/lib/Messages/index.d.ts +1 -2
- package/lib/Messages/index.js +0 -7
- package/lib/ProgrammeCard/ProgrammeCard.js +5 -5
- package/lib/RelatedArticleList/RelatedArticleList.js +15 -15
- package/lib/ResourceBox/ResourceBox.js +9 -9
- package/lib/SnackBar/DefaultSnackbar.js +5 -5
- package/lib/SnackBar/SnackbarProvider.js +7 -7
- package/lib/TagSelector/TagSelector.js +17 -17
- package/lib/TreeStructure/AddFolderButton.js +4 -4
- package/lib/TreeStructure/ComboboxButton.js +7 -7
- package/lib/TreeStructure/FolderItem.js +13 -13
- package/lib/TreeStructure/FolderItems.js +6 -6
- package/lib/TreeStructure/TreeStructure.js +9 -9
- package/lib/ZendeskButton/ZendeskButton.js +2 -2
- package/lib/i18n/index.d.ts +1 -1
- package/lib/i18n/index.js +6 -0
- package/lib/index.d.ts +8 -15
- package/lib/index.js +30 -139
- package/lib/locale/messages-en.js +1 -1
- package/lib/locale/messages-nb.js +1 -1
- package/lib/locale/messages-nn.js +1 -1
- package/lib/locale/messages-se.js +1 -1
- package/lib/locale/messages-sma.js +1 -1
- package/lib/model/ContentType.d.ts +1 -0
- package/lib/model/ContentType.js +4 -2
- package/lib/styles.css +453 -103
- package/package.json +10 -11
- package/src/Article/Article.tsx +101 -229
- package/src/Article/ArticleByline.tsx +82 -69
- package/src/Article/ArticleFootNotes.tsx +32 -36
- package/src/Article/index.ts +3 -7
- package/src/Breadcrumb/Breadcrumb.tsx +20 -18
- package/src/Breadcrumb/BreadcrumbItem.tsx +36 -59
- package/src/Breadcrumb/HomeBreadcrumb.stories.tsx +0 -12
- package/src/Breadcrumb/HomeBreadcrumb.tsx +33 -46
- package/src/ContactBlock/{Contactblock.stories.tsx → ContactBlock.stories.tsx} +3 -4
- package/src/ContactBlock/ContactBlock.tsx +165 -199
- package/src/ContactBlock/index.ts +3 -3
- package/src/ContentTypeBadge/ContentTypeBadge.tsx +77 -77
- package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +3 -1
- package/src/ContentTypeHero/ContentTypeHero.stories.tsx +76 -0
- package/src/ContentTypeHero/ContentTypeHero.tsx +55 -0
- package/src/ContentTypeHero/index.ts +10 -0
- package/src/CopyParagraphButton/CopyParagraphButton.tsx +10 -3
- package/src/Embed/AudioEmbed.stories.tsx +6 -8
- package/src/Embed/BrightcoveEmbed.stories.tsx +6 -8
- package/src/Embed/ConceptEmbed.stories.tsx +6 -8
- package/src/Embed/ExternalEmbed.stories.tsx +5 -5
- package/src/Embed/H5pEmbed.stories.tsx +6 -8
- package/src/Embed/IframeEmbed.stories.tsx +6 -8
- package/src/Embed/ImageEmbed.stories.tsx +6 -8
- package/src/Embed/RelatedContentEmbed.stories.tsx +6 -8
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +6 -8
- package/src/FrontpageArticle/FrontpageArticle.tsx +1 -1
- package/src/Layout/LayoutItem.tsx +25 -41
- package/src/Layout/OneColumn.tsx +33 -33
- package/src/Layout/PageContainer.tsx +22 -24
- package/src/Messages/index.ts +1 -2
- package/src/i18n/index.ts +1 -0
- package/src/index.ts +11 -35
- package/src/locale/messages-en.ts +1 -1
- package/src/locale/messages-nb.ts +1 -1
- package/src/locale/messages-nn.ts +1 -1
- package/src/locale/messages-se.ts +1 -1
- package/src/locale/messages-sma.ts +1 -1
- package/src/model/ContentType.ts +2 -0
- package/es/Article/ArticleHeaderWrapper.js +0 -33
- package/es/CreatedBy/CreatedBy.js +0 -73
- package/es/CreatedBy/index.js +0 -10
- package/es/Hero/Hero.js +0 -68
- package/es/Hero/HeroContent.js +0 -16
- package/es/Hero/index.js +0 -10
- package/es/LanguageSelector/LanguageSelector.js +0 -87
- package/es/LanguageSelector/index.js +0 -10
- package/es/Logo/Logo.js +0 -52
- package/es/Logo/SvgLogo.js +0 -54
- package/es/Messages/MessageBanner.js +0 -72
- package/es/Search/ActiveFilterContent.js +0 -40
- package/es/Search/ActiveFilters.js +0 -112
- package/es/Search/ContentTypeResult.js +0 -151
- package/es/Search/ContentTypeResultStyles.js +0 -51
- package/es/Search/IsPathToHighlight.js +0 -12
- package/es/Search/LoadingWrapper.js +0 -31
- package/es/Search/SearchField.js +0 -110
- package/es/Search/SearchFieldForm.js +0 -33
- package/es/Search/SearchResult.js +0 -185
- package/es/Search/SearchResultSleeve.js +0 -229
- package/es/Search/index.js +0 -12
- package/lib/Article/ArticleHeaderWrapper.d.ts +0 -14
- package/lib/Article/ArticleHeaderWrapper.js +0 -40
- package/lib/CreatedBy/CreatedBy.d.ts +0 -15
- package/lib/CreatedBy/CreatedBy.js +0 -78
- package/lib/CreatedBy/index.d.ts +0 -9
- package/lib/CreatedBy/index.js +0 -16
- package/lib/Hero/Hero.d.ts +0 -25
- package/lib/Hero/Hero.js +0 -83
- package/lib/Hero/HeroContent.d.ts +0 -12
- package/lib/Hero/HeroContent.js +0 -23
- package/lib/Hero/index.d.ts +0 -10
- package/lib/Hero/index.js +0 -61
- package/lib/LanguageSelector/LanguageSelector.d.ts +0 -15
- package/lib/LanguageSelector/LanguageSelector.js +0 -92
- package/lib/LanguageSelector/index.d.ts +0 -9
- package/lib/LanguageSelector/index.js +0 -13
- package/lib/Logo/Logo.d.ts +0 -20
- package/lib/Logo/Logo.js +0 -58
- package/lib/Logo/SvgLogo.d.ts +0 -14
- package/lib/Logo/SvgLogo.js +0 -62
- package/lib/Logo/index.d.ts +0 -9
- package/lib/Logo/index.js +0 -16
- package/lib/Messages/MessageBanner.d.ts +0 -16
- package/lib/Messages/MessageBanner.js +0 -77
- package/lib/Search/ActiveFilterContent.d.ts +0 -23
- package/lib/Search/ActiveFilterContent.js +0 -47
- package/lib/Search/ActiveFilters.d.ts +0 -19
- package/lib/Search/ActiveFilters.js +0 -119
- package/lib/Search/ContentTypeResult.d.ts +0 -29
- package/lib/Search/ContentTypeResult.js +0 -159
- package/lib/Search/ContentTypeResultStyles.d.ts +0 -45
- package/lib/Search/ContentTypeResultStyles.js +0 -58
- package/lib/Search/IsPathToHighlight.d.ts +0 -8
- package/lib/Search/IsPathToHighlight.js +0 -19
- package/lib/Search/LoadingWrapper.d.ts +0 -12
- package/lib/Search/LoadingWrapper.js +0 -38
- package/lib/Search/SearchField.d.ts +0 -25
- package/lib/Search/SearchField.js +0 -117
- package/lib/Search/SearchFieldForm.d.ts +0 -15
- package/lib/Search/SearchFieldForm.js +0 -41
- package/lib/Search/SearchResult.d.ts +0 -43
- package/lib/Search/SearchResult.js +0 -194
- package/lib/Search/SearchResultSleeve.d.ts +0 -25
- package/lib/Search/SearchResultSleeve.js +0 -237
- package/lib/Search/index.d.ts +0 -11
- package/lib/Search/index.js +0 -33
- package/src/Article/ArticleHeaderWrapper.tsx +0 -38
- package/src/CreatedBy/CreatedBy.stories.tsx +0 -36
- package/src/CreatedBy/CreatedBy.tsx +0 -63
- package/src/CreatedBy/index.ts +0 -11
- package/src/Hero/Hero.stories.tsx +0 -35
- package/src/Hero/Hero.tsx +0 -129
- package/src/Hero/HeroContent.tsx +0 -43
- package/src/Hero/index.ts +0 -21
- package/src/LanguageSelector/LanguageSelector.stories.tsx +0 -44
- package/src/LanguageSelector/LanguageSelector.tsx +0 -101
- package/src/LanguageSelector/index.ts +0 -11
- package/src/Logo/Logo.stories.tsx +0 -47
- package/src/Logo/Logo.tsx +0 -47
- package/src/Logo/SvgLogo.tsx +0 -48
- package/src/Logo/index.ts +0 -11
- package/src/Messages/MessageBanner.stories.tsx +0 -31
- package/src/Messages/MessageBanner.tsx +0 -67
- package/src/Search/ActiveFilterContent.tsx +0 -64
- package/src/Search/ActiveFilters.tsx +0 -145
- package/src/Search/ContentTypeResult.tsx +0 -190
- package/src/Search/ContentTypeResultStyles.tsx +0 -172
- package/src/Search/IsPathToHighlight.ts +0 -12
- package/src/Search/LoadingWrapper.tsx +0 -44
- package/src/Search/SearchField.tsx +0 -175
- package/src/Search/SearchFieldForm.tsx +0 -64
- package/src/Search/SearchResult.tsx +0 -368
- package/src/Search/SearchResultSleeve.tsx +0 -367
- package/src/Search/__tests__/Highlight-test.ts +0 -66
- package/src/Search/index.ts +0 -14
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
import styled from "@emotion/styled";
|
|
10
|
-
import { spacing, spacingUnit, animations } from "@ndla/core";
|
|
11
|
-
import { Spinner } from "@ndla/icons";
|
|
12
|
-
|
|
13
|
-
const StyledWrapper = styled.div`
|
|
14
|
-
position: absolute;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
top: 0;
|
|
17
|
-
left: 0;
|
|
18
|
-
display: flex;
|
|
19
|
-
align-content: center;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
span {
|
|
23
|
-
opacity: 0;
|
|
24
|
-
}
|
|
25
|
-
> div {
|
|
26
|
-
${animations.fadeIn("1000ms")};
|
|
27
|
-
transform: translateX(${spacingUnit * 1.5}px) translateY(-${spacing.xsmall});
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
type Props = {
|
|
32
|
-
value: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const LoadingWrapper = ({ value }: Props) => (
|
|
36
|
-
<StyledWrapper>
|
|
37
|
-
<span>{value}</span>
|
|
38
|
-
<div>
|
|
39
|
-
<Spinner size="normal" />
|
|
40
|
-
</div>
|
|
41
|
-
</StyledWrapper>
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
export default LoadingWrapper;
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-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 { FocusEvent, MouseEvent, RefObject } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { ButtonV2, IconButtonV2 } from "@ndla/button";
|
|
13
|
-
import { colors, spacing, mq, breakpoints, misc, fonts } from "@ndla/core";
|
|
14
|
-
import { Search as SearchIcon } from "@ndla/icons/common";
|
|
15
|
-
|
|
16
|
-
import ActiveFilters from "./ActiveFilters";
|
|
17
|
-
import LoadingWrapper from "./LoadingWrapper";
|
|
18
|
-
|
|
19
|
-
const SearchButton = styled(IconButtonV2)`
|
|
20
|
-
position: absolute;
|
|
21
|
-
padding: ${spacing.small};
|
|
22
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
23
|
-
top: 5px;
|
|
24
|
-
right: 10px;
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
const CloseButton = styled(ButtonV2)`
|
|
29
|
-
position: absolute;
|
|
30
|
-
padding: ${spacing.small};
|
|
31
|
-
right: ${spacing.large};
|
|
32
|
-
color: ${colors.text.light};
|
|
33
|
-
text-transform: uppercase;
|
|
34
|
-
${fonts.sizes("14px", "16px")};
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
const InputWrapper = styled.div`
|
|
38
|
-
width: 100%;
|
|
39
|
-
padding: 0 ${spacing.large} 0 ${spacing.normal};
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
flex-flow: row-reverse;
|
|
43
|
-
border: 1px solid ${colors.brand.greyLight};
|
|
44
|
-
border-radius: ${misc.borderRadius};
|
|
45
|
-
|
|
46
|
-
&:active,
|
|
47
|
-
&:hover {
|
|
48
|
-
border: 1px solid ${colors.brand.primary};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
52
|
-
position: relative;
|
|
53
|
-
padding: 0;
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
|
|
57
|
-
const FiltersWrapper = styled.div`
|
|
58
|
-
display: flex;
|
|
59
|
-
height: ${spacing.large};
|
|
60
|
-
background: ${colors.white};
|
|
61
|
-
padding-left: ${spacing.small};
|
|
62
|
-
padding-right: 0;
|
|
63
|
-
border-right: 0;
|
|
64
|
-
flex-shrink: 0;
|
|
65
|
-
align-items: center;
|
|
66
|
-
${mq.range({ from: breakpoints.mobileWide, until: breakpoints.desktop })} {
|
|
67
|
-
padding-right: ${spacing.xsmall};
|
|
68
|
-
}
|
|
69
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
70
|
-
height: 58px;
|
|
71
|
-
padding-right: ${spacing.small};
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
const StyledInput = styled.input`
|
|
76
|
-
width: 100%;
|
|
77
|
-
height: ${spacing.large};
|
|
78
|
-
line-height: 28px;
|
|
79
|
-
margin: 2px;
|
|
80
|
-
border: 0px;
|
|
81
|
-
&[data-has-filters="true"] {
|
|
82
|
-
border-left: 0px;
|
|
83
|
-
}
|
|
84
|
-
padding-right: ${spacing.large};
|
|
85
|
-
padding-left: ${spacing.small};
|
|
86
|
-
flex-grow: 1;
|
|
87
|
-
outline: 0;
|
|
88
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
89
|
-
height: 58px;
|
|
90
|
-
line-height: 58px;
|
|
91
|
-
${fonts.sizes("18px", "24px")};
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
|
-
interface Props {
|
|
96
|
-
value: string;
|
|
97
|
-
placeholder: string;
|
|
98
|
-
onChange: (value: string) => void;
|
|
99
|
-
filters?: { value: string; title: string }[];
|
|
100
|
-
onFilterRemove?: (value: string, filterName?: string) => void;
|
|
101
|
-
onFocus?: (event?: FocusEvent<HTMLInputElement>) => void;
|
|
102
|
-
onBlur?: () => void;
|
|
103
|
-
onClick?: (event: MouseEvent<HTMLInputElement>) => void;
|
|
104
|
-
loading?: boolean;
|
|
105
|
-
inputRef?: RefObject<HTMLInputElement>;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const SearchField = ({
|
|
109
|
-
placeholder,
|
|
110
|
-
value,
|
|
111
|
-
onChange,
|
|
112
|
-
filters,
|
|
113
|
-
onClick,
|
|
114
|
-
onFocus,
|
|
115
|
-
onBlur,
|
|
116
|
-
loading,
|
|
117
|
-
onFilterRemove,
|
|
118
|
-
inputRef,
|
|
119
|
-
}: Props) => {
|
|
120
|
-
const { t } = useTranslation();
|
|
121
|
-
const handleOnFilterRemove = (value: string, filterName?: string) => {
|
|
122
|
-
onFilterRemove?.(value, filterName);
|
|
123
|
-
inputRef?.current?.focus();
|
|
124
|
-
onFocus?.();
|
|
125
|
-
};
|
|
126
|
-
return (
|
|
127
|
-
<InputWrapper>
|
|
128
|
-
{loading && <LoadingWrapper value={value} />}
|
|
129
|
-
<StyledInput
|
|
130
|
-
data-has-filters={!!filters?.length}
|
|
131
|
-
ref={inputRef}
|
|
132
|
-
type="search"
|
|
133
|
-
aria-autocomplete="list"
|
|
134
|
-
autoComplete="off"
|
|
135
|
-
id="search"
|
|
136
|
-
name="search"
|
|
137
|
-
placeholder={placeholder}
|
|
138
|
-
aria-label={placeholder}
|
|
139
|
-
value={value}
|
|
140
|
-
onChange={(e) => onChange(e.target.value)}
|
|
141
|
-
onBlur={onBlur}
|
|
142
|
-
onFocus={onFocus}
|
|
143
|
-
onClick={onClick}
|
|
144
|
-
/>
|
|
145
|
-
{filters && filters.length > 0 && (
|
|
146
|
-
<FiltersWrapper>
|
|
147
|
-
<ActiveFilters filters={filters} onFilterRemove={handleOnFilterRemove} />
|
|
148
|
-
</FiltersWrapper>
|
|
149
|
-
)}
|
|
150
|
-
{value !== "" && (
|
|
151
|
-
<CloseButton
|
|
152
|
-
variant="stripped"
|
|
153
|
-
onClick={() => {
|
|
154
|
-
onChange("");
|
|
155
|
-
onFocus?.();
|
|
156
|
-
inputRef?.current?.focus();
|
|
157
|
-
}}
|
|
158
|
-
>
|
|
159
|
-
{t("welcomePage.resetSearch")}
|
|
160
|
-
</CloseButton>
|
|
161
|
-
)}
|
|
162
|
-
<SearchButton
|
|
163
|
-
variant="stripped"
|
|
164
|
-
type="submit"
|
|
165
|
-
value="Search"
|
|
166
|
-
aria-label={t("siteNav.search")}
|
|
167
|
-
title={t("siteNav.search")}
|
|
168
|
-
>
|
|
169
|
-
<SearchIcon />
|
|
170
|
-
</SearchButton>
|
|
171
|
-
</InputWrapper>
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export default SearchField;
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
import { FormEvent, ReactNode } from "react";
|
|
10
|
-
import { css } from "@emotion/react";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { breakpoints, mq, spacing, stackOrder } from "@ndla/core";
|
|
13
|
-
|
|
14
|
-
interface Props {
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
inputHasFocus?: boolean;
|
|
17
|
-
onSubmit?: (event: FormEvent) => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
type StyledProps = {
|
|
21
|
-
inputHasFocus?: boolean;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const hasFocusStyles = css`
|
|
25
|
-
display: flex;
|
|
26
|
-
align-self: flex-start;
|
|
27
|
-
align-items: center;
|
|
28
|
-
z-index: ${stackOrder.modal};
|
|
29
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
30
|
-
position: fixed;
|
|
31
|
-
display: block;
|
|
32
|
-
top: 0;
|
|
33
|
-
left: 0;
|
|
34
|
-
right: 0;
|
|
35
|
-
padding: ${spacing.small};
|
|
36
|
-
z-index: ${stackOrder.modal};
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
const StyledForm = styled.form<StyledProps>`
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
text-align: left;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
justify-content: center;
|
|
46
|
-
width: 100%;
|
|
47
|
-
position: relative;
|
|
48
|
-
> div {
|
|
49
|
-
padding: 0;
|
|
50
|
-
}
|
|
51
|
-
${(props) =>
|
|
52
|
-
props.inputHasFocus &&
|
|
53
|
-
css`
|
|
54
|
-
${hasFocusStyles}
|
|
55
|
-
`}
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
export const SearchFieldForm = ({ children, inputHasFocus, onSubmit }: Props) => {
|
|
59
|
-
return (
|
|
60
|
-
<StyledForm role="search" action="/search/" inputHasFocus={inputHasFocus} onSubmit={onSubmit}>
|
|
61
|
-
{children}
|
|
62
|
-
</StyledForm>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2022-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 { ElementType, Fragment, ReactNode } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { fonts, mq, spacing, breakpoints, colors, spacingUnit, misc } from "@ndla/core";
|
|
13
|
-
import { Spinner } from "@ndla/icons";
|
|
14
|
-
import { ChevronRight } from "@ndla/icons/common";
|
|
15
|
-
import { SafeLink } from "@ndla/safelink";
|
|
16
|
-
import { Tooltip } from "@ndla/tooltip";
|
|
17
|
-
import { uuid } from "@ndla/util";
|
|
18
|
-
|
|
19
|
-
interface ItemType {
|
|
20
|
-
id: string | number;
|
|
21
|
-
title?: string;
|
|
22
|
-
url?: string | { href: string };
|
|
23
|
-
breadcrumb?: string[];
|
|
24
|
-
subjects?: {
|
|
25
|
-
title: string;
|
|
26
|
-
url?: string | { href: string };
|
|
27
|
-
breadcrumb?: string[];
|
|
28
|
-
}[];
|
|
29
|
-
additional?: boolean;
|
|
30
|
-
image?: ReactNode;
|
|
31
|
-
ingress: string;
|
|
32
|
-
contentTypeIcon?: string;
|
|
33
|
-
contentTypeLabel?: string;
|
|
34
|
-
children?: ReactNode;
|
|
35
|
-
type?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface SearchResultItemProps {
|
|
39
|
-
children?: ReactNode;
|
|
40
|
-
subjectsLabel: string;
|
|
41
|
-
additionalContentTooltip: string;
|
|
42
|
-
item: ItemType;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const StyledHeader = styled.header`
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-wrap: wrap;
|
|
48
|
-
align-items: center;
|
|
49
|
-
|
|
50
|
-
> * {
|
|
51
|
-
margin: 0 ${spacing.small} ${spacing.small} 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
55
|
-
h1 {
|
|
56
|
-
width: 100%;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
const ContentTypeWrapper = styled.div`
|
|
62
|
-
margin: 0 ${spacing.small} ${spacing.small} 0;
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
const PillsWrapper = styled.div`
|
|
68
|
-
background: ${colors.brand.greyLightest};
|
|
69
|
-
margin-right: ${spacing.small};
|
|
70
|
-
padding: 0 ${spacingUnit / 3}px;
|
|
71
|
-
border-radius: ${misc.borderRadiusLarge};
|
|
72
|
-
${fonts.sizes("12px", "20px")};
|
|
73
|
-
font-weight: ${fonts.weight.semibold};
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
const StyledContent = styled.div`
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: flex-start;
|
|
79
|
-
justify-content: space-between;
|
|
80
|
-
& > img,
|
|
81
|
-
& > picture > img {
|
|
82
|
-
width: 75px;
|
|
83
|
-
height: auto;
|
|
84
|
-
flex-shrink: 0;
|
|
85
|
-
margin: 0 0 ${spacing.small} ${spacing.small};
|
|
86
|
-
|
|
87
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
88
|
-
width: 80px;
|
|
89
|
-
margin-left: ${spacing.normal};
|
|
90
|
-
margin-right: ${spacing.small};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
|
-
const StyledIngress = styled.p`
|
|
96
|
-
margin: 0 0 ${spacing.normal} 0;
|
|
97
|
-
width: 100%;
|
|
98
|
-
flex-grow: 1;
|
|
99
|
-
${fonts.sizes("14px", "22px")};
|
|
100
|
-
|
|
101
|
-
${mq.range({ from: breakpoints.tablet })} {
|
|
102
|
-
${fonts.sizes("16px", "24px")};
|
|
103
|
-
max-width: 550px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
107
|
-
${fonts.sizes("18px", "26px")};
|
|
108
|
-
max-width: 600px;
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
const StyledSubjects = styled.div`
|
|
113
|
-
display: flex;
|
|
114
|
-
align-items: center;
|
|
115
|
-
flex-wrap: wrap;
|
|
116
|
-
margin-bottom: ${spacing.normal};
|
|
117
|
-
${fonts.sizes("14px", "16px")};
|
|
118
|
-
|
|
119
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
120
|
-
${fonts.sizes("16px", "18px")};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
& > span {
|
|
124
|
-
text-transform: uppercase;
|
|
125
|
-
color: ${colors.text.light};
|
|
126
|
-
padding-right: ${spacing.small};
|
|
127
|
-
${fonts.sizes("14px", "16px")};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
ul {
|
|
131
|
-
display: flex;
|
|
132
|
-
align-items: center;
|
|
133
|
-
flex-wrap: wrap;
|
|
134
|
-
list-style: none;
|
|
135
|
-
margin: 0;
|
|
136
|
-
padding: 0;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
li {
|
|
140
|
-
padding: 0;
|
|
141
|
-
position: relative;
|
|
142
|
-
line-height: 1rem;
|
|
143
|
-
|
|
144
|
-
padding: 0 ${spacing.xsmall} 0 0;
|
|
145
|
-
margin-right: ${spacing.xsmall};
|
|
146
|
-
|
|
147
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
148
|
-
padding: 0 ${spacing.small} 0 0;
|
|
149
|
-
margin-right: ${spacing.small};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&::after {
|
|
153
|
-
content: "";
|
|
154
|
-
width: 1px;
|
|
155
|
-
height: 15px;
|
|
156
|
-
background: ${colors.brand.greyLight};
|
|
157
|
-
display: block;
|
|
158
|
-
position: absolute;
|
|
159
|
-
right: 0;
|
|
160
|
-
top: 3px;
|
|
161
|
-
}
|
|
162
|
-
&:first-child {
|
|
163
|
-
font-weight: 600;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&:last-child {
|
|
167
|
-
&:after {
|
|
168
|
-
display: none;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
margin-right: 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
`;
|
|
175
|
-
|
|
176
|
-
const StyledSearchResultItem = styled.li`
|
|
177
|
-
border-bottom: 1px solid ${colors.brand.greyLight};
|
|
178
|
-
padding: 0 ${spacing.normal} 0 ${spacing.normal};
|
|
179
|
-
|
|
180
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
181
|
-
padding: 0;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
margin: 0 0 ${spacing.normal};
|
|
185
|
-
|
|
186
|
-
&:first-child {
|
|
187
|
-
margin-top: ${spacing.normal};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
&:last-child {
|
|
191
|
-
border-bottom: 0;
|
|
192
|
-
margin-bottom: 0;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
h1 {
|
|
196
|
-
font-weight: 600;
|
|
197
|
-
${fonts.sizes("16px", "20px")};
|
|
198
|
-
|
|
199
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
200
|
-
${fonts.sizes("22px", "28px")};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
a {
|
|
204
|
-
color: ${colors.brand.dark};
|
|
205
|
-
|
|
206
|
-
&:hover,
|
|
207
|
-
&:focus,
|
|
208
|
-
&:active {
|
|
209
|
-
color: ${colors.brand.dark};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
`;
|
|
214
|
-
|
|
215
|
-
const StyledBreadcrumb = styled.div`
|
|
216
|
-
list-style: none;
|
|
217
|
-
display: flex;
|
|
218
|
-
align-items: center;
|
|
219
|
-
flex-wrap: wrap;
|
|
220
|
-
color: ${colors.text.light};
|
|
221
|
-
margin-bottom: ${spacing.normal};
|
|
222
|
-
${fonts.sizes("14px", "18px")};
|
|
223
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
224
|
-
${fonts.sizes("16px", "24px")};
|
|
225
|
-
}
|
|
226
|
-
[data-icon] {
|
|
227
|
-
width: ${spacing.small};
|
|
228
|
-
height: ${spacing.small};
|
|
229
|
-
margin: 0 ${spacingUnit / 3}px;
|
|
230
|
-
|
|
231
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
232
|
-
margin: 0 ${spacing.xsmall};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
`;
|
|
236
|
-
|
|
237
|
-
export const SearchResultItem = ({
|
|
238
|
-
item,
|
|
239
|
-
subjectsLabel,
|
|
240
|
-
additionalContentTooltip,
|
|
241
|
-
children,
|
|
242
|
-
}: SearchResultItemProps) => {
|
|
243
|
-
const itemBreadcrumb = (breadcrumbs: string[] = [], itemBreadcrumb?: boolean) => {
|
|
244
|
-
const Breadcrumb: ElementType = itemBreadcrumb ? StyledBreadcrumb : "div";
|
|
245
|
-
if (breadcrumbs.length > 0) {
|
|
246
|
-
return (
|
|
247
|
-
<Breadcrumb>
|
|
248
|
-
{breadcrumbs.map((breadcrumbItem, index) => {
|
|
249
|
-
let icon = null;
|
|
250
|
-
if (index !== (item.breadcrumb?.length || 0) - 1) {
|
|
251
|
-
icon = <ChevronRight />;
|
|
252
|
-
}
|
|
253
|
-
return (
|
|
254
|
-
<Fragment key={uuid()}>
|
|
255
|
-
<span>{breadcrumbItem}</span>
|
|
256
|
-
{icon}
|
|
257
|
-
</Fragment>
|
|
258
|
-
);
|
|
259
|
-
})}
|
|
260
|
-
</Breadcrumb>
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
return (
|
|
265
|
-
<StyledSearchResultItem key={item.id}>
|
|
266
|
-
<article>
|
|
267
|
-
<StyledHeader>
|
|
268
|
-
<h1>
|
|
269
|
-
{item.url && typeof item.url !== "string" ? (
|
|
270
|
-
<a {...item.url}>{item.title}</a>
|
|
271
|
-
) : (
|
|
272
|
-
<SafeLink to={item.url ?? ""}>{item.title}</SafeLink>
|
|
273
|
-
)}
|
|
274
|
-
</h1>
|
|
275
|
-
<ContentTypeWrapper>{item.contentTypeIcon}</ContentTypeWrapper>
|
|
276
|
-
{item.contentTypeLabel && <PillsWrapper>{item.contentTypeLabel}</PillsWrapper>}
|
|
277
|
-
{item.type && <PillsWrapper>{item.type}</PillsWrapper>}
|
|
278
|
-
{item.additional && <PillsWrapper>{additionalContentTooltip}</PillsWrapper>}
|
|
279
|
-
{children}
|
|
280
|
-
</StyledHeader>
|
|
281
|
-
<StyledContent>
|
|
282
|
-
<StyledIngress dangerouslySetInnerHTML={{ __html: item.ingress }} />
|
|
283
|
-
{item.image}
|
|
284
|
-
</StyledContent>
|
|
285
|
-
{(!item.subjects || item.subjects.length === 0) && itemBreadcrumb(item.breadcrumb, true)}
|
|
286
|
-
{item.subjects && item.subjects.length !== 0 && (
|
|
287
|
-
<StyledSubjects>
|
|
288
|
-
<span>{subjectsLabel}</span>
|
|
289
|
-
<ul>
|
|
290
|
-
{item.subjects.map((subject) => (
|
|
291
|
-
<li key={uuid()}>
|
|
292
|
-
<Tooltip tooltip={itemBreadcrumb(subject.breadcrumb)}>
|
|
293
|
-
{subject.url && typeof subject.url !== "string" ? (
|
|
294
|
-
<a {...subject.url}>{subject.title}</a>
|
|
295
|
-
) : (
|
|
296
|
-
<SafeLink to={subject.url ?? ""}>{subject.title}</SafeLink>
|
|
297
|
-
)}
|
|
298
|
-
</Tooltip>
|
|
299
|
-
</li>
|
|
300
|
-
))}
|
|
301
|
-
</ul>
|
|
302
|
-
</StyledSubjects>
|
|
303
|
-
)}
|
|
304
|
-
</article>
|
|
305
|
-
</StyledSearchResultItem>
|
|
306
|
-
);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
interface SearchResultListProps {
|
|
310
|
-
loading?: boolean;
|
|
311
|
-
results?: ItemType[];
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const EmptyResultList = styled.article`
|
|
315
|
-
margin-top: ${spacing.large};
|
|
316
|
-
h1 {
|
|
317
|
-
${fonts.sizes("22px", "32px")};
|
|
318
|
-
font-weight: ${fonts.weight.bold};
|
|
319
|
-
margin: 0 0 ${spacing.small};
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
p {
|
|
323
|
-
${fonts.sizes("16px", "22px")};
|
|
324
|
-
margin: 0;
|
|
325
|
-
font-family: ${fonts.serif};
|
|
326
|
-
|
|
327
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
328
|
-
${fonts.sizes("18px", "32px")};
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
`;
|
|
332
|
-
|
|
333
|
-
const ResultList = styled.ul`
|
|
334
|
-
list-style: none;
|
|
335
|
-
padding: 0;
|
|
336
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
337
|
-
padding: ${spacing.medium} 0 0 0;
|
|
338
|
-
}
|
|
339
|
-
`;
|
|
340
|
-
|
|
341
|
-
export const SearchResultList = ({ results, loading }: SearchResultListProps) => {
|
|
342
|
-
const { t } = useTranslation();
|
|
343
|
-
if (loading) {
|
|
344
|
-
return <Spinner />;
|
|
345
|
-
}
|
|
346
|
-
if (!results) {
|
|
347
|
-
return <EmptyResultList />;
|
|
348
|
-
}
|
|
349
|
-
return results.length === 0 ? (
|
|
350
|
-
<EmptyResultList>
|
|
351
|
-
<h1>{t("searchPage.searchResultListMessages.noResultHeading")}</h1>
|
|
352
|
-
<p>{t("searchPage.searchResultListMessages.noResultDescription")}</p>
|
|
353
|
-
</EmptyResultList>
|
|
354
|
-
) : (
|
|
355
|
-
<ResultList>
|
|
356
|
-
{results.map((item) => (
|
|
357
|
-
<SearchResultItem
|
|
358
|
-
key={`search_result_item_${typeof item.url === "object" ? item.url.href : item.url}`}
|
|
359
|
-
item={item}
|
|
360
|
-
additionalContentTooltip={t("resource.tooltipAdditionalTopic")}
|
|
361
|
-
subjectsLabel={t("searchPage.searchResultListMessages.subjectsLabel")}
|
|
362
|
-
>
|
|
363
|
-
{item.children}
|
|
364
|
-
</SearchResultItem>
|
|
365
|
-
))}
|
|
366
|
-
</ResultList>
|
|
367
|
-
);
|
|
368
|
-
};
|