@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
package/src/Logo/index.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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 { useTranslation } from "react-i18next";
|
|
10
|
-
import { Meta, StoryFn } from "@storybook/react";
|
|
11
|
-
import MessageBanner from "./MessageBanner";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Brukes i toppen av nettleseren når noe trenger mye oppmerksomhet globalt i systemet.
|
|
15
|
-
*/
|
|
16
|
-
export default {
|
|
17
|
-
title: "Patterns/MessageBanner",
|
|
18
|
-
component: MessageBanner,
|
|
19
|
-
tags: ["autodocs"],
|
|
20
|
-
parameters: {
|
|
21
|
-
inlineStories: true,
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
showCloseButton: true,
|
|
25
|
-
},
|
|
26
|
-
} as Meta<typeof MessageBanner>;
|
|
27
|
-
|
|
28
|
-
export const Default: StoryFn<typeof MessageBanner> = ({ ...args }) => {
|
|
29
|
-
const { t } = useTranslation();
|
|
30
|
-
return <MessageBanner {...args}>{t("messageBoxInfo.updateBrowser")}</MessageBanner>;
|
|
31
|
-
};
|
|
@@ -1,67 +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 { ReactNode } from "react";
|
|
10
|
-
import { useTranslation } from "react-i18next";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { IconButtonV2 } from "@ndla/button";
|
|
13
|
-
import { colors, spacing } from "@ndla/core";
|
|
14
|
-
import { Cross } from "@ndla/icons/action";
|
|
15
|
-
|
|
16
|
-
interface WrapperProps {
|
|
17
|
-
small?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const MessageBannerWrapper = styled.div<WrapperProps>`
|
|
21
|
-
display: grid;
|
|
22
|
-
grid-template-areas: ". content closebutton";
|
|
23
|
-
grid-template-columns: minmax(30px, 1fr) minmax(0, auto) minmax(30px, 1fr);
|
|
24
|
-
padding: ${({ small }) => (small ? spacing.xxsmall : spacing.small)};
|
|
25
|
-
background: ${colors.support.yellowLight};
|
|
26
|
-
color: ${colors.brand.greyDark};
|
|
27
|
-
border-bottom: solid 1px ${colors.white};
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
const TextWrapper = styled.div`
|
|
31
|
-
display: flex;
|
|
32
|
-
grid-area: content;
|
|
33
|
-
align-items: center;
|
|
34
|
-
& p {
|
|
35
|
-
margin: 0;
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
const StyledClosebutton = styled(IconButtonV2)`
|
|
40
|
-
grid-area: closebutton;
|
|
41
|
-
padding: 0;
|
|
42
|
-
justify-self: flex-end;
|
|
43
|
-
align-self: flex-start;
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
interface Props {
|
|
47
|
-
small?: boolean;
|
|
48
|
-
children?: ReactNode;
|
|
49
|
-
showCloseButton?: boolean;
|
|
50
|
-
onClose?: () => void;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const MessageBanner = ({ children, onClose, showCloseButton, small }: Props) => {
|
|
54
|
-
const { t } = useTranslation();
|
|
55
|
-
return (
|
|
56
|
-
<MessageBannerWrapper small={small}>
|
|
57
|
-
<TextWrapper>{children}</TextWrapper>
|
|
58
|
-
{showCloseButton && (
|
|
59
|
-
<StyledClosebutton onClick={onClose} variant="ghost" aria-label={t("close")} title={t("close")}>
|
|
60
|
-
<Cross />
|
|
61
|
-
</StyledClosebutton>
|
|
62
|
-
)}
|
|
63
|
-
</MessageBannerWrapper>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default MessageBanner;
|
|
@@ -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 { forwardRef } from "react";
|
|
10
|
-
import styled from "@emotion/styled";
|
|
11
|
-
import { spacing, mq, breakpoints, colors, misc, fonts } from "@ndla/core";
|
|
12
|
-
import { Cross } from "@ndla/icons/action";
|
|
13
|
-
|
|
14
|
-
const StyledActiveFilter = styled("button")`
|
|
15
|
-
height: 38px;
|
|
16
|
-
border: 0;
|
|
17
|
-
background: ${colors.brand.light};
|
|
18
|
-
color: ${colors.brand.dark};
|
|
19
|
-
border-radius: ${misc.borderRadius};
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
padding: 0 ${spacing.small};
|
|
24
|
-
width: 100%;
|
|
25
|
-
justify-content: space-between;
|
|
26
|
-
${fonts.sizes("16px", "36px")};
|
|
27
|
-
font-weight: ${fonts.weight.semibold};
|
|
28
|
-
|
|
29
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
30
|
-
width: auto;
|
|
31
|
-
justify-content: flex-start;
|
|
32
|
-
${fonts.sizes("18px", "40px")};
|
|
33
|
-
height: 40px;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
export const StyledActiveFilterTitle = styled("span")`
|
|
38
|
-
white-space: nowrap;
|
|
39
|
-
padding-right: ${spacing.small};
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
interface Props {
|
|
43
|
-
filter: {
|
|
44
|
-
value: string;
|
|
45
|
-
title: string;
|
|
46
|
-
filterName?: string;
|
|
47
|
-
};
|
|
48
|
-
onFilterRemove: (value: string, filterName?: string) => void;
|
|
49
|
-
ariaLabel: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const ActiveFilterContent = forwardRef<HTMLButtonElement, Props>(({ filter, onFilterRemove, ariaLabel }, ref) => (
|
|
53
|
-
<StyledActiveFilter
|
|
54
|
-
aria-label={ariaLabel}
|
|
55
|
-
type="button"
|
|
56
|
-
ref={ref}
|
|
57
|
-
onClick={() => onFilterRemove(filter.value, filter.filterName)}
|
|
58
|
-
>
|
|
59
|
-
<StyledActiveFilterTitle>{filter.title}</StyledActiveFilterTitle>
|
|
60
|
-
<Cross />
|
|
61
|
-
</StyledActiveFilter>
|
|
62
|
-
));
|
|
63
|
-
|
|
64
|
-
export default ActiveFilterContent;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2018-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 { useTranslation } from "react-i18next";
|
|
10
|
-
import { css } from "@emotion/react";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { spacing, mq, breakpoints } from "@ndla/core";
|
|
13
|
-
import { Tooltip } from "@ndla/tooltip";
|
|
14
|
-
import ActiveFilterContent, { StyledActiveFilterTitle } from "./ActiveFilterContent";
|
|
15
|
-
|
|
16
|
-
interface StyledActiveFiltersProps {
|
|
17
|
-
showOnSmallScreen?: boolean;
|
|
18
|
-
filterLength?: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const StyledActiveFilters = styled("ul")<StyledActiveFiltersProps>`
|
|
22
|
-
margin: 0;
|
|
23
|
-
padding: 0;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
align-items: stretch;
|
|
26
|
-
flex-wrap: wrap;
|
|
27
|
-
display: none;
|
|
28
|
-
|
|
29
|
-
${({ showOnSmallScreen }) =>
|
|
30
|
-
showOnSmallScreen &&
|
|
31
|
-
css`
|
|
32
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
33
|
-
display: flex;
|
|
34
|
-
}
|
|
35
|
-
`}
|
|
36
|
-
|
|
37
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: row;
|
|
40
|
-
align-items: center;
|
|
41
|
-
|
|
42
|
-
${StyledActiveFilterTitle} {
|
|
43
|
-
${({ filterLength }) =>
|
|
44
|
-
filterLength &&
|
|
45
|
-
filterLength >= 2 &&
|
|
46
|
-
css`
|
|
47
|
-
text-overflow: ellipsis;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
padding-right: ${spacing.small};
|
|
50
|
-
display: block;
|
|
51
|
-
`}
|
|
52
|
-
|
|
53
|
-
${({ filterLength }) =>
|
|
54
|
-
filterLength &&
|
|
55
|
-
filterLength === 2 &&
|
|
56
|
-
css`
|
|
57
|
-
max-width: 90px;
|
|
58
|
-
`}
|
|
59
|
-
|
|
60
|
-
${({ filterLength }) =>
|
|
61
|
-
filterLength &&
|
|
62
|
-
filterLength > 2 &&
|
|
63
|
-
css`
|
|
64
|
-
max-width: 70px;
|
|
65
|
-
`}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
|
|
70
|
-
const StyledActiveFilterWrapper = styled("li")`
|
|
71
|
-
list-style: none;
|
|
72
|
-
display: flex;
|
|
73
|
-
|
|
74
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
75
|
-
padding: 0 ${spacing.small} 0 0;
|
|
76
|
-
|
|
77
|
-
&:last-of-type {
|
|
78
|
-
padding-right: 0;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
const getFilterLength = (filters: Filter[]) =>
|
|
84
|
-
filters.filter((filter) => filter.filterName === "filter_subjects" && filter.title).length;
|
|
85
|
-
|
|
86
|
-
interface Filter {
|
|
87
|
-
title: string;
|
|
88
|
-
value: string;
|
|
89
|
-
filterName?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
interface Props {
|
|
93
|
-
filters: Filter[];
|
|
94
|
-
onFilterRemove: (value: string, filterName?: string) => void;
|
|
95
|
-
showOnSmallScreen?: boolean;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const ActiveFilters = ({ filters, onFilterRemove, showOnSmallScreen }: Props) => {
|
|
99
|
-
const { t } = useTranslation();
|
|
100
|
-
if (filters && filters.length > 0) {
|
|
101
|
-
const filterLength = getFilterLength(filters);
|
|
102
|
-
|
|
103
|
-
const filterItems = filters.map((filter) => {
|
|
104
|
-
const filterKey = filter.filterName ? `${filter.filterName}${filter.value}` : filter.value;
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<StyledActiveFilterWrapper key={filterKey}>
|
|
108
|
-
{filterLength > 1 ? (
|
|
109
|
-
<Tooltip
|
|
110
|
-
tooltip={t("searchPage.searchFilterMessages.removeFilter", {
|
|
111
|
-
filterName: filter.title,
|
|
112
|
-
})}
|
|
113
|
-
>
|
|
114
|
-
<ActiveFilterContent
|
|
115
|
-
filter={filter}
|
|
116
|
-
ariaLabel={t("searchPage.searchFilterMessages.removeFilter", {
|
|
117
|
-
filterName: filter.title,
|
|
118
|
-
})}
|
|
119
|
-
onFilterRemove={onFilterRemove}
|
|
120
|
-
/>
|
|
121
|
-
</Tooltip>
|
|
122
|
-
) : (
|
|
123
|
-
<ActiveFilterContent
|
|
124
|
-
filter={filter}
|
|
125
|
-
onFilterRemove={onFilterRemove}
|
|
126
|
-
ariaLabel={t("searchPage.searchFilterMessages.removeFilter", {
|
|
127
|
-
filterName: filter.title,
|
|
128
|
-
})}
|
|
129
|
-
/>
|
|
130
|
-
)}
|
|
131
|
-
</StyledActiveFilterWrapper>
|
|
132
|
-
);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<StyledActiveFilters showOnSmallScreen={showOnSmallScreen} filterLength={filterLength}>
|
|
137
|
-
{filterItems}
|
|
138
|
-
</StyledActiveFilters>
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return null;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export default ActiveFilters;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2018-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
|
-
/** @jsxImportSource @emotion/react */
|
|
10
|
-
import { ReactElement, useEffect, useRef, useState } from "react";
|
|
11
|
-
import { useTranslation } from "react-i18next";
|
|
12
|
-
import styled from "@emotion/styled";
|
|
13
|
-
import { ButtonV2 } from "@ndla/button";
|
|
14
|
-
import { Additional, ChevronDown, ChevronUp } from "@ndla/icons/common";
|
|
15
|
-
import { SafeLink } from "@ndla/safelink";
|
|
16
|
-
import { Tooltip } from "@ndla/tooltip";
|
|
17
|
-
import {
|
|
18
|
-
highlightStyle,
|
|
19
|
-
noWidthhighlightStyle,
|
|
20
|
-
showAllButtonStyle,
|
|
21
|
-
StyledHeader,
|
|
22
|
-
StyledList,
|
|
23
|
-
StyledListItem,
|
|
24
|
-
StyledNoHit,
|
|
25
|
-
StyledTag,
|
|
26
|
-
StyledWrapper,
|
|
27
|
-
} from "./ContentTypeResultStyles";
|
|
28
|
-
import { isPathToHighlight } from "./IsPathToHighlight";
|
|
29
|
-
import ContentTypeBadge from "../ContentTypeBadge";
|
|
30
|
-
import { ContentTypeResultType, Resource } from "../types";
|
|
31
|
-
|
|
32
|
-
const renderAdditionalIcon = (label: string, isAdditional?: boolean): ReactElement | null => {
|
|
33
|
-
if (isAdditional && label) {
|
|
34
|
-
return (
|
|
35
|
-
<Tooltip tooltip={label}>
|
|
36
|
-
<div>
|
|
37
|
-
<Additional size="medium" aria-hidden={false} />
|
|
38
|
-
</div>
|
|
39
|
-
</Tooltip>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
if (isAdditional) {
|
|
43
|
-
return <Additional size="medium" />;
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type Props = {
|
|
49
|
-
contentTypeResult: ContentTypeResultType;
|
|
50
|
-
onNavigate?: VoidFunction;
|
|
51
|
-
defaultCount?: number;
|
|
52
|
-
resourceToLinkProps: (resource: Resource) => {
|
|
53
|
-
to: string;
|
|
54
|
-
};
|
|
55
|
-
showAdditionalResources?: boolean;
|
|
56
|
-
messages: {
|
|
57
|
-
allResultLabel?: string;
|
|
58
|
-
showLessResultLabel?: string;
|
|
59
|
-
noHit: string;
|
|
60
|
-
};
|
|
61
|
-
ignoreContentTypeBadge?: boolean;
|
|
62
|
-
keyboardPathNavigation?: HTMLElement | string | null;
|
|
63
|
-
inMenu?: boolean;
|
|
64
|
-
animateList?: number;
|
|
65
|
-
unGrouped?: boolean;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const StyledSafeLink = styled(SafeLink)`
|
|
69
|
-
&[data-highlighted="true"] {
|
|
70
|
-
${highlightStyle}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
const ContentTypeResult = ({
|
|
75
|
-
contentTypeResult,
|
|
76
|
-
onNavigate,
|
|
77
|
-
defaultCount,
|
|
78
|
-
resourceToLinkProps,
|
|
79
|
-
showAdditionalResources,
|
|
80
|
-
messages,
|
|
81
|
-
ignoreContentTypeBadge,
|
|
82
|
-
keyboardPathNavigation,
|
|
83
|
-
inMenu,
|
|
84
|
-
animateList,
|
|
85
|
-
unGrouped,
|
|
86
|
-
}: Props) => {
|
|
87
|
-
const { t } = useTranslation();
|
|
88
|
-
const [showAll, toggleShowAll] = useState(false);
|
|
89
|
-
const showAllRef = useRef<HTMLLIElement>(null);
|
|
90
|
-
|
|
91
|
-
const results =
|
|
92
|
-
showAdditionalResources || !contentTypeResult.resources
|
|
93
|
-
? contentTypeResult.resources
|
|
94
|
-
: contentTypeResult.resources.filter((items) => !items.additional);
|
|
95
|
-
|
|
96
|
-
const resources = showAll || !defaultCount ? results : results.slice(0, defaultCount);
|
|
97
|
-
|
|
98
|
-
const displayShowAllButton = defaultCount && results.length > defaultCount;
|
|
99
|
-
const shouldHighlightShowAllButton = showAllRef.current === keyboardPathNavigation;
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (showAll && showAllRef.current) {
|
|
103
|
-
showAllRef.current.scrollIntoView({
|
|
104
|
-
behavior: "smooth",
|
|
105
|
-
block: "nearest",
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}, [showAll]);
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<StyledWrapper>
|
|
112
|
-
{!unGrouped && (
|
|
113
|
-
<StyledHeader>
|
|
114
|
-
{!ignoreContentTypeBadge && contentTypeResult.contentType && (
|
|
115
|
-
<ContentTypeBadge type={contentTypeResult.contentType} size="x-small" background border />
|
|
116
|
-
)}
|
|
117
|
-
<h1>
|
|
118
|
-
{contentTypeResult.title} <small>({results.length})</small>
|
|
119
|
-
</h1>
|
|
120
|
-
</StyledHeader>
|
|
121
|
-
)}
|
|
122
|
-
{resources.length > 0 ? (
|
|
123
|
-
<StyledList inMenu={inMenu} animateList={animateList} unGrouped={unGrouped}>
|
|
124
|
-
{resources.map((resource) => {
|
|
125
|
-
const { path, name, resourceTypes, subject, additional } = resource;
|
|
126
|
-
|
|
127
|
-
const linkProps = resourceToLinkProps(resource);
|
|
128
|
-
const linkContent = (
|
|
129
|
-
<>
|
|
130
|
-
<strong>{name}</strong>
|
|
131
|
-
{!inMenu && subject && <small>{subject}</small>}
|
|
132
|
-
{!inMenu &&
|
|
133
|
-
resourceTypes &&
|
|
134
|
-
resourceTypes.map((type) => <StyledTag key={type.name}>{type.name}</StyledTag>)}
|
|
135
|
-
</>
|
|
136
|
-
);
|
|
137
|
-
const delayAnimation = !!animateList && !!additional && animateList > 0 && !!showAdditionalResources;
|
|
138
|
-
|
|
139
|
-
// Figure out highlighting by comparing path of link with keyboard navigated anchor
|
|
140
|
-
const anchor =
|
|
141
|
-
keyboardPathNavigation instanceof HTMLElement && keyboardPathNavigation
|
|
142
|
-
? keyboardPathNavigation.querySelector("a")
|
|
143
|
-
: undefined;
|
|
144
|
-
const anchorHref = anchor?.getAttribute("href") ?? null;
|
|
145
|
-
const shouldHighlight = isPathToHighlight(path, anchorHref);
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<StyledListItem key={path} delayAnimation={delayAnimation}>
|
|
149
|
-
<StyledSafeLink
|
|
150
|
-
data-highlighted={shouldHighlight || false}
|
|
151
|
-
{...linkProps}
|
|
152
|
-
onClick={() => {
|
|
153
|
-
if (onNavigate) {
|
|
154
|
-
onNavigate();
|
|
155
|
-
}
|
|
156
|
-
}}
|
|
157
|
-
>
|
|
158
|
-
{unGrouped && !ignoreContentTypeBadge && (
|
|
159
|
-
<ContentTypeBadge type={resource.contentType ?? ""} size="x-small" background border />
|
|
160
|
-
)}
|
|
161
|
-
{linkContent}
|
|
162
|
-
{renderAdditionalIcon(t("resource.additionalTooltip"), additional)}
|
|
163
|
-
</StyledSafeLink>
|
|
164
|
-
</StyledListItem>
|
|
165
|
-
);
|
|
166
|
-
})}
|
|
167
|
-
{displayShowAllButton && (
|
|
168
|
-
<StyledListItem ref={showAllRef}>
|
|
169
|
-
<ButtonV2
|
|
170
|
-
variant="ghost"
|
|
171
|
-
shape="pill"
|
|
172
|
-
css={[showAllButtonStyle, shouldHighlightShowAllButton && noWidthhighlightStyle]}
|
|
173
|
-
data-highlighted={shouldHighlightShowAllButton}
|
|
174
|
-
onClick={() => toggleShowAll(!showAll)}
|
|
175
|
-
tabIndex={-1}
|
|
176
|
-
>
|
|
177
|
-
{showAll ? messages.showLessResultLabel : messages.allResultLabel}
|
|
178
|
-
{showAll ? <ChevronUp /> : <ChevronDown />}
|
|
179
|
-
</ButtonV2>
|
|
180
|
-
</StyledListItem>
|
|
181
|
-
)}
|
|
182
|
-
</StyledList>
|
|
183
|
-
) : (
|
|
184
|
-
<StyledNoHit inMenu={inMenu}>{messages.noHit}</StyledNoHit>
|
|
185
|
-
)}
|
|
186
|
-
</StyledWrapper>
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export default ContentTypeResult;
|
|
@@ -1,172 +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 { css } from "@emotion/react";
|
|
10
|
-
import styled from "@emotion/styled";
|
|
11
|
-
import { colors, spacing, spacingUnit, fonts, misc, animations, mq, breakpoints } from "@ndla/core";
|
|
12
|
-
|
|
13
|
-
export const highlightStyle = css`
|
|
14
|
-
background: ${colors.brand.light};
|
|
15
|
-
color: ${colors.brand.dark};
|
|
16
|
-
width: 100%;
|
|
17
|
-
small {
|
|
18
|
-
color: ${colors.text.primary} !important;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
export const noWidthhighlightStyle = css`
|
|
23
|
-
background: ${colors.brand.light};
|
|
24
|
-
color: ${colors.brand.dark};
|
|
25
|
-
small {
|
|
26
|
-
color: ${colors.text.primary} !important;
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
type inMenuProps = {
|
|
31
|
-
inMenu?: boolean;
|
|
32
|
-
animateList?: number;
|
|
33
|
-
unGrouped?: boolean;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const StyledNoHit = styled.p<inMenuProps>`
|
|
37
|
-
color: ${colors.text.light};
|
|
38
|
-
margin: 0;
|
|
39
|
-
font-style: italic;
|
|
40
|
-
${fonts.sizes(16, 1.1)};
|
|
41
|
-
${(props) =>
|
|
42
|
-
props.inMenu &&
|
|
43
|
-
css`
|
|
44
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
45
|
-
margin-left: ${spacingUnit * 1.5}px;
|
|
46
|
-
}
|
|
47
|
-
`}
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
export const showAllButtonStyle = css`
|
|
51
|
-
margin-left: -${spacing.xsmall};
|
|
52
|
-
margin-top: ${spacing.small};
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
export const tooltipStyle = css`
|
|
56
|
-
padding-left: ${spacing.xsmall};
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
export const StyledWrapper = styled.section`
|
|
60
|
-
padding-bottom: ${spacing.normal};
|
|
61
|
-
padding-top: ${spacing.normal};
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
export const StyledHeader = styled.header`
|
|
65
|
-
margin-bottom: ${spacing.small};
|
|
66
|
-
display: flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
> div {
|
|
69
|
-
margin-right: ${spacing.small};
|
|
70
|
-
}
|
|
71
|
-
h1 {
|
|
72
|
-
margin: 0;
|
|
73
|
-
${fonts.sizes(16, 1.1)};
|
|
74
|
-
small {
|
|
75
|
-
font-weight: ${fonts.weight.normal};
|
|
76
|
-
font-size: inherit;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
type StyledListItemProps = {
|
|
82
|
-
delayAnimation?: boolean;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const StyledListItem = styled.li<StyledListItemProps>`
|
|
86
|
-
${(props) =>
|
|
87
|
-
props.delayAnimation &&
|
|
88
|
-
css`
|
|
89
|
-
${animations.fadeInLeftFromZero()}
|
|
90
|
-
animation-delay: ${animations.durations.normal};
|
|
91
|
-
`}
|
|
92
|
-
${(props) => !props.delayAnimation && animations.fadeInLeft()}
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
|
-
export const StyledList = styled.ul<inMenuProps>`
|
|
96
|
-
list-style: none;
|
|
97
|
-
padding: 0;
|
|
98
|
-
${(props) => {
|
|
99
|
-
if (props.animateList && props.animateList > 0) {
|
|
100
|
-
return animations.toggledContentWithSwitchAnimation(
|
|
101
|
-
animations.durations.normal,
|
|
102
|
-
`contentTypeResultAnimation${props.animateList % 2 ? "1" : "2"}`,
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
}}
|
|
106
|
-
li {
|
|
107
|
-
margin: 0 -${spacing.small};
|
|
108
|
-
a {
|
|
109
|
-
> div {
|
|
110
|
-
margin-right: ${spacing.small};
|
|
111
|
-
}
|
|
112
|
-
color: ${colors.brand.primary};
|
|
113
|
-
box-shadow: none;
|
|
114
|
-
display: inline-flex;
|
|
115
|
-
flex-grow: 1;
|
|
116
|
-
align-items: center;
|
|
117
|
-
padding: ${spacing.xsmall} ${spacing.small};
|
|
118
|
-
small {
|
|
119
|
-
color: ${colors.text.light};
|
|
120
|
-
padding-left: ${spacing.xsmall};
|
|
121
|
-
${mq.range({ until: breakpoints.tablet })} {
|
|
122
|
-
display: none;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
&:focus {
|
|
126
|
-
${highlightStyle};
|
|
127
|
-
}
|
|
128
|
-
${(props) =>
|
|
129
|
-
props.inMenu
|
|
130
|
-
? css`
|
|
131
|
-
${mq.range({ from: breakpoints.desktop })} {
|
|
132
|
-
margin-left: ${!props.unGrouped && spacingUnit * 1.5}px;
|
|
133
|
-
}
|
|
134
|
-
strong {
|
|
135
|
-
text-decoration: underline;
|
|
136
|
-
font-weight: ${fonts.weight.normal};
|
|
137
|
-
}
|
|
138
|
-
&:hover {
|
|
139
|
-
strong {
|
|
140
|
-
text-decoration: none;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`
|
|
144
|
-
: css`
|
|
145
|
-
strong {
|
|
146
|
-
font-weight: ${fonts.weight.semibold};
|
|
147
|
-
}
|
|
148
|
-
&:hover {
|
|
149
|
-
strong {
|
|
150
|
-
text-decoration: underline;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
`}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
`;
|
|
157
|
-
|
|
158
|
-
export const StyledTag = styled.span`
|
|
159
|
-
background: ${colors.brand.greyLightest};
|
|
160
|
-
border-radius: ${misc.borderRadius};
|
|
161
|
-
color: ${colors.text.primary};
|
|
162
|
-
${fonts.sizes("12px", "20px")};
|
|
163
|
-
font-weight: ${fonts.weight.semibold};
|
|
164
|
-
margin: 0 0 0 ${spacing.small};
|
|
165
|
-
height: ${spacing.normal};
|
|
166
|
-
display: flex;
|
|
167
|
-
align-items: center;
|
|
168
|
-
padding: 0 ${spacingUnit / 6}px;
|
|
169
|
-
${mq.range({ until: breakpoints.desktop })} {
|
|
170
|
-
display: none;
|
|
171
|
-
}
|
|
172
|
-
`;
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
export const isPathToHighlight = (path: string, href: string | false | null): boolean => {
|
|
10
|
-
const regexForPath = new RegExp(`^(/.*)?${path}$`);
|
|
11
|
-
return regexForPath.test(href || "") || path === href;
|
|
12
|
-
};
|