@ndla/ui 55.0.13-alpha.0 → 55.0.15-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 +142 -1
- package/dist/styles.css +597 -0
- package/es/Article/ArticleByline.js +7 -7
- package/es/Article/ArticleParagraph.js +11 -13
- package/es/AudioPlayer/AudioPlayer.js +1 -0
- package/es/CampaignBlock/CampaignBlock.js +103 -68
- package/es/Concept/Concept.js +69 -0
- package/es/ContactBlock/ContactBlock.js +17 -17
- package/es/ContentTypeBadge/ContentTypeBadgeNew.js +48 -0
- package/es/Embed/AudioEmbed.js +1 -2
- package/es/Embed/BrightcoveEmbed.js +13 -25
- package/es/Embed/ConceptEmbed.js +57 -301
- package/es/Embed/ConceptListEmbed.js +18 -24
- package/es/Embed/ContentLinkEmbed.js +10 -10
- package/es/Embed/CopyrightEmbed.js +3 -21
- package/es/Embed/ExternalEmbed.js +10 -18
- package/es/Embed/FootnoteEmbed.js +11 -8
- package/es/Embed/GlossEmbed.js +68 -0
- package/es/Embed/H5pEmbed.js +19 -19
- package/es/Embed/IframeEmbed.js +9 -6
- package/es/Embed/InlineTriggerButton.js +70 -0
- package/es/Embed/UnknownEmbed.js +9 -9
- package/es/Embed/UuDisclaimerEmbed.js +14 -25
- package/es/Embed/index.js +1 -3
- package/es/ErrorMessage/ErrorMessage.js +41 -22
- package/es/ErrorMessage/ErrorResourceAccessDenied.js +8 -6
- package/es/FactBox/FactBox.js +118 -47
- package/es/FileList/PdfFile.js +23 -5
- package/es/Gloss/Gloss.js +116 -86
- package/es/Gloss/GlossExample.js +49 -51
- package/es/LicenseByline/EmbedByline.js +143 -33
- package/es/LicenseByline/LicenseLink.js +16 -9
- package/es/LicenseByline/index.js +2 -2
- package/es/LinkBlock/LinkBlock.js +61 -33
- package/es/LinkBlock/LinkBlockSection.js +9 -6
- package/es/Logo/Logo.js +1 -30
- package/es/RelatedArticleList/RelatedArticleList.js +70 -87
- package/es/ResourceBox/ResourceBox.js +65 -37
- package/es/TagSelector/TagSelector.js +124 -131
- package/es/i18n/index.js +2 -1
- package/es/i18n/useComponentTranslations.js +83 -0
- package/es/index.js +4 -12
- package/es/locale/messages-en.js +30 -4
- package/es/locale/messages-nb.js +30 -4
- package/es/locale/messages-nn.js +30 -4
- package/es/locale/messages-se.js +30 -4
- package/es/locale/messages-sma.js +30 -4
- package/es/model/ContentType.js +3 -0
- package/es/styles.css +597 -0
- package/lib/Article/ArticleByline.js +8 -8
- package/lib/Article/ArticleParagraph.js +12 -14
- package/lib/AudioPlayer/AudioPlayer.js +1 -0
- package/lib/CampaignBlock/CampaignBlock.d.ts +2 -2
- package/lib/CampaignBlock/CampaignBlock.js +106 -68
- package/lib/Concept/Concept.d.ts +18 -0
- package/lib/Concept/Concept.js +75 -0
- package/lib/ContactBlock/ContactBlock.js +18 -18
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +17 -0
- package/lib/ContentTypeBadge/ContentTypeBadgeNew.js +56 -0
- package/lib/Embed/AudioEmbed.js +2 -3
- package/lib/Embed/BrightcoveEmbed.d.ts +1 -2
- package/lib/Embed/BrightcoveEmbed.js +16 -26
- package/lib/Embed/ConceptEmbed.d.ts +15 -21
- package/lib/Embed/ConceptEmbed.js +58 -301
- package/lib/Embed/ConceptListEmbed.js +21 -26
- package/lib/Embed/ContentLinkEmbed.js +10 -11
- package/lib/Embed/CopyrightEmbed.js +5 -22
- package/lib/Embed/ExternalEmbed.d.ts +1 -2
- package/lib/Embed/ExternalEmbed.js +13 -19
- package/lib/Embed/FootnoteEmbed.js +11 -9
- package/lib/Embed/GlossEmbed.d.ts +13 -0
- package/lib/Embed/GlossEmbed.js +76 -0
- package/lib/Embed/H5pEmbed.d.ts +1 -2
- package/lib/Embed/H5pEmbed.js +21 -19
- package/lib/Embed/IframeEmbed.d.ts +1 -2
- package/lib/Embed/IframeEmbed.js +11 -8
- package/lib/Embed/InlineTriggerButton.d.ts +11 -0
- package/lib/Embed/InlineTriggerButton.js +76 -0
- package/lib/Embed/UnknownEmbed.js +9 -10
- package/lib/Embed/UuDisclaimerEmbed.js +16 -26
- package/lib/Embed/index.d.ts +2 -3
- package/lib/Embed/index.js +2 -9
- package/lib/ErrorMessage/ErrorMessage.js +40 -23
- package/lib/ErrorMessage/ErrorResourceAccessDenied.js +7 -6
- package/lib/FactBox/FactBox.d.ts +0 -1
- package/lib/FactBox/FactBox.js +119 -46
- package/lib/FileList/PdfFile.js +23 -5
- package/lib/Gloss/Gloss.d.ts +10 -2
- package/lib/Gloss/Gloss.js +116 -85
- package/lib/Gloss/GlossExample.d.ts +3 -5
- package/lib/Gloss/GlossExample.js +49 -52
- package/lib/LicenseByline/EmbedByline.d.ts +2 -4
- package/lib/LicenseByline/EmbedByline.js +145 -35
- package/lib/LicenseByline/LicenseLink.d.ts +2 -2
- package/lib/LicenseByline/LicenseLink.js +16 -9
- package/lib/LicenseByline/index.d.ts +2 -2
- package/lib/LicenseByline/index.js +4 -5
- package/lib/LinkBlock/LinkBlock.js +62 -34
- package/lib/LinkBlock/LinkBlockSection.js +9 -7
- package/lib/Logo/Logo.d.ts +1 -3
- package/lib/Logo/Logo.js +2 -30
- package/lib/RelatedArticleList/RelatedArticleList.d.ts +4 -4
- package/lib/RelatedArticleList/RelatedArticleList.js +74 -90
- package/lib/ResourceBox/ResourceBox.js +64 -37
- package/lib/TagSelector/TagSelector.d.ts +27 -12
- package/lib/TagSelector/TagSelector.js +126 -131
- package/lib/i18n/index.d.ts +1 -0
- package/lib/i18n/index.js +20 -1
- package/lib/i18n/useComponentTranslations.d.ts +14 -0
- package/lib/i18n/useComponentTranslations.js +93 -0
- package/lib/index.d.ts +5 -15
- package/lib/index.js +70 -102
- package/lib/locale/messages-en.d.ts +26 -0
- package/lib/locale/messages-en.js +30 -4
- package/lib/locale/messages-nb.d.ts +26 -0
- package/lib/locale/messages-nb.js +30 -4
- package/lib/locale/messages-nn.d.ts +26 -0
- package/lib/locale/messages-nn.js +30 -4
- package/lib/locale/messages-se.d.ts +26 -0
- package/lib/locale/messages-se.js +30 -4
- package/lib/locale/messages-sma.d.ts +26 -0
- package/lib/locale/messages-sma.js +30 -4
- package/lib/model/ContentType.d.ts +3 -0
- package/lib/model/ContentType.js +4 -1
- package/lib/styles.css +597 -0
- package/package.json +11 -13
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/Article/ArticleParagraph.tsx +11 -9
- package/src/AudioPlayer/AudioPlayer.tsx +1 -0
- package/src/CampaignBlock/CampaignBlock.tsx +92 -55
- package/src/Concept/Concept.stories.tsx +142 -0
- package/src/Concept/Concept.tsx +73 -0
- package/src/ContactBlock/ContactBlock.tsx +1 -1
- package/src/ContentTypeBadge/ContentTypeBadgeNew.stories.tsx +70 -0
- package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +69 -0
- package/src/Embed/AudioEmbed.tsx +2 -2
- package/src/Embed/BrightcoveEmbed.stories.tsx +0 -3
- package/src/Embed/BrightcoveEmbed.tsx +18 -20
- package/src/Embed/ConceptEmbed.stories.tsx +1 -105
- package/src/Embed/ConceptEmbed.tsx +60 -385
- package/src/Embed/ConceptListEmbed.tsx +20 -19
- package/src/Embed/ContentLinkEmbed.tsx +8 -10
- package/src/Embed/CopyrightEmbed.tsx +1 -11
- package/src/Embed/ExternalEmbed.tsx +14 -17
- package/src/Embed/FootnoteEmbed.stories.tsx +2 -5
- package/src/Embed/FootnoteEmbed.tsx +13 -16
- package/src/Embed/GlossEmbed.stories.tsx +140 -0
- package/src/Embed/GlossEmbed.tsx +64 -0
- package/src/Embed/H5pEmbed.tsx +22 -16
- package/src/Embed/IframeEmbed.tsx +12 -6
- package/src/Embed/InlineTriggerButton.tsx +72 -0
- package/src/Embed/UnknownEmbed.tsx +6 -7
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +4 -4
- package/src/Embed/UuDisclaimerEmbed.tsx +17 -25
- package/src/Embed/index.ts +2 -3
- package/src/ErrorMessage/ErrorMessage.tsx +40 -29
- package/src/ErrorMessage/ErrorResourceAccessDenied.tsx +8 -6
- package/src/FactBox/FactBox.tsx +115 -115
- package/src/FactBox/Factbox.stories.tsx +43 -27
- package/src/FileList/FileList.stories.tsx +6 -1
- package/src/FileList/PdfFile.tsx +22 -5
- package/src/Gloss/Gloss.stories.tsx +107 -1
- package/src/Gloss/Gloss.tsx +143 -156
- package/src/Gloss/GlossExample.tsx +51 -77
- package/src/LicenseByline/EmbedByline.stories.tsx +9 -4
- package/src/LicenseByline/EmbedByline.tsx +139 -53
- package/src/LicenseByline/LicenseLink.tsx +15 -15
- package/src/LicenseByline/index.tsx +2 -2
- package/src/LinkBlock/LinkBlock.stories.tsx +8 -10
- package/src/LinkBlock/LinkBlock.tsx +54 -59
- package/src/LinkBlock/LinkBlockSection.tsx +9 -12
- package/src/Logo/Logo.stories.tsx +0 -1
- package/src/Logo/Logo.tsx +2 -30
- package/src/RelatedArticleList/RelatedArticleList.tsx +69 -88
- package/src/ResourceBox/ResourceBox.tsx +63 -59
- package/src/TagSelector/TagSelector.stories.tsx +92 -68
- package/src/TagSelector/TagSelector.tsx +161 -126
- package/src/i18n/index.ts +5 -0
- package/src/i18n/useComponentTranslations.ts +72 -0
- package/src/index.ts +23 -19
- package/src/locale/messages-en.ts +28 -2
- package/src/locale/messages-nb.ts +28 -2
- package/src/locale/messages-nn.ts +28 -2
- package/src/locale/messages-se.ts +28 -2
- package/src/locale/messages-sma.ts +28 -2
- package/src/model/ContentType.ts +3 -0
- package/es/DefinitionList/DefinitionDescription.js +0 -28
- package/es/DefinitionList/DefinitionTerm.js +0 -28
- package/es/DefinitionList/index.js +0 -10
- package/es/Embed/conceptComponents.js +0 -155
- package/es/ExpandableBox/ExpandableBox.js +0 -29
- package/es/ExpandableBox/index.js +0 -9
- package/es/Figure/Figure.js +0 -73
- package/es/Figure/index.js +0 -9
- package/es/FramedContent/FramedContent.js +0 -28
- package/es/FramedContent/index.js +0 -10
- package/es/Image/Image.js +0 -99
- package/es/Image/ImageLink.js +0 -39
- package/es/Image/index.js +0 -12
- package/es/LetterFilter/LetterFilter.js +0 -54
- package/es/LetterFilter/alphabet.js +0 -9
- package/es/LetterFilter/index.js +0 -10
- package/es/LicenseByline/LicenseDescription.js +0 -63
- package/es/List/OrderedList.js +0 -41
- package/es/List/UnOrderedList.js +0 -28
- package/es/List/index.js +0 -10
- package/es/Notion/Notion.js +0 -76
- package/es/Notion/NotionImage.js +0 -46
- package/es/Notion/index.js +0 -9
- package/es/Table/Table.js +0 -141
- package/es/Table/index.js +0 -11
- package/es/TagSelector/Control.js +0 -28
- package/es/TagSelector/DropdownIndicator.js +0 -60
- package/es/TagSelector/Input.js +0 -22
- package/es/TagSelector/Menu.js +0 -27
- package/es/TagSelector/MenuList.js +0 -28
- package/es/TagSelector/Option.js +0 -60
- package/es/TagSelector/SelectContainer.js +0 -27
- package/es/TagSelector/ValueButton.js +0 -53
- package/es/TagSelector/ariaMessages.js +0 -94
- package/es/TagSelector/index.js +0 -10
- package/es/TagSelector/types.js +0 -1
- package/lib/DefinitionList/DefinitionDescription.d.ts +0 -10
- package/lib/DefinitionList/DefinitionDescription.js +0 -35
- package/lib/DefinitionList/DefinitionTerm.d.ts +0 -10
- package/lib/DefinitionList/DefinitionTerm.js +0 -35
- package/lib/DefinitionList/index.d.ts +0 -9
- package/lib/DefinitionList/index.js +0 -20
- package/lib/Embed/conceptComponents.d.ts +0 -40
- package/lib/Embed/conceptComponents.js +0 -163
- package/lib/ExpandableBox/ExpandableBox.d.ts +0 -15
- package/lib/ExpandableBox/ExpandableBox.js +0 -37
- package/lib/ExpandableBox/index.d.ts +0 -8
- package/lib/ExpandableBox/index.js +0 -18
- package/lib/Figure/Figure.d.ts +0 -16
- package/lib/Figure/Figure.js +0 -81
- package/lib/Figure/index.d.ts +0 -9
- package/lib/Figure/index.js +0 -13
- package/lib/FramedContent/FramedContent.d.ts +0 -12
- package/lib/FramedContent/FramedContent.js +0 -35
- package/lib/FramedContent/index.d.ts +0 -9
- package/lib/FramedContent/index.js +0 -16
- package/lib/Image/Image.d.ts +0 -38
- package/lib/Image/Image.js +0 -105
- package/lib/Image/ImageLink.d.ts +0 -18
- package/lib/Image/ImageLink.js +0 -44
- package/lib/Image/index.d.ts +0 -12
- package/lib/Image/index.js +0 -30
- package/lib/LetterFilter/LetterFilter.d.ts +0 -14
- package/lib/LetterFilter/LetterFilter.js +0 -61
- package/lib/LetterFilter/alphabet.d.ts +0 -8
- package/lib/LetterFilter/alphabet.js +0 -15
- package/lib/LetterFilter/index.d.ts +0 -9
- package/lib/LetterFilter/index.js +0 -16
- package/lib/LicenseByline/LicenseDescription.d.ts +0 -15
- package/lib/LicenseByline/LicenseDescription.js +0 -70
- package/lib/List/OrderedList.d.ts +0 -16
- package/lib/List/OrderedList.js +0 -48
- package/lib/List/UnOrderedList.d.ts +0 -10
- package/lib/List/UnOrderedList.js +0 -35
- package/lib/List/index.d.ts +0 -9
- package/lib/List/index.js +0 -20
- package/lib/Notion/Notion.d.ts +0 -20
- package/lib/Notion/Notion.js +0 -82
- package/lib/Notion/NotionImage.d.ts +0 -13
- package/lib/Notion/NotionImage.js +0 -54
- package/lib/Notion/index.d.ts +0 -8
- package/lib/Notion/index.js +0 -13
- package/lib/Table/Table.d.ts +0 -19
- package/lib/Table/Table.js +0 -145
- package/lib/Table/index.d.ts +0 -10
- package/lib/Table/index.js +0 -23
- package/lib/TagSelector/Control.d.ts +0 -11
- package/lib/TagSelector/Control.js +0 -35
- package/lib/TagSelector/DropdownIndicator.d.ts +0 -11
- package/lib/TagSelector/DropdownIndicator.js +0 -64
- package/lib/TagSelector/Input.d.ts +0 -12
- package/lib/TagSelector/Input.js +0 -29
- package/lib/TagSelector/Menu.d.ts +0 -12
- package/lib/TagSelector/Menu.js +0 -34
- package/lib/TagSelector/MenuList.d.ts +0 -16
- package/lib/TagSelector/MenuList.js +0 -35
- package/lib/TagSelector/Option.d.ts +0 -12
- package/lib/TagSelector/Option.js +0 -67
- package/lib/TagSelector/SelectContainer.d.ts +0 -11
- package/lib/TagSelector/SelectContainer.js +0 -34
- package/lib/TagSelector/ValueButton.d.ts +0 -20
- package/lib/TagSelector/ValueButton.js +0 -60
- package/lib/TagSelector/ariaMessages.d.ts +0 -16
- package/lib/TagSelector/ariaMessages.js +0 -101
- package/lib/TagSelector/index.d.ts +0 -11
- package/lib/TagSelector/index.js +0 -13
- package/lib/TagSelector/types.d.ts +0 -11
- package/lib/TagSelector/types.js +0 -5
- package/src/DefinitionList/DefinitionDescription.tsx +0 -26
- package/src/DefinitionList/DefinitionTerm.tsx +0 -26
- package/src/DefinitionList/index.tsx +0 -10
- package/src/Embed/conceptComponents.tsx +0 -293
- package/src/ExpandableBox/ExpandableBox.stories.tsx +0 -41
- package/src/ExpandableBox/ExpandableBox.tsx +0 -23
- package/src/ExpandableBox/index.ts +0 -9
- package/src/Figure/Figure.tsx +0 -167
- package/src/Figure/index.ts +0 -11
- package/src/FramedContent/FramedContent.stories.tsx +0 -152
- package/src/FramedContent/FramedContent.tsx +0 -26
- package/src/FramedContent/index.ts +0 -10
- package/src/Image/Image.stories.tsx +0 -61
- package/src/Image/Image.tsx +0 -147
- package/src/Image/ImageLink.tsx +0 -37
- package/src/Image/index.ts +0 -14
- package/src/LetterFilter/LetterFilter.stories.tsx +0 -29
- package/src/LetterFilter/LetterFilter.tsx +0 -78
- package/src/LetterFilter/alphabet.ts +0 -39
- package/src/LetterFilter/index.ts +0 -11
- package/src/LicenseByline/LicenseDescription.tsx +0 -100
- package/src/List/OrderedList.stories.tsx +0 -135
- package/src/List/OrderedList.tsx +0 -158
- package/src/List/UnOrderedList.tsx +0 -43
- package/src/List/UnorderedList.stories.tsx +0 -72
- package/src/List/index.ts +0 -10
- package/src/Notion/Notion.tsx +0 -96
- package/src/Notion/NotionImage.tsx +0 -64
- package/src/Notion/index.ts +0 -9
- package/src/Table/Table.stories.tsx +0 -738
- package/src/Table/Table.tsx +0 -284
- package/src/Table/index.ts +0 -12
- package/src/TagSelector/Control.tsx +0 -34
- package/src/TagSelector/DropdownIndicator.tsx +0 -55
- package/src/TagSelector/Input.tsx +0 -31
- package/src/TagSelector/Menu.tsx +0 -38
- package/src/TagSelector/MenuList.tsx +0 -30
- package/src/TagSelector/Option.tsx +0 -58
- package/src/TagSelector/SelectContainer.tsx +0 -31
- package/src/TagSelector/ValueButton.tsx +0 -47
- package/src/TagSelector/ariaMessages.ts +0 -96
- package/src/TagSelector/index.ts +0 -14
- package/src/TagSelector/types.ts +0 -12
|
@@ -6,23 +6,20 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ReactNode } from "react";
|
|
9
|
+
import { ReactNode, useState } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import styled from "@emotion/styled";
|
|
12
|
-
import { colors, fonts, misc, spacing } from "@ndla/core";
|
|
13
11
|
import { WarningOutline } from "@ndla/icons/common";
|
|
14
12
|
import { getLicenseByAbbreviation, getLicenseCredits } from "@ndla/licenses";
|
|
13
|
+
import { Button, Text } from "@ndla/primitives";
|
|
14
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
15
15
|
import { ICopyright as ArticleCopyright } from "@ndla/types-backend/article-api";
|
|
16
16
|
import { ICopyright as AudioCopyright } from "@ndla/types-backend/audio-api";
|
|
17
17
|
import { IDraftCopyright as ConceptCopyright } from "@ndla/types-backend/concept-api";
|
|
18
18
|
import { ICopyright as ImageCopyright } from "@ndla/types-backend/image-api";
|
|
19
19
|
import { BrightcoveCopyright } from "@ndla/types-embed";
|
|
20
|
-
import
|
|
21
|
-
import LicenseLink from "./LicenseLink";
|
|
20
|
+
import { LicenseLink } from "./LicenseLink";
|
|
22
21
|
|
|
23
22
|
interface BaseProps {
|
|
24
|
-
topRounded?: boolean;
|
|
25
|
-
bottomRounded?: boolean;
|
|
26
23
|
description?: ReactNode;
|
|
27
24
|
children?: ReactNode;
|
|
28
25
|
visibleAlt?: string;
|
|
@@ -74,49 +71,63 @@ export type EmbedBylineTypeProps =
|
|
|
74
71
|
|
|
75
72
|
type Props = EmbedBylineTypeProps | EmbedBylineErrorProps;
|
|
76
73
|
|
|
77
|
-
const BylineWrapper = styled
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
74
|
+
const BylineWrapper = styled("figcaption", {
|
|
75
|
+
base: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
paddingBlock: "xsmall",
|
|
79
|
+
background: "surface.default",
|
|
80
|
+
textStyle: "label.medium",
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const ErrorBylineWrapper = styled(BylineWrapper, {
|
|
85
|
+
base: {
|
|
86
|
+
border: "1px solid",
|
|
87
|
+
borderColor: "stroke.error",
|
|
88
|
+
borderRadius: "xsmall",
|
|
89
|
+
background: "surface.dangerSubtle",
|
|
90
|
+
paddingInline: "medium",
|
|
91
|
+
paddingBlock: "medium",
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const StyledText = styled(Text, {
|
|
96
|
+
base: {
|
|
97
|
+
fontStyle: "italic",
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const ContentWrapper = styled("div", {
|
|
102
|
+
base: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
gap: "xsmall",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
textStyle: "label.medium",
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const BaseDescription = styled("div", {
|
|
111
|
+
base: {
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
whiteSpace: "pre-wrap",
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export const EmbedByline = ({ type, description, children, visibleAlt, ...props }: Props) => {
|
|
110
118
|
const { t } = useTranslation();
|
|
111
119
|
|
|
112
120
|
if (props.error) {
|
|
113
121
|
const typeString = type === "h5p" ? "H5P" : t(`embed.type.${type}`).toLowerCase();
|
|
114
122
|
return (
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
<ErrorBylineWrapper>
|
|
124
|
+
<ContentWrapper>
|
|
125
|
+
<WarningOutline />
|
|
126
|
+
<BaseDescription>
|
|
127
|
+
<span>{t("embed.embedError", { type: typeString })}</span>
|
|
128
|
+
</BaseDescription>
|
|
129
|
+
</ContentWrapper>
|
|
130
|
+
</ErrorBylineWrapper>
|
|
120
131
|
);
|
|
121
132
|
}
|
|
122
133
|
|
|
@@ -132,7 +143,11 @@ const EmbedByline = ({ type, topRounded, bottomRounded, description, children, v
|
|
|
132
143
|
{children}
|
|
133
144
|
</div>
|
|
134
145
|
</BylineWrapper>
|
|
135
|
-
{visibleAlt ?
|
|
146
|
+
{visibleAlt ? (
|
|
147
|
+
<StyledText color="text.subtle" textStyle="label.medium" asChild consumeCss>
|
|
148
|
+
<span>{`Alt: ${visibleAlt}`}</span>
|
|
149
|
+
</StyledText>
|
|
150
|
+
) : null}
|
|
136
151
|
</>
|
|
137
152
|
);
|
|
138
153
|
};
|
|
@@ -143,16 +158,79 @@ interface LicenseContainerProps {
|
|
|
143
158
|
type: Props["type"];
|
|
144
159
|
}
|
|
145
160
|
|
|
161
|
+
const StyledDescription = styled(BaseDescription, {
|
|
162
|
+
base: {
|
|
163
|
+
mobileWideDown: {
|
|
164
|
+
display: "grid",
|
|
165
|
+
gridTemplateColumns: "1fr auto",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
overflow: "hidden",
|
|
168
|
+
_open: {
|
|
169
|
+
display: "inline",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
const TextContent = styled("span", {
|
|
176
|
+
base: {
|
|
177
|
+
mobileWideDown: {
|
|
178
|
+
whiteSpace: "nowrap",
|
|
179
|
+
maxHeight: "large",
|
|
180
|
+
overflow: "hidden",
|
|
181
|
+
textOverflow: "ellipsis",
|
|
182
|
+
transitionProperty: "max-height",
|
|
183
|
+
transitionDuration: "slow",
|
|
184
|
+
transitionTimingFunction: "ease-in",
|
|
185
|
+
_open: {
|
|
186
|
+
whiteSpace: "pre-wrap",
|
|
187
|
+
maxHeight: "none",
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const StyledButton = styled(Button, {
|
|
194
|
+
base: {
|
|
195
|
+
mobileWide: {
|
|
196
|
+
display: "none",
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
interface LicenseDescriptionProps {
|
|
202
|
+
children?: ReactNode;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const LicenseDescription = ({ children }: LicenseDescriptionProps) => {
|
|
206
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
207
|
+
const open = isOpen ? { "data-open": "" } : {};
|
|
208
|
+
const { t } = useTranslation();
|
|
209
|
+
|
|
210
|
+
const handleToggle = () => {
|
|
211
|
+
setIsOpen(!isOpen);
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<ContentWrapper>
|
|
216
|
+
<StyledDescription {...open}>
|
|
217
|
+
<TextContent {...open}>{children}</TextContent>
|
|
218
|
+
<StyledButton variant="link" size="small" onClick={handleToggle}>
|
|
219
|
+
{isOpen ? `${t("audio.readLessDescriptionLabel")}` : `${t("audio.readMoreDescriptionLabel")}`}
|
|
220
|
+
</StyledButton>
|
|
221
|
+
</StyledDescription>
|
|
222
|
+
</ContentWrapper>
|
|
223
|
+
);
|
|
224
|
+
};
|
|
225
|
+
|
|
146
226
|
export const LicenseContainerContent = ({ children, copyright, type }: LicenseContainerProps) => {
|
|
147
227
|
const { t, i18n } = useTranslation();
|
|
148
228
|
const license = copyright ? getLicenseByAbbreviation(copyright.license?.license ?? "", i18n.language) : undefined;
|
|
149
229
|
const authors = getLicenseCredits(copyright);
|
|
150
230
|
const captionAuthors = Object.values(authors).find((i) => i.length > 0) ?? [];
|
|
151
231
|
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<Component>
|
|
232
|
+
const content = (
|
|
233
|
+
<>
|
|
156
234
|
{children}
|
|
157
235
|
{` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`}
|
|
158
236
|
{captionAuthors.map((author) => author.name).join(", ")}
|
|
@@ -162,8 +240,16 @@ export const LicenseContainerContent = ({ children, copyright, type }: LicenseCo
|
|
|
162
240
|
<LicenseLink license={license} />
|
|
163
241
|
</>
|
|
164
242
|
) : null}
|
|
165
|
-
|
|
243
|
+
</>
|
|
166
244
|
);
|
|
167
|
-
};
|
|
168
245
|
|
|
169
|
-
|
|
246
|
+
if (children) {
|
|
247
|
+
return <LicenseDescription>{content}</LicenseDescription>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return (
|
|
251
|
+
<Text textStyle="label.medium" asChild consumeCss>
|
|
252
|
+
<span>{content}</span>
|
|
253
|
+
</Text>
|
|
254
|
+
);
|
|
255
|
+
};
|
|
@@ -6,27 +6,29 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import styled from "@emotion/styled";
|
|
10
|
-
import { colors } from "@ndla/core";
|
|
11
9
|
import { LicenseLocaleType } from "@ndla/licenses";
|
|
12
10
|
import { SafeLink } from "@ndla/safelink";
|
|
11
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
13
12
|
|
|
14
13
|
interface Props {
|
|
15
14
|
license: LicenseLocaleType;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
const StyledSafeLink = styled(SafeLink
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
const StyledSafeLink = styled(SafeLink, {
|
|
18
|
+
base: {
|
|
19
|
+
color: "primary",
|
|
20
|
+
textDecoration: "underline",
|
|
21
|
+
whiteSpace: "nowrap",
|
|
22
|
+
_hover: {
|
|
23
|
+
textDecoration: "none",
|
|
24
|
+
},
|
|
25
|
+
_focusWithin: {
|
|
26
|
+
textDecoration: "none",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
28
30
|
|
|
29
|
-
const LicenseLink = ({ license }: Props) => {
|
|
31
|
+
export const LicenseLink = ({ license }: Props) => {
|
|
30
32
|
if (license.abbreviation === "unknown") {
|
|
31
33
|
return null;
|
|
32
34
|
}
|
|
@@ -39,5 +41,3 @@ const LicenseLink = ({ license }: Props) => {
|
|
|
39
41
|
}
|
|
40
42
|
return <span>{license.abbreviation}</span>;
|
|
41
43
|
};
|
|
42
|
-
|
|
43
|
-
export default LicenseLink;
|
|
@@ -14,19 +14,17 @@ export default {
|
|
|
14
14
|
title: "Components/Link Block",
|
|
15
15
|
component: LinkBlock,
|
|
16
16
|
tags: ["autodocs"],
|
|
17
|
-
args: {
|
|
17
|
+
args: {
|
|
18
|
+
title: "Redaksjonell <em>medarbeider</em> i faget spansk 2",
|
|
19
|
+
articleLanguage: "nb",
|
|
20
|
+
date: "05. mars 2023",
|
|
21
|
+
url: "",
|
|
22
|
+
},
|
|
18
23
|
} as Meta<typeof LinkBlock>;
|
|
19
24
|
|
|
20
|
-
const
|
|
21
|
-
title: "Redaksjonell <em>medarbeider</em> i faget spansk 2",
|
|
22
|
-
articleLanguage: "nb",
|
|
23
|
-
date: "05. mars 2023",
|
|
24
|
-
url: "",
|
|
25
|
-
};
|
|
25
|
+
export const AnnouncementExample: StoryObj<typeof LinkBlock> = {};
|
|
26
26
|
|
|
27
|
-
export const
|
|
28
|
-
|
|
29
|
-
export const LinkList: StoryFn<typeof LinkBlock> = () => (
|
|
27
|
+
export const LinkList: StoryFn<typeof LinkBlock> = (args) => (
|
|
30
28
|
<LinkBlockSection>
|
|
31
29
|
<LinkBlock {...args} />
|
|
32
30
|
<LinkBlock {...args} />
|
|
@@ -10,69 +10,64 @@ import { format } from "date-fns";
|
|
|
10
10
|
import { enGB, nb, nn } from "date-fns/locale";
|
|
11
11
|
import parse from "html-react-parser";
|
|
12
12
|
import { useMemo } from "react";
|
|
13
|
-
import styled from "@emotion/styled";
|
|
14
|
-
import { breakpoints, colors, spacing, mq } from "@ndla/core";
|
|
15
13
|
import { Forward, CalendarEd } from "@ndla/icons/common";
|
|
14
|
+
import { Heading } from "@ndla/primitives";
|
|
16
15
|
import { SafeLink } from "@ndla/safelink";
|
|
16
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
17
17
|
import { LinkBlockEmbedData } from "@ndla/types-embed";
|
|
18
|
-
import { Heading } from "@ndla/typography";
|
|
19
18
|
import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
|
|
20
19
|
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const InfoWrapper = styled("div", {
|
|
21
|
+
base: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "column",
|
|
24
|
+
gap: "xsmall",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const StyledSafeLink = styled(SafeLink, {
|
|
29
|
+
base: {
|
|
30
|
+
display: "flex",
|
|
31
|
+
justifyContent: "space-between",
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
background: "surface.default",
|
|
34
|
+
padding: "medium",
|
|
35
|
+
border: "1px solid",
|
|
36
|
+
// TODO: Check if this is correct. Not part of design. Also check if this should have border-radius.
|
|
37
|
+
borderColor: "stroke.default",
|
|
38
|
+
"& h3": {
|
|
39
|
+
textDecoration: "underline",
|
|
40
|
+
},
|
|
41
|
+
"& [data-forward]": {
|
|
42
|
+
transitionProperty: "width, height",
|
|
43
|
+
transitionTimingFunction: "ease-in-out",
|
|
44
|
+
transitionDuration: "fast",
|
|
45
|
+
},
|
|
46
|
+
_hover: {
|
|
47
|
+
"& h3": {
|
|
48
|
+
textDecoration: "none",
|
|
49
|
+
},
|
|
50
|
+
"& [data-forward]": {
|
|
51
|
+
width: "large",
|
|
52
|
+
height: "large",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
32
57
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
border: 1px solid ${colors.brand.lighter};
|
|
41
|
-
padding: ${spacing.normal};
|
|
42
|
-
${mq.range({ from: breakpoints.tabletWide })} {
|
|
43
|
-
&:hover {
|
|
44
|
-
& ${InfoWrapper} :first-child {
|
|
45
|
-
text-decoration: underline;
|
|
46
|
-
}
|
|
47
|
-
& ${StyledForward} {
|
|
48
|
-
width: 32px;
|
|
49
|
-
height: 32px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
&:focus-visible {
|
|
53
|
-
border: 2px solid ${colors.brand.dark};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
${mq.range({ until: breakpoints.tabletWide })} {
|
|
57
|
-
& ${InfoWrapper} :first-child {
|
|
58
|
-
text-decoration: underline;
|
|
59
|
-
}
|
|
60
|
-
:active :first-child {
|
|
61
|
-
text-decoration: none;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
58
|
+
const StyledDateContainer = styled("div", {
|
|
59
|
+
base: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
gap: "xxsmall",
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
65
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
`;
|
|
72
|
-
|
|
73
|
-
const StyledCalenderEd = styled(CalendarEd)`
|
|
74
|
-
color: ${colors.icon.iconBlue};
|
|
75
|
-
`;
|
|
66
|
+
const StyledCalendarEd = styled(CalendarEd, {
|
|
67
|
+
base: {
|
|
68
|
+
color: "icon.strong",
|
|
69
|
+
},
|
|
70
|
+
});
|
|
76
71
|
|
|
77
72
|
interface Props extends Omit<LinkBlockEmbedData, "resource"> {
|
|
78
73
|
path?: string;
|
|
@@ -89,17 +84,17 @@ const LinkBlock = ({ title, articleLanguage, date, url, path }: Props) => {
|
|
|
89
84
|
return (
|
|
90
85
|
<StyledSafeLink to={href}>
|
|
91
86
|
<InfoWrapper>
|
|
92
|
-
<Heading
|
|
93
|
-
{parse(title)}
|
|
87
|
+
<Heading asChild consumeCss textStyle="title.medium">
|
|
88
|
+
<h3 data-heading>{parse(title)}</h3>
|
|
94
89
|
</Heading>
|
|
95
90
|
{date && (
|
|
96
91
|
<StyledDateContainer>
|
|
97
|
-
<
|
|
92
|
+
<StyledCalendarEd />
|
|
98
93
|
{formattedDate}
|
|
99
94
|
</StyledDateContainer>
|
|
100
95
|
)}
|
|
101
96
|
</InfoWrapper>
|
|
102
|
-
<
|
|
97
|
+
<Forward data-forward />
|
|
103
98
|
</StyledSafeLink>
|
|
104
99
|
);
|
|
105
100
|
};
|
|
@@ -7,23 +7,20 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { Children, HTMLAttributes, ReactNode } from "react";
|
|
10
|
-
import styled from "@
|
|
11
|
-
import { spacing } from "@ndla/core";
|
|
10
|
+
import { styled } from "@ndla/styled-system/jsx";
|
|
12
11
|
|
|
13
12
|
interface Props extends HTMLAttributes<HTMLElement> {
|
|
14
13
|
children: ReactNode;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const StyledList = styled
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
`;
|
|
16
|
+
const StyledList = styled("ul", {
|
|
17
|
+
base: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: "column",
|
|
20
|
+
gap: "xsmall",
|
|
21
|
+
listStyle: "none",
|
|
22
|
+
},
|
|
23
|
+
});
|
|
27
24
|
|
|
28
25
|
const LinkBlockSection = ({ children, ...rest }: Props) => {
|
|
29
26
|
return (
|
package/src/Logo/Logo.tsx
CHANGED
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/** @jsxImportSource @emotion/react */
|
|
10
|
-
import { useMemo } from "react";
|
|
11
|
-
import { SerializedStyles, css } from "@emotion/react";
|
|
12
9
|
import styled from "@emotion/styled";
|
|
13
|
-
import { colors } from "@ndla/core";
|
|
14
10
|
import { SafeLink } from "@ndla/safelink";
|
|
15
11
|
import SvgLogo from "./SvgLogo";
|
|
16
12
|
|
|
@@ -24,8 +20,6 @@ interface Props {
|
|
|
24
20
|
};
|
|
25
21
|
label: string;
|
|
26
22
|
locale?: string;
|
|
27
|
-
cssModifier?: string;
|
|
28
|
-
large?: boolean;
|
|
29
23
|
name?: boolean;
|
|
30
24
|
color?: string;
|
|
31
25
|
}
|
|
@@ -39,29 +33,7 @@ const StyledLogoWrapper = styled.div`
|
|
|
39
33
|
position: relative;
|
|
40
34
|
`;
|
|
41
35
|
|
|
42
|
-
const
|
|
43
|
-
large: css`
|
|
44
|
-
width: 287px;
|
|
45
|
-
`,
|
|
46
|
-
white: css`
|
|
47
|
-
svg {
|
|
48
|
-
fill: ${colors.white};
|
|
49
|
-
}
|
|
50
|
-
`,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const Logo = ({ name = true, to, cssModifier, color, large = false, locale, label }: Props) => {
|
|
54
|
-
const modifiers = useMemo(() => {
|
|
55
|
-
const mods = [];
|
|
56
|
-
if (large) {
|
|
57
|
-
mods.push(modifierStyles.large);
|
|
58
|
-
}
|
|
59
|
-
if (cssModifier && modifierStyles[cssModifier]) {
|
|
60
|
-
mods.push(modifierStyles[cssModifier]);
|
|
61
|
-
}
|
|
62
|
-
return mods;
|
|
63
|
-
}, [large, cssModifier]);
|
|
64
|
-
|
|
36
|
+
export const Logo = ({ name = true, to, color, locale, label }: Props) => {
|
|
65
37
|
const logo = to ? (
|
|
66
38
|
<SafeLink to={to} aria-label={label} title={label}>
|
|
67
39
|
<SvgLogo name={name} color={color} locale={locale} />
|
|
@@ -69,7 +41,7 @@ export const Logo = ({ name = true, to, cssModifier, color, large = false, local
|
|
|
69
41
|
) : (
|
|
70
42
|
<SvgLogo name={name} color={color} locale={locale} />
|
|
71
43
|
);
|
|
72
|
-
return <StyledLogoWrapper
|
|
44
|
+
return <StyledLogoWrapper>{logo}</StyledLogoWrapper>;
|
|
73
45
|
};
|
|
74
46
|
|
|
75
47
|
export default Logo;
|