@ndla/ui 50.9.7 → 50.9.9
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/AudioPlayer/AudioPlayer.js +34 -34
- package/es/Embed/ContentLinkEmbed.js +2 -2
- package/es/Embed/IframeEmbed.js +11 -4
- package/es/Embed/UuDisclaimerEmbed.js +75 -0
- package/es/Embed/index.js +2 -1
- package/es/ExpandableBox/ExpandableBox.js +8 -2
- package/es/Filter/ToggleItem.js +31 -9
- package/es/Filter/index.js +0 -3
- package/es/Logo/Logo.js +44 -20
- package/es/Logo/SvgLogo.js +7 -3
- package/es/Messages/MessageBox.js +6 -6
- package/es/RelatedArticleList/RelatedArticleList.js +8 -8
- package/es/all.css +1 -1
- package/es/index.js +2 -2
- package/es/locale/messages-en.js +3 -0
- package/es/locale/messages-nb.js +3 -0
- package/es/locale/messages-nn.js +3 -0
- package/es/locale/messages-se.js +3 -0
- package/es/locale/messages-sma.js +3 -0
- package/lib/AudioPlayer/AudioPlayer.js +34 -34
- package/lib/Embed/ContentLinkEmbed.js +2 -2
- package/lib/Embed/IframeEmbed.js +12 -4
- package/lib/Embed/UuDisclaimerEmbed.d.ts +15 -0
- package/lib/Embed/UuDisclaimerEmbed.js +78 -0
- package/lib/Embed/index.d.ts +1 -0
- package/lib/Embed/index.js +7 -0
- package/lib/ExpandableBox/ExpandableBox.js +8 -1
- package/lib/Filter/ToggleItem.d.ts +1 -2
- package/lib/Filter/ToggleItem.js +32 -9
- package/lib/Filter/index.d.ts +0 -3
- package/lib/Filter/index.js +0 -21
- package/lib/Logo/Logo.d.ts +0 -2
- package/lib/Logo/Logo.js +45 -22
- package/lib/Logo/SvgLogo.js +8 -3
- package/lib/Messages/MessageBox.d.ts +1 -1
- package/lib/Messages/MessageBox.js +6 -6
- package/lib/RelatedArticleList/RelatedArticleList.js +8 -8
- package/lib/all.css +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +6 -12
- package/lib/locale/messages-en.d.ts +3 -0
- package/lib/locale/messages-en.js +3 -0
- package/lib/locale/messages-nb.d.ts +3 -0
- package/lib/locale/messages-nb.js +3 -0
- package/lib/locale/messages-nn.d.ts +3 -0
- package/lib/locale/messages-nn.js +3 -0
- package/lib/locale/messages-se.d.ts +3 -0
- package/lib/locale/messages-se.js +3 -0
- package/lib/locale/messages-sma.d.ts +3 -0
- package/lib/locale/messages-sma.js +3 -0
- package/package.json +12 -12
- package/src/AudioPlayer/AudioPlayer.tsx +13 -27
- package/src/CampaignBlock/CampaignBlock.stories.tsx +15 -0
- package/src/Embed/BrightcoveEmbed.stories.tsx +1 -1
- package/src/Embed/ContentLinkEmbed.tsx +1 -1
- package/src/Embed/ExternalEmbed.stories.tsx +93 -0
- package/src/Embed/IframeEmbed.tsx +8 -3
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +150 -0
- package/src/Embed/UuDisclaimerEmbed.tsx +62 -0
- package/src/Embed/index.ts +1 -0
- package/src/ExpandableBox/ExpandableBox.stories.tsx +10 -1
- package/src/ExpandableBox/ExpandableBox.tsx +11 -1
- package/src/Figure/component.figure.scss +0 -56
- package/src/Filter/ToggleItem.tsx +131 -9
- package/src/Filter/index.ts +0 -3
- package/src/Logo/Logo.tsx +36 -16
- package/src/Logo/SvgLogo.tsx +8 -9
- package/src/Messages/MessageBox.tsx +1 -1
- package/src/RelatedArticleList/RelatedArticleList.tsx +1 -1
- package/src/index.ts +2 -1
- package/src/locale/messages-en.ts +3 -0
- package/src/locale/messages-nb.ts +3 -0
- package/src/locale/messages-nn.ts +3 -0
- package/src/locale/messages-se.ts +3 -0
- package/src/locale/messages-sma.ts +3 -0
- package/src/main.scss +0 -2
- package/es/Filter/FilterList.js +0 -100
- package/es/Filter/FilterListPhone.js +0 -224
- package/es/Filter/filterClasses.js +0 -13
- package/lib/Filter/FilterList.d.ts +0 -32
- package/lib/Filter/FilterList.js +0 -105
- package/lib/Filter/FilterListPhone.d.ts +0 -38
- package/lib/Filter/FilterListPhone.js +0 -229
- package/lib/Filter/filterClasses.d.ts +0 -9
- package/lib/Filter/filterClasses.js +0 -20
- package/src/Filter/FilterList.tsx +0 -137
- package/src/Filter/FilterListPhone.tsx +0 -278
- package/src/Filter/component.filter.scss +0 -503
- package/src/Filter/filterClasses.ts +0 -14
- package/src/Logo/component.logo.scss +0 -28
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { ExpandableBox, ExpandableBoxSummary } from "./ExpandableBox";
|
|
9
9
|
export { default as FramedContent } from "./FramedContent";
|
|
10
|
-
export { ConceptNotionV2, ImageEmbed, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, InlineConcept, BlockConcept, } from "./Embed";
|
|
10
|
+
export { ConceptNotionV2, ImageEmbed, AudioEmbed, H5pEmbed, ExternalEmbed, IframeEmbed, FootnoteEmbed, BrightcoveEmbed, ContentLinkEmbed, RelatedContentEmbed, ConceptEmbed, ConceptListEmbed, UnknownEmbed, InlineConcept, BlockConcept, UuDisclaimerEmbed, } from "./Embed";
|
|
11
11
|
export { LicenseLink } from "./LicenseByline";
|
|
12
12
|
export { ArticleByline, ArticleFootNotes, ArticleIntroduction, ArticleTitle, ArticleWrapper, ArticleHeaderWrapper, default as Article, } from "./Article";
|
|
13
13
|
export { getPossiblyRelativeUrl } from "./utils/relativeUrl";
|
|
@@ -25,7 +25,7 @@ export { default as Image, ImageLink, makeSrcQueryString } from "./Image";
|
|
|
25
25
|
export type { ImageCrop, ImageFocalPoint } from "./Image";
|
|
26
26
|
export type { HeroContentType } from "./Hero";
|
|
27
27
|
export { SubjectMaterialHero, TasksAndActivitiesHero, AssessmentResourcesHero, SubjectHero, ExternalLearningResourcesHero, SourceMaterialHero, Hero, NdlaFilmHero, HeroContent, } from "./Hero";
|
|
28
|
-
export {
|
|
28
|
+
export { FilterButtons, ToggleItem } from "./Filter";
|
|
29
29
|
export { Footer, EditorName, FooterText } from "./Footer";
|
|
30
30
|
export { Figure, FigureOpenDialogButton } from "./Figure";
|
|
31
31
|
export type { FigureType } from "./Figure";
|
package/lib/index.js
CHANGED
|
@@ -339,18 +339,6 @@ Object.defineProperty(exports, "FilterButtons", {
|
|
|
339
339
|
return _Filter.FilterButtons;
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
|
-
Object.defineProperty(exports, "FilterList", {
|
|
343
|
-
enumerable: true,
|
|
344
|
-
get: function () {
|
|
345
|
-
return _Filter.FilterList;
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
Object.defineProperty(exports, "FilterListPhone", {
|
|
349
|
-
enumerable: true,
|
|
350
|
-
get: function () {
|
|
351
|
-
return _Filter.FilterListPhone;
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
342
|
Object.defineProperty(exports, "Folder", {
|
|
355
343
|
enumerable: true,
|
|
356
344
|
get: function () {
|
|
@@ -957,6 +945,12 @@ Object.defineProperty(exports, "UnknownEmbed", {
|
|
|
957
945
|
return _Embed.UnknownEmbed;
|
|
958
946
|
}
|
|
959
947
|
});
|
|
948
|
+
Object.defineProperty(exports, "UuDisclaimerEmbed", {
|
|
949
|
+
enumerable: true,
|
|
950
|
+
get: function () {
|
|
951
|
+
return _Embed.UuDisclaimerEmbed;
|
|
952
|
+
}
|
|
953
|
+
});
|
|
960
954
|
Object.defineProperty(exports, "WIDE_FRONTPAGE_ARTICLE_MAX_WIDTH", {
|
|
961
955
|
enumerable: true,
|
|
962
956
|
get: function () {
|
|
@@ -1337,6 +1337,9 @@ const messages = {
|
|
|
1337
1337
|
pinyin: "Pinyin"
|
|
1338
1338
|
}
|
|
1339
1339
|
},
|
|
1340
|
+
uuDisclaimer: {
|
|
1341
|
+
alternative: "You can find alternative content in the article"
|
|
1342
|
+
},
|
|
1340
1343
|
wordClass: {
|
|
1341
1344
|
[wordClass.wordClass.adjective]: "Adjective",
|
|
1342
1345
|
[wordClass.wordClass.adverb]: "Adverb",
|
|
@@ -1337,6 +1337,9 @@ const messages = {
|
|
|
1337
1337
|
pinyin: "Pinyin"
|
|
1338
1338
|
}
|
|
1339
1339
|
},
|
|
1340
|
+
uuDisclaimer: {
|
|
1341
|
+
alternative: "Du kan finne alternativt innhold i artikkelen"
|
|
1342
|
+
},
|
|
1340
1343
|
wordClass: {
|
|
1341
1344
|
[wordClass.wordClass.adjective]: "Adjektiv",
|
|
1342
1345
|
[wordClass.wordClass.adverb]: "Adverb",
|
|
@@ -1337,6 +1337,9 @@ const messages = {
|
|
|
1337
1337
|
pinyin: "Pinyin"
|
|
1338
1338
|
}
|
|
1339
1339
|
},
|
|
1340
|
+
uuDisclaimer: {
|
|
1341
|
+
alternative: "Du kan finne alternativt innhald i artikkelen"
|
|
1342
|
+
},
|
|
1340
1343
|
wordClass: {
|
|
1341
1344
|
[wordClass.wordClass.adjective]: "Adjektiv",
|
|
1342
1345
|
[wordClass.wordClass.adverb]: "Adverb",
|
|
@@ -1337,6 +1337,9 @@ const messages = {
|
|
|
1337
1337
|
pinyin: "Pinyin"
|
|
1338
1338
|
}
|
|
1339
1339
|
},
|
|
1340
|
+
uuDisclaimer: {
|
|
1341
|
+
alternative: "Du kan finne alternativt innhold i artikkelen"
|
|
1342
|
+
},
|
|
1340
1343
|
wordClass: {
|
|
1341
1344
|
[wordClass.wordClass.adjective]: "Adjektiivvat",
|
|
1342
1345
|
[wordClass.wordClass.adverb]: "Advearba",
|
|
@@ -1337,6 +1337,9 @@ const messages = {
|
|
|
1337
1337
|
pinyin: "Pinyin"
|
|
1338
1338
|
}
|
|
1339
1339
|
},
|
|
1340
|
+
uuDisclaimer: {
|
|
1341
|
+
alternative: "Du kan finne alternativt innhold i artikkelen"
|
|
1342
|
+
},
|
|
1340
1343
|
wordClass: {
|
|
1341
1344
|
[wordClass.wordClass.adjective]: "Adjektiv",
|
|
1342
1345
|
[wordClass.wordClass.adverb]: "Adverb",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "50.9.
|
|
3
|
+
"version": "50.9.9",
|
|
4
4
|
"description": "UI component library for NDLA.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"types"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ndla/accordion": "^3.0.
|
|
35
|
-
"@ndla/button": "^12.0.
|
|
36
|
-
"@ndla/carousel": "^4.0.
|
|
34
|
+
"@ndla/accordion": "^3.0.27",
|
|
35
|
+
"@ndla/button": "^12.0.32",
|
|
36
|
+
"@ndla/carousel": "^4.0.31",
|
|
37
37
|
"@ndla/core": "^4.4.0",
|
|
38
38
|
"@ndla/dropdown-menu": "^1.0.28",
|
|
39
|
-
"@ndla/forms": "^5.2.
|
|
39
|
+
"@ndla/forms": "^5.2.23",
|
|
40
40
|
"@ndla/hooks": "^2.1.5",
|
|
41
|
-
"@ndla/icons": "^5.0.
|
|
41
|
+
"@ndla/icons": "^5.0.10",
|
|
42
42
|
"@ndla/licenses": "^7.2.5",
|
|
43
|
-
"@ndla/modal": "^5.0.
|
|
44
|
-
"@ndla/notion": "^6.0.
|
|
45
|
-
"@ndla/safelink": "^4.1.
|
|
46
|
-
"@ndla/select": "^3.3.
|
|
43
|
+
"@ndla/modal": "^5.0.30",
|
|
44
|
+
"@ndla/notion": "^6.0.31",
|
|
45
|
+
"@ndla/safelink": "^4.1.57",
|
|
46
|
+
"@ndla/select": "^3.3.5",
|
|
47
47
|
"@ndla/switch": "^1.1.34",
|
|
48
48
|
"@ndla/tabs": "^3.2.14",
|
|
49
49
|
"@ndla/tooltip": "^6.0.17",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@ndla/types-backend": "^0.2.21",
|
|
74
|
-
"@ndla/types-embed": "^4.0.
|
|
74
|
+
"@ndla/types-embed": "^4.0.14",
|
|
75
75
|
"css-loader": "^6.7.3",
|
|
76
76
|
"mini-css-extract-plugin": "^2.7.5",
|
|
77
77
|
"sass-loader": "^13.2.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "fc3f24dabc60ff3f1f00984a38a9de4ff8fde3c7"
|
|
85
85
|
}
|
|
@@ -13,6 +13,7 @@ import { ButtonV2 } from "@ndla/button";
|
|
|
13
13
|
import { breakpoints, colors, fonts, mq, spacing } from "@ndla/core";
|
|
14
14
|
import { Cross as CrossIcon } from "@ndla/icons/action";
|
|
15
15
|
import SafeLink from "@ndla/safelink";
|
|
16
|
+
import { Heading, Text } from "@ndla/typography";
|
|
16
17
|
import Controls from "./Controls";
|
|
17
18
|
import SpeechControl from "./SpeechControl";
|
|
18
19
|
|
|
@@ -73,26 +74,12 @@ const TitleWrapper = styled.div`
|
|
|
73
74
|
}
|
|
74
75
|
`;
|
|
75
76
|
|
|
76
|
-
const Title = styled
|
|
77
|
-
${fonts.sizes("22px", "30px")};
|
|
78
|
-
margin: 0px;
|
|
77
|
+
const Title = styled(Heading)`
|
|
79
78
|
&[data-has-desc="true"] {
|
|
80
|
-
margin:
|
|
79
|
+
margin: ${spacing.xsmall} 0 ${spacing.small};
|
|
81
80
|
}
|
|
82
81
|
`;
|
|
83
82
|
|
|
84
|
-
const Subtitle = styled.h3`
|
|
85
|
-
${fonts.sizes("18px", "28px")};
|
|
86
|
-
margin: 0;
|
|
87
|
-
font-weight: ${fonts.weight.semibold};
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
const StyledDescription = styled.div`
|
|
91
|
-
${fonts.sizes("16px", "30px")};
|
|
92
|
-
font-family: ${fonts.sans};
|
|
93
|
-
margin: 0;
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
83
|
const LinkToTextVersionWrapper = styled.div`
|
|
97
84
|
&[data-margin="true"] {
|
|
98
85
|
margin-top: ${spacing.small};
|
|
@@ -125,7 +112,7 @@ const TextVersionHeadingWrapper = styled.div`
|
|
|
125
112
|
align-items: flex-start;
|
|
126
113
|
`;
|
|
127
114
|
|
|
128
|
-
const TextVersionHeading = styled
|
|
115
|
+
const TextVersionHeading = styled(Heading)`
|
|
129
116
|
font-weight: ${fonts.weight.semibold};
|
|
130
117
|
margin: ${spacing.small} 0 ${spacing.normal};
|
|
131
118
|
`;
|
|
@@ -135,7 +122,6 @@ const LinkButton = styled(ButtonV2)`
|
|
|
135
122
|
padding-left: 0;
|
|
136
123
|
padding-right: 4px;
|
|
137
124
|
min-height: ${spacing.medium};
|
|
138
|
-
${fonts.sizes("16px", "25px")};
|
|
139
125
|
flex: 0 0 auto;
|
|
140
126
|
&:hover,
|
|
141
127
|
&:focus {
|
|
@@ -214,24 +200,22 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
|
|
|
214
200
|
<TextWrapper data-has-image={!!img}>
|
|
215
201
|
<TitleWrapper>
|
|
216
202
|
<div>
|
|
217
|
-
{subtitle &&
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
)}
|
|
222
|
-
<Title data-has-desc={!!description}>{title}</Title>
|
|
203
|
+
{subtitle && subtitle.url ? <SafeLink to={subtitle.url}>{subtitle.title}</SafeLink> : subtitle?.title}
|
|
204
|
+
<Title element="h3" headingStyle="h4" margin="none" data-has-desc={!!description}>
|
|
205
|
+
{title}
|
|
206
|
+
</Title>
|
|
223
207
|
</div>
|
|
224
208
|
{textVersion && !img && <TextVersionComponent />}
|
|
225
209
|
</TitleWrapper>
|
|
226
210
|
{description && (
|
|
227
|
-
<
|
|
211
|
+
<Text element="p" textStyle="meta-text-small" margin="none">
|
|
228
212
|
{showFullDescription || description.length < DESCRIPTION_MAX_LENGTH
|
|
229
213
|
? description
|
|
230
214
|
: `${truncatedDescription}...`}
|
|
231
215
|
<ButtonV2 variant="link" onClick={() => setShowFullDescription((p) => !p)}>
|
|
232
216
|
{t(`audio.${showFullDescription ? "readLessDescriptionLabel" : "readMoreDescriptionLabel"}`)}
|
|
233
217
|
</ButtonV2>
|
|
234
|
-
</
|
|
218
|
+
</Text>
|
|
235
219
|
)}
|
|
236
220
|
{textVersion && img && <TextVersionComponent margin />}
|
|
237
221
|
</TextWrapper>
|
|
@@ -242,7 +226,9 @@ const AudioPlayer = ({ src, title, subtitle, speech, description, img, textVersi
|
|
|
242
226
|
{textVersion && (showTextVersion || staticRenderId) && (
|
|
243
227
|
<TextVersionWrapper id={staticRenderId} hidden={!!staticRenderId}>
|
|
244
228
|
<TextVersionHeadingWrapper>
|
|
245
|
-
<TextVersionHeading
|
|
229
|
+
<TextVersionHeading element="h3" headingStyle="h2" margin="small">
|
|
230
|
+
{t("audio.textVersion.heading")}
|
|
231
|
+
</TextVersionHeading>
|
|
246
232
|
<LinkButton
|
|
247
233
|
variant="link"
|
|
248
234
|
size="normal"
|
|
@@ -57,3 +57,18 @@ export const ImageRight: StoryObj<typeof CampaignBlock> = {
|
|
|
57
57
|
imageSide: "right",
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
|
+
|
|
61
|
+
export const NoUrl: StoryObj<typeof CampaignBlock> = {
|
|
62
|
+
args: {
|
|
63
|
+
title: { title: "No url!!!", language: "nb-no" },
|
|
64
|
+
description: {
|
|
65
|
+
text: "Look ma, no url!",
|
|
66
|
+
language: "nb-no",
|
|
67
|
+
},
|
|
68
|
+
image: {
|
|
69
|
+
alt: "Tømmer",
|
|
70
|
+
src: "https://api.test.ndla.no/image-api/raw/stokkmarknes_004_d013e.jpg",
|
|
71
|
+
},
|
|
72
|
+
imageSide: "left",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { Meta, StoryObj } from "@storybook/react";
|
|
10
|
-
import { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData
|
|
10
|
+
import { BrightcoveData, BrightcoveEmbedData, BrightcoveMetaData } from "@ndla/types-embed";
|
|
11
11
|
import BrightcoveEmbed from "./BrightcoveEmbed";
|
|
12
12
|
import { defaultParameters } from "../../../../stories/defaults";
|
|
13
13
|
import StoryFavoriteButton from "../../../../stories/StoryFavoriteButton";
|
|
@@ -29,7 +29,7 @@ const ContentLinkEmbed = ({ embed, isOembed }: Props) => {
|
|
|
29
29
|
|
|
30
30
|
if (embedData.openIn === "new-context" || isOembed) {
|
|
31
31
|
return (
|
|
32
|
-
<a href={
|
|
32
|
+
<a href={data.path} target="_blank" rel="noopener noreferrer">
|
|
33
33
|
{embedData.linkText}
|
|
34
34
|
</a>
|
|
35
35
|
);
|
|
@@ -17,6 +17,15 @@ const embedData: OembedEmbedData = {
|
|
|
17
17
|
type: "iframe",
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
const embedDataFullscreen: OembedEmbedData = {
|
|
21
|
+
resource: "external",
|
|
22
|
+
url: "https://embed.ted.com/talks/zahra_biabani_the_eco_creators_helping_the_climate_through_social_media",
|
|
23
|
+
type: "fullscreen",
|
|
24
|
+
title: "Zahra Biabani: The eco-creators helping the climate through social media",
|
|
25
|
+
caption: "Ted talk",
|
|
26
|
+
imageid: "65086",
|
|
27
|
+
};
|
|
28
|
+
|
|
20
29
|
const metaData: OembedData = {
|
|
21
30
|
oembed: {
|
|
22
31
|
type: "video",
|
|
@@ -81,3 +90,87 @@ export const Failed: StoryObj<typeof ExternalEmbed> = {
|
|
|
81
90
|
},
|
|
82
91
|
},
|
|
83
92
|
};
|
|
93
|
+
|
|
94
|
+
const opensInNewMetaData: OembedData = {
|
|
95
|
+
oembed: {
|
|
96
|
+
type: "video",
|
|
97
|
+
version: "1.0",
|
|
98
|
+
title: "Zahra Biabani: The eco-creators helping the climate through social media",
|
|
99
|
+
description:
|
|
100
|
+
'"Climate doom-ism," or a pessimistic outlook on the future of the planet, rivals climate denialism in holding up the fight against climate change, says activist Zahra Biabani. Illuminating how hope combats inaction, she takes us inside the world of eco-friendly content on TikTok -- and shows that we all have what it takes to make real change.',
|
|
101
|
+
authorName: "Zahra Biabani",
|
|
102
|
+
authorUrl: "https://www.ted.com/speakers/zahra_biabani",
|
|
103
|
+
providerName: "TED",
|
|
104
|
+
providerUrl: "https://www.ted.com",
|
|
105
|
+
cacheAge: 300,
|
|
106
|
+
thumbnailUrl:
|
|
107
|
+
"https://pi.tedcdn.com/r/talkstar-photos.s3.amazonaws.com/uploads/803ab5d5-2cff-4764-b5b6-545217159538/ZahraBiabani_2022T-embed.jpg?h=315&w=560",
|
|
108
|
+
thumbnailWidth: 560,
|
|
109
|
+
thumbnailHeight: 315,
|
|
110
|
+
width: 560,
|
|
111
|
+
height: 315,
|
|
112
|
+
html: '<iframe src="https://embed.ted.com/talks/zahra_biabani_the_eco_creators_helping_the_climate_through_social_media" width="560" height="315" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
|
|
113
|
+
},
|
|
114
|
+
iframeImage: {
|
|
115
|
+
id: "65086",
|
|
116
|
+
metaUrl: "https://api.test.ndla.no/image-api/v3/images/65086",
|
|
117
|
+
title: {
|
|
118
|
+
title: "\nSamtale ",
|
|
119
|
+
language: "nb",
|
|
120
|
+
},
|
|
121
|
+
alttext: {
|
|
122
|
+
alttext: " To ungdommer sitter og snakker. Foto. ",
|
|
123
|
+
language: "nb",
|
|
124
|
+
},
|
|
125
|
+
copyright: {
|
|
126
|
+
license: {
|
|
127
|
+
license: "COPYRIGHTED",
|
|
128
|
+
description: "Copyrighted",
|
|
129
|
+
},
|
|
130
|
+
origin: "",
|
|
131
|
+
creators: [],
|
|
132
|
+
processors: [],
|
|
133
|
+
rightsholders: [
|
|
134
|
+
{
|
|
135
|
+
type: "rightsholder",
|
|
136
|
+
name: "Folkehelseprosjektet Helsefremmende miljø på sosial medier, Bergen kommune 2019-2022",
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
processed: false,
|
|
140
|
+
},
|
|
141
|
+
tags: {
|
|
142
|
+
tags: ["samtale", "Dialog", "gutter"],
|
|
143
|
+
language: "nb",
|
|
144
|
+
},
|
|
145
|
+
caption: {
|
|
146
|
+
caption: 'Dette bildet skal bare brukes i casen "Livet på sosiale medier". ',
|
|
147
|
+
language: "nb",
|
|
148
|
+
},
|
|
149
|
+
supportedLanguages: ["nb"],
|
|
150
|
+
created: "2022-12-02T14:24:19Z",
|
|
151
|
+
createdBy: "oltQx44eGQp0DwkiR1NRo5qE",
|
|
152
|
+
modelRelease: "yes",
|
|
153
|
+
image: {
|
|
154
|
+
fileName: "IgOjO6og.jpg",
|
|
155
|
+
size: 176667,
|
|
156
|
+
contentType: "image/jpeg",
|
|
157
|
+
imageUrl: "https://api.test.ndla.no/image-api/raw/IgOjO6og.jpg",
|
|
158
|
+
dimensions: {
|
|
159
|
+
width: 1920,
|
|
160
|
+
height: 804,
|
|
161
|
+
},
|
|
162
|
+
language: "nb",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const Fullscreen: StoryObj<typeof ExternalEmbed> = {
|
|
168
|
+
args: {
|
|
169
|
+
embed: {
|
|
170
|
+
resource: "external",
|
|
171
|
+
status: "success",
|
|
172
|
+
embedData: embedDataFullscreen,
|
|
173
|
+
data: opensInNewMetaData,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { useEffect, useRef } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
11
|
import { IframeMetaData } from "@ndla/types-embed";
|
|
12
|
+
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
12
13
|
import { Figure } from "../Figure";
|
|
13
14
|
import { ResourceBox } from "../ResourceBox";
|
|
14
15
|
|
|
@@ -21,8 +22,6 @@ const IframeEmbed = ({ embed, isConcept }: Props) => {
|
|
|
21
22
|
const { t } = useTranslation();
|
|
22
23
|
const iframeRef = useRef<HTMLIFrameElement>(null);
|
|
23
24
|
|
|
24
|
-
const { embedData } = embed;
|
|
25
|
-
|
|
26
25
|
useEffect(() => {
|
|
27
26
|
const iframe = iframeRef.current;
|
|
28
27
|
if (iframe) {
|
|
@@ -33,8 +32,14 @@ const IframeEmbed = ({ embed, isConcept }: Props) => {
|
|
|
33
32
|
}
|
|
34
33
|
}, []);
|
|
35
34
|
|
|
35
|
+
if (embed.status === "error") {
|
|
36
|
+
return <EmbedErrorPlaceholder type="external" />;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { embedData, data } = embed;
|
|
40
|
+
|
|
36
41
|
if (embedData.type === "fullscreen") {
|
|
37
|
-
const iframeImage = embed.status === "success" ?
|
|
42
|
+
const iframeImage = embed.status === "success" ? data.iframeImage : undefined;
|
|
38
43
|
const alt = embedData.alt !== undefined ? embedData.alt : iframeImage?.alttext.alttext;
|
|
39
44
|
const image = { src: iframeImage?.image.imageUrl ?? "", alt: alt ?? "" };
|
|
40
45
|
return (
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024-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 { Meta, StoryObj } from "@storybook/react";
|
|
10
|
+
import { UuDisclaimerEmbedData } from "@ndla/types-embed";
|
|
11
|
+
import H5pEmbed from "./H5pEmbed";
|
|
12
|
+
import IframeEmbed from "./IframeEmbed";
|
|
13
|
+
import UuDisclaimerEmbed from "./UuDisclaimerEmbed";
|
|
14
|
+
import { defaultParameters } from "../../../../stories/defaults";
|
|
15
|
+
|
|
16
|
+
const embedData: UuDisclaimerEmbedData = {
|
|
17
|
+
resource: "uu-disclaimer",
|
|
18
|
+
disclaimer: "Dette inholdet er ikke tastaturvennlig.",
|
|
19
|
+
articleId: 123,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const meta: Meta<typeof UuDisclaimerEmbed> = {
|
|
23
|
+
title: "Embeds/UuDisclaimerEmbed",
|
|
24
|
+
component: UuDisclaimerEmbed,
|
|
25
|
+
tags: ["autodocs"],
|
|
26
|
+
decorators: [
|
|
27
|
+
(Story) => (
|
|
28
|
+
<div className="o-wrapper">
|
|
29
|
+
<article className="c-article c-article--clean">
|
|
30
|
+
<section className="u-4/6@desktop u-push-1/6@desktop u-10/12@tablet u-push-1/12@tablet">
|
|
31
|
+
<section>
|
|
32
|
+
<Story />
|
|
33
|
+
</section>
|
|
34
|
+
</section>
|
|
35
|
+
</article>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
parameters: defaultParameters,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default meta;
|
|
43
|
+
|
|
44
|
+
export const Regular: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
45
|
+
args: {
|
|
46
|
+
embed: {
|
|
47
|
+
resource: "uu-disclaimer",
|
|
48
|
+
status: "success",
|
|
49
|
+
embedData: embedData,
|
|
50
|
+
data: {},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithLink: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
56
|
+
args: {
|
|
57
|
+
embed: {
|
|
58
|
+
resource: "uu-disclaimer",
|
|
59
|
+
status: "success",
|
|
60
|
+
embedData: embedData,
|
|
61
|
+
data: {
|
|
62
|
+
disclaimerLink: {
|
|
63
|
+
href: "https://ndla.no/article/123",
|
|
64
|
+
text: "Navn på artikkel med innhold",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const WithIframe: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
72
|
+
args: {
|
|
73
|
+
embed: {
|
|
74
|
+
resource: "uu-disclaimer",
|
|
75
|
+
status: "success",
|
|
76
|
+
embedData: embedData,
|
|
77
|
+
data: {},
|
|
78
|
+
},
|
|
79
|
+
children: (
|
|
80
|
+
<IframeEmbed
|
|
81
|
+
embed={{
|
|
82
|
+
resource: "iframe",
|
|
83
|
+
status: "success",
|
|
84
|
+
embedData: {
|
|
85
|
+
resource: "iframe",
|
|
86
|
+
type: "iframe",
|
|
87
|
+
url: "https://embed.kahoot.it/2a51c481-d362-475b-862b-e4b47b96b3c9",
|
|
88
|
+
},
|
|
89
|
+
data: {},
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const WithH5p: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
97
|
+
args: {
|
|
98
|
+
embed: {
|
|
99
|
+
resource: "uu-disclaimer",
|
|
100
|
+
status: "success",
|
|
101
|
+
embedData: embedData,
|
|
102
|
+
data: {},
|
|
103
|
+
},
|
|
104
|
+
children: (
|
|
105
|
+
<H5pEmbed
|
|
106
|
+
embed={{
|
|
107
|
+
resource: "h5p",
|
|
108
|
+
status: "success",
|
|
109
|
+
embedData: {
|
|
110
|
+
resource: "h5p",
|
|
111
|
+
path: "/resource/c56368d0-0432-4ec3-97bd-f4ba4badf55e",
|
|
112
|
+
url: "https://h5p-test.ndla.no/resource/c56368d0-0432-4ec3-97bd-f4ba4badf55e?locale=nb-no&cssUrl=https://test.ndla.no/static/h5p-custom-css.css",
|
|
113
|
+
},
|
|
114
|
+
data: {
|
|
115
|
+
h5pUrl:
|
|
116
|
+
"https://h5p-test.ndla.no/resource/c56368d0-0432-4ec3-97bd-f4ba4badf55e?locale=nb-no&cssUrl=https://test.ndla.no/static/h5p-custom-css.css",
|
|
117
|
+
oembed: {
|
|
118
|
+
type: "proxy",
|
|
119
|
+
version: "1.0",
|
|
120
|
+
title: "Sorter avfall",
|
|
121
|
+
width: 600,
|
|
122
|
+
height: 300,
|
|
123
|
+
html: '<div><iframe width="600" height="300" allowfullscreen="allowfullscreen" src="https://h5p-test.ndla.no/resource/c56368d0-0432-4ec3-97bd-f4ba4badf55e?locale=nb-no&cssUrl=https%3A%2F%2Ftest.ndla.no%2Fstatic%2Fh5p-custom-css.css" title="Sorter avfall"></iframe><script src="https://ca.h5p.ndla.no/h5p-php-library/js/h5p-resizer.js"></script></div>',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
),
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const WithHtml: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
133
|
+
args: {
|
|
134
|
+
embed: {
|
|
135
|
+
resource: "uu-disclaimer",
|
|
136
|
+
status: "success",
|
|
137
|
+
embedData: embedData,
|
|
138
|
+
data: {},
|
|
139
|
+
},
|
|
140
|
+
children: (
|
|
141
|
+
<>
|
|
142
|
+
<h2>Dette er html med en ekspanderboks</h2>
|
|
143
|
+
<details>
|
|
144
|
+
<summary>Tittel</summary>
|
|
145
|
+
<p>innhold</p>
|
|
146
|
+
</details>
|
|
147
|
+
</>
|
|
148
|
+
),
|
|
149
|
+
},
|
|
150
|
+
};
|