@ndla/ui 56.0.123-alpha.0 → 56.0.124-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/es/Article/Article.js +122 -194
- package/es/Article/Article.js.map +1 -0
- package/es/Article/ArticleByline.js +121 -170
- package/es/Article/ArticleByline.js.map +1 -0
- package/es/Article/ArticleFootNotes.js +38 -58
- package/es/Article/ArticleFootNotes.js.map +1 -0
- package/es/AudioPlayer/AudioPlayer.js +151 -212
- package/es/AudioPlayer/AudioPlayer.js.map +1 -0
- package/es/AudioPlayer/Controls.js +246 -324
- package/es/AudioPlayer/Controls.js.map +1 -0
- package/es/AudioPlayer/SpeechControl.js +36 -52
- package/es/AudioPlayer/SpeechControl.js.map +1 -0
- package/es/AudioPlayer/index.js +7 -9
- package/es/AudioPlayer/index.js.map +1 -0
- package/es/Breadcrumb/Breadcrumb.js +42 -58
- package/es/Breadcrumb/Breadcrumb.js.map +1 -0
- package/es/Breadcrumb/BreadcrumbItem.js +33 -59
- package/es/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/es/Breadcrumb/HomeBreadcrumb.js +41 -74
- package/es/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/es/Breadcrumb/index.js +8 -10
- package/es/Breadcrumb/index.js.map +1 -0
- package/es/CampaignBlock/CampaignBlock.js +124 -173
- package/es/CampaignBlock/CampaignBlock.js.map +1 -0
- package/es/CodeBlock/CodeBlock.js +21 -31
- package/es/CodeBlock/CodeBlock.js.map +1 -0
- package/es/CodeBlock/codeLanguageOptions.js +112 -82
- package/es/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/es/Concept/Concept.js +46 -68
- package/es/Concept/Concept.js.map +1 -0
- package/es/ContactBlock/ContactBlock.js +137 -191
- package/es/ContactBlock/ContactBlock.js.map +1 -0
- package/es/ContentTypeBadge/ContentTypeBadge.js +38 -47
- package/es/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +21 -28
- package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +21 -28
- package/es/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/es/ContentTypeHero/ContentTypeHero.js +36 -47
- package/es/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/es/CopyParagraphButton/CopyParagraphButton.js +57 -78
- package/es/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/es/CopyParagraphButton/index.js +7 -10
- package/es/CopyParagraphButton/index.js.map +1 -0
- package/es/Embed/AudioEmbed.js +49 -73
- package/es/Embed/AudioEmbed.js.map +1 -0
- package/es/Embed/BrightcoveEmbed.js +90 -127
- package/es/Embed/BrightcoveEmbed.js.map +1 -0
- package/es/Embed/CodeEmbed.js +55 -73
- package/es/Embed/CodeEmbed.js.map +1 -0
- package/es/Embed/ConceptEmbed.js +72 -117
- package/es/Embed/ConceptEmbed.js.map +1 -0
- package/es/Embed/ConceptInlineTriggerButton.js +39 -44
- package/es/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/es/Embed/ContentLinkEmbed.js +29 -49
- package/es/Embed/ContentLinkEmbed.js.map +1 -0
- package/es/Embed/CopyrightEmbed.js +21 -31
- package/es/Embed/CopyrightEmbed.js.map +1 -0
- package/es/Embed/EmbedErrorPlaceholder.js +40 -55
- package/es/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/es/Embed/EmbedWrapper.js +21 -46
- package/es/Embed/EmbedWrapper.js.map +1 -0
- package/es/Embed/ExternalEmbed.js +50 -70
- package/es/Embed/ExternalEmbed.js.map +1 -0
- package/es/Embed/FootnoteEmbed.js +25 -42
- package/es/Embed/FootnoteEmbed.js.map +1 -0
- package/es/Embed/GlossEmbed.js +49 -77
- package/es/Embed/GlossEmbed.js.map +1 -0
- package/es/Embed/H5pEmbed.js +35 -58
- package/es/Embed/H5pEmbed.js.map +1 -0
- package/es/Embed/IframeEmbed.js +65 -89
- package/es/Embed/IframeEmbed.js.map +1 -0
- package/es/Embed/ImageEmbed.js +167 -225
- package/es/Embed/ImageEmbed.js.map +1 -0
- package/es/Embed/InlineTriggerButton.js +20 -32
- package/es/Embed/InlineTriggerButton.js.map +1 -0
- package/es/Embed/RelatedContentEmbed.js +36 -53
- package/es/Embed/RelatedContentEmbed.js.map +1 -0
- package/es/Embed/UnknownEmbed.js +18 -29
- package/es/Embed/UnknownEmbed.js.map +1 -0
- package/es/Embed/UuDisclaimerEmbed.js +51 -85
- package/es/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/es/ErrorMessage/ErrorMessage.js +51 -92
- package/es/ErrorMessage/ErrorMessage.js.map +1 -0
- package/es/ErrorMessage/index.js +7 -9
- package/es/ErrorMessage/index.js.map +1 -0
- package/es/FactBox/FactBox.js +114 -170
- package/es/FactBox/FactBox.js.map +1 -0
- package/es/FactBox/index.js +7 -9
- package/es/FactBox/index.js.map +1 -0
- package/es/FileList/File.js +70 -95
- package/es/FileList/File.js.map +1 -0
- package/es/FileList/FileList.js +31 -46
- package/es/FileList/FileList.js.map +1 -0
- package/es/FileList/PdfFile.js +27 -49
- package/es/FileList/PdfFile.js.map +1 -0
- package/es/Gloss/Gloss.js +133 -166
- package/es/Gloss/Gloss.js.map +1 -0
- package/es/Gloss/GlossExample.js +42 -60
- package/es/Gloss/GlossExample.js.map +1 -0
- package/es/Grid/Grid.js +63 -91
- package/es/Grid/Grid.js.map +1 -0
- package/es/Grid/GridParallaxItem.js +19 -30
- package/es/Grid/GridParallaxItem.js.map +1 -0
- package/es/KeyFigure/KeyFigure.js +44 -61
- package/es/KeyFigure/KeyFigure.js.map +1 -0
- package/es/LicenseByline/EmbedByline.js +126 -206
- package/es/LicenseByline/EmbedByline.js.map +1 -0
- package/es/LicenseByline/LicenseLink.js +28 -53
- package/es/LicenseByline/LicenseLink.js.map +1 -0
- package/es/LinkBlock/LinkBlock.js +70 -99
- package/es/LinkBlock/LinkBlock.js.map +1 -0
- package/es/LinkBlock/LinkBlockSection.js +20 -32
- package/es/LinkBlock/LinkBlockSection.js.map +1 -0
- package/es/Pitch/Pitch.js +59 -80
- package/es/Pitch/Pitch.js.map +1 -0
- package/es/RelatedArticleList/RelatedArticleList.js +91 -129
- package/es/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/es/RelatedArticleList/index.js +7 -10
- package/es/RelatedArticleList/index.js.map +1 -0
- package/es/ResourceBox/ResourceBox.js +71 -96
- package/es/ResourceBox/ResourceBox.js.map +1 -0
- package/es/TagSelector/TagSelector.js +93 -136
- package/es/TagSelector/TagSelector.js.map +1 -0
- package/es/ZendeskButton/ZendeskButton.js +38 -52
- package/es/ZendeskButton/ZendeskButton.js.map +1 -0
- package/es/_virtual/rolldown_runtime.js +11 -0
- package/es/i18n/formatNestedMessages.js +16 -24
- package/es/i18n/formatNestedMessages.js.map +1 -0
- package/es/i18n/i18n.js +25 -31
- package/es/i18n/i18n.js.map +1 -0
- package/es/i18n/useComponentTranslations.js +147 -203
- package/es/i18n/useComponentTranslations.js.map +1 -0
- package/es/index.js +64 -44
- package/es/locale/messages-en.js +435 -459
- package/es/locale/messages-en.js.map +1 -0
- package/es/locale/messages-nb.js +435 -459
- package/es/locale/messages-nb.js.map +1 -0
- package/es/locale/messages-nn.js +435 -459
- package/es/locale/messages-nn.js.map +1 -0
- package/es/locale/messages-se.js +435 -459
- package/es/locale/messages-se.js.map +1 -0
- package/es/model/ContentType.js +69 -65
- package/es/model/ContentType.js.map +1 -0
- package/es/model/SubjectCategories.js +23 -10
- package/es/model/SubjectCategories.js.map +1 -0
- package/es/model/SubjectTypes.js +21 -9
- package/es/model/SubjectTypes.js.map +1 -0
- package/es/model/WordClass.js +51 -43
- package/es/model/WordClass.js.map +1 -0
- package/es/model/index.js +16 -18
- package/es/model/index.js.map +1 -0
- package/es/utils/licenseAttributes.js +15 -17
- package/es/utils/licenseAttributes.js.map +1 -0
- package/es/utils/relativeUrl.js +21 -32
- package/es/utils/relativeUrl.js.map +1 -0
- package/lib/Article/Article.js +130 -203
- package/lib/Article/Article.js.map +1 -0
- package/lib/Article/ArticleByline.js +125 -179
- package/lib/Article/ArticleByline.js.map +1 -0
- package/lib/Article/ArticleFootNotes.js +39 -65
- package/lib/Article/ArticleFootNotes.js.map +1 -0
- package/lib/AudioPlayer/AudioPlayer.js +155 -221
- package/lib/AudioPlayer/AudioPlayer.js.map +1 -0
- package/lib/AudioPlayer/Controls.js +249 -332
- package/lib/AudioPlayer/Controls.js.map +1 -0
- package/lib/AudioPlayer/SpeechControl.js +39 -60
- package/lib/AudioPlayer/SpeechControl.js.map +1 -0
- package/lib/AudioPlayer/index.js +7 -15
- package/lib/AudioPlayer/index.js.map +1 -0
- package/lib/Breadcrumb/Breadcrumb.js +43 -65
- package/lib/Breadcrumb/Breadcrumb.js.map +1 -0
- package/lib/Breadcrumb/BreadcrumbItem.js +34 -65
- package/lib/Breadcrumb/BreadcrumbItem.js.map +1 -0
- package/lib/Breadcrumb/HomeBreadcrumb.js +43 -82
- package/lib/Breadcrumb/HomeBreadcrumb.js.map +1 -0
- package/lib/Breadcrumb/index.js +8 -22
- package/lib/Breadcrumb/index.js.map +1 -0
- package/lib/CampaignBlock/CampaignBlock.js +128 -183
- package/lib/CampaignBlock/CampaignBlock.js.map +1 -0
- package/lib/CodeBlock/CodeBlock.js +23 -38
- package/lib/CodeBlock/CodeBlock.js.map +1 -0
- package/lib/CodeBlock/codeLanguageOptions.js +112 -87
- package/lib/CodeBlock/codeLanguageOptions.js.map +1 -0
- package/lib/Concept/Concept.js +48 -75
- package/lib/Concept/Concept.js.map +1 -0
- package/lib/ContactBlock/ContactBlock.js +141 -200
- package/lib/ContactBlock/ContactBlock.js.map +1 -0
- package/lib/ContentTypeBadge/ContentTypeBadge.js +40 -54
- package/lib/ContentTypeBadge/ContentTypeBadge.js.map +1 -0
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +23 -35
- package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js.map +1 -0
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +23 -35
- package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js.map +1 -0
- package/lib/ContentTypeHero/ContentTypeHero.js +37 -54
- package/lib/ContentTypeHero/ContentTypeHero.js.map +1 -0
- package/lib/CopyParagraphButton/CopyParagraphButton.js +61 -87
- package/lib/CopyParagraphButton/CopyParagraphButton.js.map +1 -0
- package/lib/CopyParagraphButton/index.js +7 -21
- package/lib/CopyParagraphButton/index.js.map +1 -0
- package/lib/Embed/AudioEmbed.js +51 -82
- package/lib/Embed/AudioEmbed.js.map +1 -0
- package/lib/Embed/BrightcoveEmbed.js +93 -138
- package/lib/Embed/BrightcoveEmbed.js.map +1 -0
- package/lib/Embed/CodeEmbed.js +59 -83
- package/lib/Embed/CodeEmbed.js.map +1 -0
- package/lib/Embed/ConceptEmbed.js +77 -127
- package/lib/Embed/ConceptEmbed.js.map +1 -0
- package/lib/Embed/ConceptInlineTriggerButton.js +39 -49
- package/lib/Embed/ConceptInlineTriggerButton.js.map +1 -0
- package/lib/Embed/ContentLinkEmbed.js +30 -55
- package/lib/Embed/ContentLinkEmbed.js.map +1 -0
- package/lib/Embed/CopyrightEmbed.js +22 -37
- package/lib/Embed/CopyrightEmbed.js.map +1 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +42 -62
- package/lib/Embed/EmbedErrorPlaceholder.js.map +1 -0
- package/lib/Embed/EmbedWrapper.js +24 -54
- package/lib/Embed/EmbedWrapper.js.map +1 -0
- package/lib/Embed/ExternalEmbed.js +53 -79
- package/lib/Embed/ExternalEmbed.js.map +1 -0
- package/lib/Embed/FootnoteEmbed.js +26 -48
- package/lib/Embed/FootnoteEmbed.js.map +1 -0
- package/lib/Embed/GlossEmbed.js +51 -86
- package/lib/Embed/GlossEmbed.js.map +1 -0
- package/lib/Embed/H5pEmbed.js +37 -66
- package/lib/Embed/H5pEmbed.js.map +1 -0
- package/lib/Embed/IframeEmbed.js +68 -98
- package/lib/Embed/IframeEmbed.js.map +1 -0
- package/lib/Embed/ImageEmbed.js +173 -238
- package/lib/Embed/ImageEmbed.js.map +1 -0
- package/lib/Embed/InlineTriggerButton.js +23 -40
- package/lib/Embed/InlineTriggerButton.js.map +1 -0
- package/lib/Embed/RelatedContentEmbed.js +37 -59
- package/lib/Embed/RelatedContentEmbed.js.map +1 -0
- package/lib/Embed/UnknownEmbed.js +19 -35
- package/lib/Embed/UnknownEmbed.js.map +1 -0
- package/lib/Embed/UuDisclaimerEmbed.js +53 -92
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -0
- package/lib/ErrorMessage/ErrorMessage.js +53 -99
- package/lib/ErrorMessage/ErrorMessage.js.map +1 -0
- package/lib/ErrorMessage/index.js +7 -15
- package/lib/ErrorMessage/index.js.map +1 -0
- package/lib/FactBox/FactBox.js +118 -180
- package/lib/FactBox/FactBox.js.map +1 -0
- package/lib/FactBox/index.js +7 -15
- package/lib/FactBox/index.js.map +1 -0
- package/lib/FileList/File.js +75 -105
- package/lib/FileList/File.js.map +1 -0
- package/lib/FileList/FileList.js +33 -52
- package/lib/FileList/FileList.js.map +1 -0
- package/lib/FileList/PdfFile.js +27 -55
- package/lib/FileList/PdfFile.js.map +1 -0
- package/lib/Gloss/Gloss.js +138 -176
- package/lib/Gloss/Gloss.js.map +1 -0
- package/lib/Gloss/GlossExample.js +45 -68
- package/lib/Gloss/GlossExample.js.map +1 -0
- package/lib/Grid/Grid.js +64 -98
- package/lib/Grid/Grid.js.map +1 -0
- package/lib/Grid/GridParallaxItem.js +19 -36
- package/lib/Grid/GridParallaxItem.js.map +1 -0
- package/lib/KeyFigure/KeyFigure.js +45 -68
- package/lib/KeyFigure/KeyFigure.js.map +1 -0
- package/lib/LicenseByline/EmbedByline.js +130 -216
- package/lib/LicenseByline/EmbedByline.js.map +1 -0
- package/lib/LicenseByline/LicenseLink.js +29 -59
- package/lib/LicenseByline/LicenseLink.js.map +1 -0
- package/lib/LinkBlock/LinkBlock.js +73 -108
- package/lib/LinkBlock/LinkBlock.js.map +1 -0
- package/lib/LinkBlock/LinkBlockSection.js +22 -39
- package/lib/LinkBlock/LinkBlockSection.js.map +1 -0
- package/lib/Pitch/Pitch.js +61 -89
- package/lib/Pitch/Pitch.js.map +1 -0
- package/lib/RelatedArticleList/RelatedArticleList.js +96 -140
- package/lib/RelatedArticleList/RelatedArticleList.js.map +1 -0
- package/lib/RelatedArticleList/index.js +7 -20
- package/lib/RelatedArticleList/index.js.map +1 -0
- package/lib/ResourceBox/ResourceBox.js +73 -104
- package/lib/ResourceBox/ResourceBox.js.map +1 -0
- package/lib/TagSelector/TagSelector.js +103 -145
- package/lib/TagSelector/TagSelector.js.map +1 -0
- package/lib/ZendeskButton/ZendeskButton.js +39 -58
- package/lib/ZendeskButton/ZendeskButton.js.map +1 -0
- package/lib/_virtual/rolldown_runtime.js +42 -0
- package/lib/i18n/formatNestedMessages.js +16 -30
- package/lib/i18n/formatNestedMessages.js.map +1 -0
- package/lib/i18n/i18n.js +28 -38
- package/lib/i18n/i18n.js.map +1 -0
- package/lib/i18n/useComponentTranslations.js +154 -215
- package/lib/i18n/useComponentTranslations.js.map +1 -0
- package/lib/index.js +156 -598
- package/lib/locale/messages-en.js +436 -466
- package/lib/locale/messages-en.js.map +1 -0
- package/lib/locale/messages-nb.js +436 -466
- package/lib/locale/messages-nb.js.map +1 -0
- package/lib/locale/messages-nn.js +436 -466
- package/lib/locale/messages-nn.js.map +1 -0
- package/lib/locale/messages-se.js +436 -466
- package/lib/locale/messages-se.js.map +1 -0
- package/lib/model/ContentType.js +90 -70
- package/lib/model/ContentType.js.map +1 -0
- package/lib/model/SubjectCategories.js +26 -14
- package/lib/model/SubjectCategories.js.map +1 -0
- package/lib/model/SubjectTypes.js +24 -13
- package/lib/model/SubjectTypes.js.map +1 -0
- package/lib/model/WordClass.js +55 -48
- package/lib/model/WordClass.js.map +1 -0
- package/lib/model/index.js +16 -25
- package/lib/model/index.js.map +1 -0
- package/lib/utils/licenseAttributes.js +14 -22
- package/lib/utils/licenseAttributes.js.map +1 -0
- package/lib/utils/relativeUrl.js +20 -38
- package/lib/utils/relativeUrl.js.map +1 -0
- package/package.json +12 -11
- package/es/Article/index.js +0 -11
- package/es/CampaignBlock/index.js +0 -9
- package/es/CodeBlock/index.js +0 -10
- package/es/ContactBlock/index.js +0 -9
- package/es/ContentTypeHero/index.js +0 -9
- package/es/Embed/index.js +0 -25
- package/es/Embed/types.js +0 -1
- package/es/FileList/index.js +0 -11
- package/es/Gloss/index.js +0 -10
- package/es/Grid/index.js +0 -10
- package/es/KeyFigure/index.js +0 -9
- package/es/LicenseByline/index.js +0 -10
- package/es/LinkBlock/index.js +0 -10
- package/es/Pitch/index.js +0 -9
- package/es/ResourceBox/index.js +0 -10
- package/es/i18n/index.js +0 -11
- package/es/types.js +0 -1
- package/lib/Article/index.js +0 -68
- package/lib/CampaignBlock/index.js +0 -13
- package/lib/CodeBlock/index.js +0 -20
- package/lib/ContactBlock/index.js +0 -18
- package/lib/ContentTypeHero/index.js +0 -12
- package/lib/Embed/index.js +0 -150
- package/lib/Embed/types.js +0 -5
- package/lib/FileList/index.js +0 -44
- package/lib/Gloss/index.js +0 -20
- package/lib/Grid/index.js +0 -19
- package/lib/KeyFigure/index.js +0 -13
- package/lib/LicenseByline/index.js +0 -19
- package/lib/LinkBlock/index.js +0 -20
- package/lib/Pitch/index.js +0 -12
- package/lib/ResourceBox/index.js +0 -13
- package/lib/i18n/index.js +0 -68
- package/lib/types.js +0 -5
|
@@ -1,143 +1,99 @@
|
|
|
1
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_ContentType = require('../model/ContentType.js');
|
|
3
|
+
const require_ContentTypeBadge = require('../ContentTypeBadge/ContentTypeBadge.js');
|
|
4
|
+
const react = require_rolldown_runtime.__toESM(require("react"));
|
|
5
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
6
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
7
|
+
const react_i18next = require_rolldown_runtime.__toESM(require("react-i18next"));
|
|
8
|
+
const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
|
|
9
|
+
const __ndla_safelink = require_rolldown_runtime.__toESM(require("@ndla/safelink"));
|
|
10
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
11
|
+
const __ndla_styled_system_patterns = require_rolldown_runtime.__toESM(require("@ndla/styled-system/patterns"));
|
|
2
12
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
title,
|
|
34
|
-
introduction,
|
|
35
|
-
to,
|
|
36
|
-
linkInfo = "",
|
|
37
|
-
target = "",
|
|
38
|
-
type = _ContentType.contentTypes.SUBJECT_MATERIAL
|
|
39
|
-
} = _ref;
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.CardRoot, {
|
|
41
|
-
"data-embed-type": "related-article",
|
|
42
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.CardContent, {
|
|
43
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ContentTypeBadge.ContentTypeBadge, {
|
|
44
|
-
contentType: type
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.CardHeading, {
|
|
46
|
-
asChild: true,
|
|
47
|
-
consumeCss: true,
|
|
48
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
49
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
|
|
50
|
-
unstyled: true,
|
|
51
|
-
to: to,
|
|
52
|
-
target: target,
|
|
53
|
-
rel: linkInfo ? "noopener noreferrer" : undefined,
|
|
54
|
-
css: _patterns.linkOverlay.raw(),
|
|
55
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSpan, {
|
|
56
|
-
children: [title, target === "_blank" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ExternalLinkLine, {})]
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
61
|
-
dangerouslySetInnerHTML: {
|
|
62
|
-
__html: introduction
|
|
63
|
-
}
|
|
64
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
65
|
-
color: "text.subtle",
|
|
66
|
-
textStyle: "label.small",
|
|
67
|
-
children: linkInfo
|
|
68
|
-
})]
|
|
69
|
-
})
|
|
70
|
-
});
|
|
13
|
+
//#region src/RelatedArticleList/RelatedArticleList.tsx
|
|
14
|
+
const StyledSpan = (0, __ndla_styled_system_jsx.styled)("span", { base: {
|
|
15
|
+
display: "flex",
|
|
16
|
+
gap: "3xsmall"
|
|
17
|
+
} });
|
|
18
|
+
const RelatedArticle = ({ title, introduction, to, linkInfo = "", target = "", type = require_ContentType.contentTypes.SUBJECT_MATERIAL }) => {
|
|
19
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.CardRoot, {
|
|
20
|
+
"data-embed-type": "related-article",
|
|
21
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_primitives.CardContent, { children: [
|
|
22
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ContentTypeBadge.ContentTypeBadge, { contentType: type }),
|
|
23
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.CardHeading, {
|
|
24
|
+
asChild: true,
|
|
25
|
+
consumeCss: true,
|
|
26
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_safelink.SafeLink, {
|
|
27
|
+
unstyled: true,
|
|
28
|
+
to,
|
|
29
|
+
target,
|
|
30
|
+
rel: linkInfo ? "noopener noreferrer" : void 0,
|
|
31
|
+
css: __ndla_styled_system_patterns.linkOverlay.raw(),
|
|
32
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSpan, { children: [title, target === "_blank" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ExternalLinkLine, {})] })
|
|
33
|
+
}) })
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, { dangerouslySetInnerHTML: { __html: introduction } }),
|
|
36
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Text, {
|
|
37
|
+
color: "text.subtle",
|
|
38
|
+
textStyle: "label.small",
|
|
39
|
+
children: linkInfo
|
|
40
|
+
})
|
|
41
|
+
] })
|
|
42
|
+
});
|
|
71
43
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
...rest,
|
|
123
|
-
"data-embed-type": "related-content-list",
|
|
124
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(HeadingWrapper, {
|
|
125
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
126
|
-
asChild: true,
|
|
127
|
-
consumeCss: true,
|
|
128
|
-
textStyle: "title.large",
|
|
129
|
-
fontWeight: "bold",
|
|
130
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HeadingElement, {
|
|
131
|
-
children: t("related.title")
|
|
132
|
-
})
|
|
133
|
-
}), headingButtons]
|
|
134
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ArticlesWrapper, {
|
|
135
|
-
children: childrenToShow
|
|
136
|
-
}), childCount > 2 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledButton, {
|
|
137
|
-
variant: "secondary",
|
|
138
|
-
onClick: () => setExpanded(p => !p),
|
|
139
|
-
children: t(`related.show${expanded ? "Less" : "More"}`)
|
|
140
|
-
}) : null]
|
|
141
|
-
});
|
|
44
|
+
const HeadingWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
45
|
+
display: "flex",
|
|
46
|
+
width: "100%",
|
|
47
|
+
justifyContent: "space-between",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
alignSelf: "flex-start"
|
|
50
|
+
} });
|
|
51
|
+
const ArticlesWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
52
|
+
display: "grid",
|
|
53
|
+
width: "100%",
|
|
54
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
55
|
+
gap: "medium",
|
|
56
|
+
tabletDown: { gridTemplateColumns: "1fr" }
|
|
57
|
+
} });
|
|
58
|
+
const StyledSection = (0, __ndla_styled_system_jsx.styled)("section", { base: {
|
|
59
|
+
display: "flex",
|
|
60
|
+
flexDirection: "column",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
gap: "medium",
|
|
63
|
+
clear: "both"
|
|
64
|
+
} });
|
|
65
|
+
const StyledButton = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Button, { base: { marginBlockStart: "xsmall" } });
|
|
66
|
+
const RelatedArticleList = ({ children = [], articleCount, headingLevel: HeadingElement = "h2", headingButtons,...rest }) => {
|
|
67
|
+
const [expanded, setExpanded] = (0, react.useState)(false);
|
|
68
|
+
const { t } = (0, react_i18next.useTranslation)();
|
|
69
|
+
const childCount = (0, react.useMemo)(() => articleCount ?? react.Children.count(children), [children, articleCount]);
|
|
70
|
+
const childrenToShow = (0, react.useMemo)(() => childCount > 2 && !expanded ? children?.slice(0, 2) : children, [
|
|
71
|
+
childCount,
|
|
72
|
+
children,
|
|
73
|
+
expanded
|
|
74
|
+
]);
|
|
75
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSection, {
|
|
76
|
+
...rest,
|
|
77
|
+
"data-embed-type": "related-content-list",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(HeadingWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Heading, {
|
|
80
|
+
asChild: true,
|
|
81
|
+
consumeCss: true,
|
|
82
|
+
textStyle: "title.large",
|
|
83
|
+
fontWeight: "bold",
|
|
84
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeadingElement, { children: t("related.title") })
|
|
85
|
+
}), headingButtons] }),
|
|
86
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArticlesWrapper, { children: childrenToShow }),
|
|
87
|
+
childCount > 2 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledButton, {
|
|
88
|
+
variant: "secondary",
|
|
89
|
+
onClick: () => setExpanded((p) => !p),
|
|
90
|
+
children: t(`related.show${expanded ? "Less" : "More"}`)
|
|
91
|
+
}) : null
|
|
92
|
+
]
|
|
93
|
+
});
|
|
142
94
|
};
|
|
143
|
-
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
exports.RelatedArticle = RelatedArticle;
|
|
98
|
+
exports.RelatedArticleList = RelatedArticleList;
|
|
99
|
+
//# sourceMappingURL=RelatedArticleList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelatedArticleList.js","names":["contentTypes","CardRoot","CardContent","ContentTypeBadge","CardHeading","SafeLink","ExternalLinkLine","Text","Button","Heading"],"sources":["../../src/RelatedArticleList/RelatedArticleList.tsx"],"sourcesContent":["/**\n * Copyright (c) 2023-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { Children, type ComponentPropsWithoutRef, type ReactElement, type ReactNode, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { ExternalLinkLine } from \"@ndla/icons\";\nimport { CardContent, CardHeading, CardRoot, Text, Heading, Button } from \"@ndla/primitives\";\nimport { SafeLink } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\nimport { linkOverlay } from \"@ndla/styled-system/patterns\";\nimport { ContentTypeBadge } from \"../ContentTypeBadge/ContentTypeBadge\";\nimport { contentTypes } from \"../model/ContentType\";\nimport type { HeadingLevel } from \"../types\";\n\ninterface RelatedArticleProps {\n title: string;\n introduction: string;\n to: string;\n linkInfo?: string;\n target?: string;\n type?: string;\n}\n\nconst StyledSpan = styled(\"span\", {\n base: {\n display: \"flex\",\n gap: \"3xsmall\",\n },\n});\n\nexport const RelatedArticle = ({\n title,\n introduction,\n to,\n linkInfo = \"\",\n target = \"\",\n type = contentTypes.SUBJECT_MATERIAL,\n}: RelatedArticleProps) => {\n return (\n <CardRoot data-embed-type=\"related-article\">\n <CardContent>\n <ContentTypeBadge contentType={type} />\n <CardHeading asChild consumeCss>\n <span>\n <SafeLink\n unstyled\n to={to}\n target={target}\n rel={linkInfo ? \"noopener noreferrer\" : undefined}\n css={linkOverlay.raw()}\n >\n <StyledSpan>\n {title}\n {target === \"_blank\" && <ExternalLinkLine />}\n </StyledSpan>\n </SafeLink>\n </span>\n </CardHeading>\n <Text dangerouslySetInnerHTML={{ __html: introduction }} />\n <Text color=\"text.subtle\" textStyle=\"label.small\">\n {linkInfo}\n </Text>\n </CardContent>\n </CardRoot>\n );\n};\n\nconst HeadingWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n width: \"100%\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n alignSelf: \"flex-start\",\n },\n});\n\nconst ArticlesWrapper = styled(\"div\", {\n base: {\n display: \"grid\",\n width: \"100%\",\n gridTemplateColumns: \"repeat(2, 1fr)\",\n gap: \"medium\",\n tabletDown: {\n gridTemplateColumns: \"1fr\",\n },\n },\n});\n\nconst StyledSection = styled(\"section\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: \"medium\",\n clear: \"both\",\n },\n});\n\nconst StyledButton = styled(Button, {\n base: {\n marginBlockStart: \"xsmall\",\n },\n});\n\ninterface Props extends ComponentPropsWithoutRef<\"section\"> {\n children?: ReactElement[];\n articleCount?: number;\n headingLevel?: HeadingLevel;\n headingButtons?: ReactNode;\n}\n\nexport const RelatedArticleList = ({\n children = [],\n articleCount,\n headingLevel: HeadingElement = \"h2\",\n headingButtons,\n ...rest\n}: Props) => {\n const [expanded, setExpanded] = useState(false);\n const { t } = useTranslation();\n const childCount = useMemo(() => articleCount ?? Children.count(children), [children, articleCount]);\n const childrenToShow = useMemo(\n () => (childCount > 2 && !expanded ? children?.slice(0, 2) : children),\n [childCount, children, expanded],\n );\n\n return (\n <StyledSection {...rest} data-embed-type=\"related-content-list\">\n <HeadingWrapper>\n <Heading asChild consumeCss textStyle=\"title.large\" fontWeight=\"bold\">\n <HeadingElement>{t(\"related.title\")}</HeadingElement>\n </Heading>\n {headingButtons}\n </HeadingWrapper>\n <ArticlesWrapper>{childrenToShow}</ArticlesWrapper>\n {childCount > 2 ? (\n <StyledButton variant=\"secondary\" onClick={() => setExpanded((p) => !p)}>\n {t(`related.show${expanded ? \"Less\" : \"More\"}`)}\n </StyledButton>\n ) : null}\n </StyledSection>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AA4BA,MAAM,aAAa,qCAAO,QAAQ,EAChC,MAAM;CACJ,SAAS;CACT,KAAK;AACN,EACF,EAAC;AAEF,MAAa,iBAAiB,CAAC,EAC7B,OACA,cACA,IACA,WAAW,IACX,SAAS,IACT,OAAOA,iCAAa,kBACA,KAAK;AACzB,wBACE,2BAACC;EAAS,mBAAgB;4BACxB,4BAACC;mBACC,2BAACC,6CAAiB,aAAa,OAAQ;mBACvC,2BAACC;IAAY;IAAQ;8BACnB,2BAAC,oCACC,2BAACC;KACC;KACI;KACI;KACR,KAAK,WAAW;KAChB,KAAK,0CAAY,KAAK;+BAEtB,4BAAC,yBACE,OACA,WAAW,4BAAY,2BAACC,kCAAmB,IACjC;MACJ,GACN;KACK;mBACd,2BAACC,0BAAK,yBAAyB,EAAE,QAAQ,aAAc,IAAI;mBAC3D,2BAACA;IAAK,OAAM;IAAc,WAAU;cACjC;KACI;MACK;GACL;AAEd;AAED,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,YAAY;CACZ,WAAW;AACZ,EACF,EAAC;AAEF,MAAM,kBAAkB,qCAAO,OAAO,EACpC,MAAM;CACJ,SAAS;CACT,OAAO;CACP,qBAAqB;CACrB,KAAK;CACL,YAAY,EACV,qBAAqB,MACtB;AACF,EACF,EAAC;AAEF,MAAM,gBAAgB,qCAAO,WAAW,EACtC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,KAAK;CACL,OAAO;AACR,EACF,EAAC;AAEF,MAAM,eAAe,qCAAOC,0BAAQ,EAClC,MAAM,EACJ,kBAAkB,SACnB,EACF,EAAC;AASF,MAAa,qBAAqB,CAAC,EACjC,WAAW,CAAE,GACb,cACA,cAAc,iBAAiB,MAC/B,eACA,GAAG,MACG,KAAK;CACX,MAAM,CAAC,UAAU,YAAY,GAAG,oBAAS,MAAM;CAC/C,MAAM,EAAE,GAAG,GAAG,mCAAgB;CAC9B,MAAM,aAAa,mBAAQ,MAAM,gBAAgB,eAAS,MAAM,SAAS,EAAE,CAAC,UAAU,YAAa,EAAC;CACpG,MAAM,iBAAiB,mBACrB,MAAO,aAAa,MAAM,WAAW,UAAU,MAAM,GAAG,EAAE,GAAG,UAC7D;EAAC;EAAY;EAAU;CAAS,EACjC;AAED,wBACE,4BAAC;EAAc,GAAI;EAAM,mBAAgB;;mBACvC,4BAAC,6CACC,2BAACC;IAAQ;IAAQ;IAAW,WAAU;IAAc,YAAW;8BAC7D,2BAAC,4BAAgB,EAAE,gBAAgB,GAAkB;KAC7C,EACT,kBACc;mBACjB,2BAAC,6BAAiB,iBAAiC;GAClD,aAAa,oBACZ,2BAAC;IAAa,SAAQ;IAAY,SAAS,MAAM,YAAY,CAAC,OAAO,EAAE;cACpE,GAAG,cAAc,WAAW,SAAS,OAAO,EAAE;KAClC,GACb;;GACU;AAEnB"}
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const require_RelatedArticleList = require('./RelatedArticleList.js');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return _RelatedArticleList.RelatedArticle;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
exports.default = void 0;
|
|
13
|
-
var _RelatedArticleList = require("./RelatedArticleList");
|
|
14
|
-
/**
|
|
15
|
-
* Copyright (c) 2017-present, NDLA.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the GPLv3 license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
var _default = exports.default = _RelatedArticleList.RelatedArticleList;
|
|
3
|
+
//#region src/RelatedArticleList/index.ts
|
|
4
|
+
var RelatedArticleList_default = require_RelatedArticleList.RelatedArticleList;
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.RelatedArticleList_default = RelatedArticleList_default;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["RelatedArticleList"],"sources":["../../src/RelatedArticleList/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2017-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { RelatedArticle, RelatedArticleList } from \"./RelatedArticleList\";\n\nexport { RelatedArticle };\n\nexport default RelatedArticleList;\n"],"mappings":";;;AAYA,iCAAeA"}
|
|
@@ -1,106 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const __ndla_primitives = require_rolldown_runtime.__toESM(require("@ndla/primitives"));
|
|
3
|
+
const __ndla_styled_system_jsx = require_rolldown_runtime.__toESM(require("@ndla/styled-system/jsx"));
|
|
4
|
+
const __ndla_icons = require_rolldown_runtime.__toESM(require("@ndla/icons"));
|
|
5
|
+
const __ndla_safelink = require_rolldown_runtime.__toESM(require("@ndla/safelink"));
|
|
6
|
+
const react_jsx_runtime = require_rolldown_runtime.__toESM(require("react/jsx-runtime"));
|
|
7
|
+
const __ndla_core = require_rolldown_runtime.__toESM(require("@ndla/core"));
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
const StyledText = (0, _jsx2.styled)(_primitives.Text, {
|
|
66
|
-
base: {
|
|
67
|
-
flex: "1"
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
const ResourceBox = _ref => {
|
|
71
|
-
let {
|
|
72
|
-
image,
|
|
73
|
-
title,
|
|
74
|
-
caption,
|
|
75
|
-
url,
|
|
76
|
-
buttonText
|
|
77
|
-
} = _ref;
|
|
78
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
79
|
-
children: [image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImage, {
|
|
80
|
-
src: image.src,
|
|
81
|
-
alt: image.alt,
|
|
82
|
-
sizes: `(min-width: ${_core.breakpoints.desktop}) 150px, (max-width: ${_core.breakpoints.tablet} ) 400px, 200px`,
|
|
83
|
-
variant: "rounded"
|
|
84
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
86
|
-
textStyle: "label.large",
|
|
87
|
-
fontWeight: "bold",
|
|
88
|
-
asChild: true,
|
|
89
|
-
consumeCss: true,
|
|
90
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
91
|
-
children: title
|
|
92
|
-
})
|
|
93
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, {
|
|
94
|
-
textStyle: "body.medium",
|
|
95
|
-
children: caption
|
|
96
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_safelink.SafeLinkButton, {
|
|
97
|
-
to: url,
|
|
98
|
-
target: "_blank",
|
|
99
|
-
variant: "secondary",
|
|
100
|
-
children: [buttonText, /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShareBoxLine, {})]
|
|
101
|
-
})]
|
|
102
|
-
})]
|
|
103
|
-
});
|
|
9
|
+
//#region src/ResourceBox/ResourceBox.tsx
|
|
10
|
+
const Container = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
padding: "medium",
|
|
13
|
+
borderRadius: "xsmall",
|
|
14
|
+
border: "1px solid",
|
|
15
|
+
borderColor: "stroke.default",
|
|
16
|
+
boxShadow: "full",
|
|
17
|
+
marginBlockEnd: "medium",
|
|
18
|
+
gap: "medium",
|
|
19
|
+
tabletWideDown: { padding: "xsmall" },
|
|
20
|
+
tabletDown: {
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
gap: "0",
|
|
23
|
+
padding: "0"
|
|
24
|
+
}
|
|
25
|
+
} });
|
|
26
|
+
const ContentWrapper = (0, __ndla_styled_system_jsx.styled)("div", { base: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
flexDirection: "column",
|
|
29
|
+
alignItems: "flex-start",
|
|
30
|
+
gap: "xsmall",
|
|
31
|
+
flex: "1",
|
|
32
|
+
tabletDown: { padding: "xsmall" }
|
|
33
|
+
} });
|
|
34
|
+
const StyledImage = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Image, { base: {
|
|
35
|
+
objectFit: "cover",
|
|
36
|
+
borderRadius: "xsmall",
|
|
37
|
+
width: "fit-content",
|
|
38
|
+
aspectRatio: "1/1",
|
|
39
|
+
tabletDown: {
|
|
40
|
+
width: "100%",
|
|
41
|
+
borderRadius: "0"
|
|
42
|
+
}
|
|
43
|
+
} });
|
|
44
|
+
const StyledText = (0, __ndla_styled_system_jsx.styled)(__ndla_primitives.Text, { base: { flex: "1" } });
|
|
45
|
+
const ResourceBox = ({ image, title, caption, url, buttonText }) => {
|
|
46
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Container, { children: [image ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledImage, {
|
|
47
|
+
src: image.src,
|
|
48
|
+
alt: image.alt,
|
|
49
|
+
sizes: `(min-width: ${__ndla_core.breakpoints.desktop}) 150px, (max-width: ${__ndla_core.breakpoints.tablet} ) 400px, 200px`,
|
|
50
|
+
variant: "rounded"
|
|
51
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ContentWrapper, { children: [
|
|
52
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_primitives.Heading, {
|
|
53
|
+
textStyle: "label.large",
|
|
54
|
+
fontWeight: "bold",
|
|
55
|
+
asChild: true,
|
|
56
|
+
consumeCss: true,
|
|
57
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: title })
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledText, {
|
|
60
|
+
textStyle: "body.medium",
|
|
61
|
+
children: caption
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__ndla_safelink.SafeLinkButton, {
|
|
64
|
+
to: url,
|
|
65
|
+
target: "_blank",
|
|
66
|
+
variant: "secondary",
|
|
67
|
+
children: [buttonText, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__ndla_icons.ShareBoxLine, {})]
|
|
68
|
+
})
|
|
69
|
+
] })] });
|
|
104
70
|
};
|
|
105
|
-
|
|
106
|
-
|
|
71
|
+
var ResourceBox_default = ResourceBox;
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
exports.ResourceBox_default = ResourceBox_default;
|
|
75
|
+
//# sourceMappingURL=ResourceBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResourceBox.js","names":["Image","Text","breakpoints","Heading","SafeLinkButton","ShareBoxLine"],"sources":["../../src/ResourceBox/ResourceBox.tsx"],"sourcesContent":["/**\n * Copyright (c) 2022-present, NDLA.\n *\n * This source code is licensed under the GPLv3 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport { breakpoints } from \"@ndla/core\";\nimport { ShareBoxLine } from \"@ndla/icons\";\nimport { Heading, Image, Text } from \"@ndla/primitives\";\nimport { SafeLinkButton } from \"@ndla/safelink\";\nimport { styled } from \"@ndla/styled-system/jsx\";\n\nconst Container = styled(\"div\", {\n base: {\n display: \"flex\",\n padding: \"medium\",\n borderRadius: \"xsmall\",\n border: \"1px solid\",\n borderColor: \"stroke.default\",\n boxShadow: \"full\",\n marginBlockEnd: \"medium\",\n gap: \"medium\",\n tabletWideDown: {\n padding: \"xsmall\",\n },\n tabletDown: {\n flexDirection: \"column\",\n gap: \"0\",\n padding: \"0\",\n },\n },\n});\n\nconst ContentWrapper = styled(\"div\", {\n base: {\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"flex-start\",\n gap: \"xsmall\",\n flex: \"1\",\n tabletDown: {\n padding: \"xsmall\",\n },\n },\n});\n\nconst StyledImage = styled(Image, {\n base: {\n objectFit: \"cover\",\n borderRadius: \"xsmall\",\n width: \"fit-content\",\n aspectRatio: \"1/1\",\n tabletDown: {\n width: \"100%\",\n borderRadius: \"0\",\n },\n },\n});\n\nconst StyledText = styled(Text, {\n base: {\n flex: \"1\",\n },\n});\n\ninterface ImageMeta {\n src: string | undefined;\n alt: string;\n}\n\ninterface Props {\n image?: ImageMeta;\n title: string;\n caption: string;\n url: string;\n buttonText: string;\n}\n\nexport const ResourceBox = ({ image, title, caption, url, buttonText }: Props) => {\n return (\n <Container>\n {image ? (\n <StyledImage\n src={image.src}\n alt={image.alt}\n sizes={`(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`}\n variant=\"rounded\"\n />\n ) : null}\n <ContentWrapper>\n <Heading textStyle=\"label.large\" fontWeight=\"bold\" asChild consumeCss>\n <h3>{title}</h3>\n </Heading>\n <StyledText textStyle=\"body.medium\">{caption}</StyledText>\n <SafeLinkButton to={url} target=\"_blank\" variant=\"secondary\">\n {buttonText}\n <ShareBoxLine />\n </SafeLinkButton>\n </ContentWrapper>\n </Container>\n );\n};\n\nexport default ResourceBox;\n"],"mappings":";;;;;;;;;AAcA,MAAM,YAAY,qCAAO,OAAO,EAC9B,MAAM;CACJ,SAAS;CACT,SAAS;CACT,cAAc;CACd,QAAQ;CACR,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,KAAK;CACL,gBAAgB,EACd,SAAS,SACV;CACD,YAAY;EACV,eAAe;EACf,KAAK;EACL,SAAS;CACV;AACF,EACF,EAAC;AAEF,MAAM,iBAAiB,qCAAO,OAAO,EACnC,MAAM;CACJ,SAAS;CACT,eAAe;CACf,YAAY;CACZ,KAAK;CACL,MAAM;CACN,YAAY,EACV,SAAS,SACV;AACF,EACF,EAAC;AAEF,MAAM,cAAc,qCAAOA,yBAAO,EAChC,MAAM;CACJ,WAAW;CACX,cAAc;CACd,OAAO;CACP,aAAa;CACb,YAAY;EACV,OAAO;EACP,cAAc;CACf;AACF,EACF,EAAC;AAEF,MAAM,aAAa,qCAAOC,wBAAM,EAC9B,MAAM,EACJ,MAAM,IACP,EACF,EAAC;AAeF,MAAa,cAAc,CAAC,EAAE,OAAO,OAAO,SAAS,KAAK,YAAmB,KAAK;AAChF,wBACE,4BAAC,wBACE,wBACC,2BAAC;EACC,KAAK,MAAM;EACX,KAAK,MAAM;EACX,QAAQ,cAAcC,wBAAY,QAAQ,uBAAuBA,wBAAY,OAAO;EACpF,SAAQ;GACR,GACA,sBACJ,4BAAC;kBACC,2BAACC;GAAQ,WAAU;GAAc,YAAW;GAAO;GAAQ;6BACzD,2BAAC,kBAAI,QAAW;IACR;kBACV,2BAAC;GAAW,WAAU;aAAe;IAAqB;kBAC1D,4BAACC;GAAe,IAAI;GAAK,QAAO;GAAS,SAAQ;cAC9C,4BACD,2BAACC,8BAAe;IACD;KACF,IACP;AAEf;AAED,0BAAe"}
|