@ndla/ui 56.0.35-alpha.0 → 56.0.36-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 +7 -6
- package/dist/styles.css +20 -16
- package/es/CampaignBlock/CampaignBlock.js +36 -47
- package/es/Embed/CodeEmbed.js +6 -2
- package/es/Embed/ConceptEmbed.js +1 -0
- package/es/Embed/EmbedErrorPlaceholder.js +8 -9
- package/es/locale/messages-en.js +2 -1
- package/es/locale/messages-nb.js +2 -1
- package/es/locale/messages-nn.js +2 -1
- package/es/locale/messages-se.js +2 -1
- package/es/locale/messages-sma.js +2 -1
- package/lib/CampaignBlock/CampaignBlock.d.ts +4 -2
- package/lib/CampaignBlock/CampaignBlock.js +35 -46
- package/lib/Embed/CodeEmbed.js +7 -2
- package/lib/Embed/ConceptEmbed.js +1 -0
- package/lib/Embed/EmbedErrorPlaceholder.js +7 -8
- package/lib/LicenseByline/EmbedByline.d.ts +1 -1
- package/lib/locale/messages-en.d.ts +1 -0
- package/lib/locale/messages-en.js +2 -1
- package/lib/locale/messages-nb.d.ts +1 -0
- package/lib/locale/messages-nb.js +2 -1
- package/lib/locale/messages-nn.d.ts +1 -0
- package/lib/locale/messages-nn.js +2 -1
- package/lib/locale/messages-se.d.ts +1 -0
- package/lib/locale/messages-se.js +2 -1
- package/lib/locale/messages-sma.d.ts +1 -0
- package/lib/locale/messages-sma.js +2 -1
- package/package.json +6 -6
- package/src/CampaignBlock/CampaignBlock.tsx +43 -44
- package/src/ContentTypeHero/ContentTypeHero.stories.tsx +3 -4
- package/src/Embed/AudioEmbed.stories.tsx +3 -3
- package/src/Embed/BrightcoveEmbed.stories.tsx +3 -3
- package/src/Embed/CodeEmbed.tsx +5 -2
- package/src/Embed/ConceptEmbed.stories.tsx +3 -3
- package/src/Embed/ConceptEmbed.tsx +1 -0
- package/src/Embed/EmbedErrorPlaceholder.tsx +8 -9
- package/src/Embed/ExternalEmbed.stories.tsx +3 -3
- package/src/Embed/H5pEmbed.stories.tsx +3 -3
- package/src/Embed/IframeEmbed.stories.tsx +3 -3
- package/src/Embed/ImageEmbed.stories.tsx +3 -4
- package/src/Embed/RelatedContentEmbed.stories.tsx +3 -3
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +3 -4
- package/src/Grid/Grid.stories.tsx +4 -3
- package/src/LicenseByline/EmbedByline.tsx +1 -1
- package/src/locale/messages-en.ts +1 -0
- package/src/locale/messages-nb.ts +1 -0
- package/src/locale/messages-nn.ts +1 -0
- package/src/locale/messages-se.ts +1 -0
- package/src/locale/messages-sma.ts +1 -0
|
@@ -131,7 +131,8 @@
|
|
|
131
131
|
"gridTemplateColumns]___[value:minmax(230px, 455px) auto]___[cond:@supports not (container-type: inline-size)<___>tabletWide",
|
|
132
132
|
"gridTemplateColumns]___[value:auto minmax(230px, 455px)]___[cond:@/tablet",
|
|
133
133
|
"gridTemplateColumns]___[value:auto minmax(230px, 455px)]___[cond:@supports not (container-type: inline-size)<___>tabletWide",
|
|
134
|
-
"
|
|
134
|
+
"backgroundColor]___[value:surface.brand.1",
|
|
135
|
+
"backgroundColor]___[value:surface.brand.3",
|
|
135
136
|
"height]___[value:215px",
|
|
136
137
|
"height]___[value:340px]___[cond:@/tablet",
|
|
137
138
|
"height]___[value:265px]___[cond:@supports not (container-type: inline-size)<___>tablet",
|
|
@@ -241,15 +242,15 @@
|
|
|
241
242
|
"marginInlineStart]___[value:xsmall",
|
|
242
243
|
"height]___[value:auto",
|
|
243
244
|
"textStyle]___[value:label.large",
|
|
245
|
+
"fontWeight]___[value:bold",
|
|
244
246
|
"marginBlockStart]___[value:xsmall]___[cond:& > *:not(:where(:first-child))",
|
|
245
247
|
"width]___[value:surface.xlarge",
|
|
246
248
|
"maxHeight]___[value:50vh",
|
|
247
249
|
"overflowY]___[value:auto",
|
|
248
|
-
"
|
|
249
|
-
"
|
|
250
|
-
"
|
|
251
|
-
"
|
|
252
|
-
"height]___[value:surface.3xsmall]___[cond:&[data-embed-type='audio']",
|
|
250
|
+
"background]___[value:background.subtle",
|
|
251
|
+
"height]___[value:5xlarge]___[cond:& svg",
|
|
252
|
+
"width]___[value:5xlarge]___[cond:& svg",
|
|
253
|
+
"fill]___[value:stroke.default]___[cond:& svg",
|
|
253
254
|
"marginBlockStart]___[value:3xsmall]___[cond:& > *:not(:first-child)",
|
|
254
255
|
"height]___[value:auto]___[cond:& iframe",
|
|
255
256
|
"width]___[value:100%]___[cond:& iframe",
|
package/dist/styles.css
CHANGED
|
@@ -498,6 +498,10 @@
|
|
|
498
498
|
max-height: 50vh;
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
+
.bg_background\.subtle {
|
|
502
|
+
background: var(--colors-background-subtle);
|
|
503
|
+
}
|
|
504
|
+
|
|
501
505
|
.z_docked {
|
|
502
506
|
z-index: var(--z-index-docked);
|
|
503
507
|
}
|
|
@@ -705,8 +709,12 @@
|
|
|
705
709
|
grid-template-columns: 1fr;
|
|
706
710
|
}
|
|
707
711
|
|
|
708
|
-
.
|
|
709
|
-
|
|
712
|
+
.bg-c_surface\.brand\.1 {
|
|
713
|
+
background-color: var(--colors-surface-brand-1);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.bg-c_surface\.brand\.3 {
|
|
717
|
+
background-color: var(--colors-surface-brand-3);
|
|
710
718
|
}
|
|
711
719
|
|
|
712
720
|
.bd-l-c_stroke\.default {
|
|
@@ -745,12 +753,12 @@
|
|
|
745
753
|
top: calc(var(--spacing-4xsmall) * -1);
|
|
746
754
|
}
|
|
747
755
|
|
|
748
|
-
.
|
|
749
|
-
|
|
756
|
+
.fw_bold {
|
|
757
|
+
font-weight: var(--font-weights-bold);
|
|
750
758
|
}
|
|
751
759
|
|
|
752
|
-
.
|
|
753
|
-
|
|
760
|
+
.ov-y_auto {
|
|
761
|
+
overflow-y: auto;
|
|
754
762
|
}
|
|
755
763
|
|
|
756
764
|
.top_xsmall {
|
|
@@ -1059,20 +1067,16 @@
|
|
|
1059
1067
|
margin-block-start: var(--spacing-xsmall);
|
|
1060
1068
|
}
|
|
1061
1069
|
|
|
1062
|
-
.\[\&_svg\]\:
|
|
1063
|
-
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
.\[\&_svg\]\:h_90\% svg {
|
|
1067
|
-
height: 90%;
|
|
1070
|
+
.\[\&_svg\]\:h_5xlarge svg {
|
|
1071
|
+
height: var(--sizes-5xlarge);
|
|
1068
1072
|
}
|
|
1069
1073
|
|
|
1070
|
-
.\[\&_svg\]\:
|
|
1071
|
-
width:
|
|
1074
|
+
.\[\&_svg\]\:w_5xlarge svg {
|
|
1075
|
+
width: var(--sizes-5xlarge);
|
|
1072
1076
|
}
|
|
1073
1077
|
|
|
1074
|
-
.\[
|
|
1075
|
-
|
|
1078
|
+
.\[\&_svg\]\:fill_stroke\.default svg {
|
|
1079
|
+
fill: var(--colors-stroke-default);
|
|
1076
1080
|
}
|
|
1077
1081
|
|
|
1078
1082
|
.\[\&_\>_\*\:not\(\:first-child\)\]\:mbs_3xsmall > *:not(:first-child) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import parse from "html-react-parser";
|
|
10
10
|
import { ArrowRightLine } from "@ndla/icons/common";
|
|
11
11
|
import { Text } from "@ndla/primitives";
|
|
12
|
-
import {
|
|
12
|
+
import { SafeLinkButton } from "@ndla/safelink";
|
|
13
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
14
14
|
import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
|
|
15
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -24,7 +24,6 @@ const Container = styled("div", {
|
|
|
24
24
|
base: {
|
|
25
25
|
display: "grid",
|
|
26
26
|
gridTemplateColumns: "1fr",
|
|
27
|
-
gap: "medium",
|
|
28
27
|
border: "1px solid",
|
|
29
28
|
borderColor: "stroke.default",
|
|
30
29
|
backgroundColor: "background.default",
|
|
@@ -54,31 +53,20 @@ const Container = styled("div", {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
}
|
|
56
|
+
},
|
|
57
|
+
background: {
|
|
58
|
+
neutral: {},
|
|
59
|
+
brand1: {
|
|
60
|
+
backgroundColor: "surface.brand.1"
|
|
61
|
+
},
|
|
62
|
+
brand3: {
|
|
63
|
+
backgroundColor: "surface.brand.3"
|
|
64
|
+
}
|
|
57
65
|
}
|
|
58
66
|
},
|
|
59
67
|
defaultVariants: {
|
|
60
|
-
imageSide: "left"
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
const LinkText = styled(Text, {
|
|
64
|
-
base: {
|
|
65
|
-
display: "flex",
|
|
66
|
-
gap: "xxsmall",
|
|
67
|
-
textDecoration: "underline",
|
|
68
|
-
_hover: {
|
|
69
|
-
textDecoration: "none"
|
|
70
|
-
},
|
|
71
|
-
paddingBlock: "xsmall",
|
|
72
|
-
fontWeight: "bold"
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
const LinkHeader = styled(Text, {
|
|
76
|
-
base: {
|
|
77
|
-
display: "flex",
|
|
78
|
-
textDecoration: "underline",
|
|
79
|
-
_hover: {
|
|
80
|
-
textDecoration: "none"
|
|
81
|
-
}
|
|
68
|
+
imageSide: "left",
|
|
69
|
+
background: "neutral"
|
|
82
70
|
}
|
|
83
71
|
});
|
|
84
72
|
const StyledImg = styled("img", {
|
|
@@ -96,7 +84,8 @@ const StyledImg = styled("img", {
|
|
|
96
84
|
tabletWide: {
|
|
97
85
|
height: "340px"
|
|
98
86
|
}
|
|
99
|
-
}
|
|
87
|
+
},
|
|
88
|
+
backgroundColor: "background.default"
|
|
100
89
|
}
|
|
101
90
|
});
|
|
102
91
|
const ContentWrapper = styled("div", {
|
|
@@ -108,7 +97,8 @@ const ContentWrapper = styled("div", {
|
|
|
108
97
|
alignItems: "flex-start",
|
|
109
98
|
justifyContent: "center",
|
|
110
99
|
paddingBlock: "medium",
|
|
111
|
-
paddingInline: "medium"
|
|
100
|
+
paddingInline: "medium",
|
|
101
|
+
position: "relative"
|
|
112
102
|
}
|
|
113
103
|
});
|
|
114
104
|
const StyledText = styled(Text, {
|
|
@@ -122,19 +112,24 @@ const StyledText = styled(Text, {
|
|
|
122
112
|
}
|
|
123
113
|
}
|
|
124
114
|
});
|
|
125
|
-
const
|
|
115
|
+
const StyledSafeLinkButton = styled(SafeLinkButton, {
|
|
126
116
|
base: {
|
|
127
|
-
|
|
117
|
+
boxShadow: "full",
|
|
118
|
+
border: "1px solid",
|
|
119
|
+
borderColor: "stroke.default"
|
|
128
120
|
}
|
|
129
121
|
});
|
|
130
|
-
const
|
|
122
|
+
const LinkButton = _ref => {
|
|
131
123
|
let {
|
|
132
124
|
url,
|
|
133
125
|
children,
|
|
134
126
|
path
|
|
135
127
|
} = _ref;
|
|
136
|
-
if (url) return /*#__PURE__*/_jsx(
|
|
128
|
+
if (url) return /*#__PURE__*/_jsx(StyledSafeLinkButton, {
|
|
137
129
|
to: getPossiblyRelativeUrl(url, path),
|
|
130
|
+
target: "_blank",
|
|
131
|
+
variant: "secondary",
|
|
132
|
+
rel: "noopener noreferrer",
|
|
138
133
|
children: children
|
|
139
134
|
});
|
|
140
135
|
return children;
|
|
@@ -148,7 +143,8 @@ const CampaignBlock = _ref2 => {
|
|
|
148
143
|
headingLevel: InternalHeading = "h2",
|
|
149
144
|
url,
|
|
150
145
|
path,
|
|
151
|
-
className
|
|
146
|
+
className,
|
|
147
|
+
background
|
|
152
148
|
} = _ref2;
|
|
153
149
|
const imageComponent = image && /*#__PURE__*/_jsx(StyledImg, {
|
|
154
150
|
src: `${image.src}?width=455`,
|
|
@@ -156,34 +152,27 @@ const CampaignBlock = _ref2 => {
|
|
|
156
152
|
width: 455,
|
|
157
153
|
alt: image.alt
|
|
158
154
|
});
|
|
159
|
-
const HeaderComponent = url?.url ? LinkHeader : Text;
|
|
160
155
|
return /*#__PURE__*/_jsx(Wrapper, {
|
|
161
156
|
children: /*#__PURE__*/_jsxs(Container, {
|
|
162
157
|
className: className,
|
|
163
158
|
"data-embed-type": "campaign-block",
|
|
164
159
|
imageSide: imageSide,
|
|
160
|
+
background: background,
|
|
165
161
|
children: [imageSide === "left" && imageComponent, /*#__PURE__*/_jsxs(ContentWrapper, {
|
|
166
|
-
children: [/*#__PURE__*/_jsx(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
textStyle: "heading.small",
|
|
173
|
-
children: /*#__PURE__*/_jsx(InternalHeading, {
|
|
174
|
-
children: parse(title)
|
|
175
|
-
})
|
|
162
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
163
|
+
asChild: true,
|
|
164
|
+
consumeCss: true,
|
|
165
|
+
textStyle: "heading.small",
|
|
166
|
+
children: /*#__PURE__*/_jsx(InternalHeading, {
|
|
167
|
+
children: parse(title)
|
|
176
168
|
})
|
|
177
169
|
}), /*#__PURE__*/_jsx(StyledText, {
|
|
178
170
|
textStyle: "body.xlarge",
|
|
179
171
|
children: parse(description)
|
|
180
|
-
}), !!url?.url && /*#__PURE__*/
|
|
172
|
+
}), !!url?.url && /*#__PURE__*/_jsxs(LinkButton, {
|
|
181
173
|
url: url.url,
|
|
182
174
|
path: path,
|
|
183
|
-
children: /*#__PURE__*/
|
|
184
|
-
textStyle: "body.medium",
|
|
185
|
-
children: [parse(url.text ?? ""), /*#__PURE__*/_jsx(ArrowRightLine, {})]
|
|
186
|
-
})
|
|
175
|
+
children: [parse(url.text ?? ""), /*#__PURE__*/_jsx(ArrowRightLine, {})]
|
|
187
176
|
})]
|
|
188
177
|
}), imageSide !== "left" && imageComponent]
|
|
189
178
|
})
|
package/es/Embed/CodeEmbed.js
CHANGED
|
@@ -13,9 +13,8 @@ import { CheckLine } from "@ndla/icons/editor";
|
|
|
13
13
|
import { Button, Figure } from "@ndla/primitives";
|
|
14
14
|
import { styled } from "@ndla/styled-system/jsx";
|
|
15
15
|
import { copyTextToClipboard } from "@ndla/util";
|
|
16
|
+
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
16
17
|
import { CodeBlock, codeLanguageOptions } from "../CodeBlock";
|
|
17
|
-
|
|
18
|
-
// TODO: We need an error state for this
|
|
19
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
19
|
const StyledFigCaption = styled("figcaption", {
|
|
21
20
|
base: {
|
|
@@ -55,6 +54,11 @@ const CodeEmbed = _ref => {
|
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
56
|
}, [isCopied]);
|
|
57
|
+
if (embed.status === "error") {
|
|
58
|
+
return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
|
|
59
|
+
type: "code"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
58
62
|
return /*#__PURE__*/_jsxs(StyledFigure, {
|
|
59
63
|
"data-embed-type": "code-block",
|
|
60
64
|
children: [/*#__PURE__*/_jsx(StyledFigCaption, {
|
package/es/Embed/ConceptEmbed.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Report } from "@ndla/icons/common";
|
|
10
10
|
import { Figure } from "@ndla/primitives";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
12
|
import { EmbedByline } from "../LicenseByline";
|
|
@@ -16,16 +16,15 @@ const ErrorPlaceholder = styled("div", {
|
|
|
16
16
|
display: "flex",
|
|
17
17
|
alignItems: "center",
|
|
18
18
|
justifyContent: "center",
|
|
19
|
-
|
|
19
|
+
background: "background.subtle",
|
|
20
20
|
height: "surface.xsmall",
|
|
21
|
+
border: "1px solid",
|
|
22
|
+
borderColor: "stroke.default",
|
|
21
23
|
borderRadius: "xsmall",
|
|
22
24
|
"& svg": {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
"&[data-embed-type='audio']": {
|
|
28
|
-
height: "surface.3xsmall"
|
|
25
|
+
height: "5xlarge",
|
|
26
|
+
width: "5xlarge",
|
|
27
|
+
fill: "stroke.default"
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
});
|
|
@@ -49,7 +48,7 @@ const EmbedErrorPlaceholder = _ref => {
|
|
|
49
48
|
"data-embed-type": type,
|
|
50
49
|
children: [children ?? /*#__PURE__*/_jsx(ErrorPlaceholder, {
|
|
51
50
|
"data-embed-type": type,
|
|
52
|
-
children: /*#__PURE__*/_jsx(
|
|
51
|
+
children: /*#__PURE__*/_jsx(Report, {})
|
|
53
52
|
}), /*#__PURE__*/_jsx(EmbedByline, {
|
|
54
53
|
error: true,
|
|
55
54
|
type: type
|
package/es/locale/messages-en.js
CHANGED
package/es/locale/messages-nb.js
CHANGED
package/es/locale/messages-nn.js
CHANGED
package/es/locale/messages-se.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
+
import { CampaignBlockEmbedData } from "@ndla/types-embed";
|
|
8
9
|
import { HeadingLevel } from "../types";
|
|
9
10
|
interface Image {
|
|
10
11
|
src: string;
|
|
@@ -19,9 +20,10 @@ interface Props {
|
|
|
19
20
|
text?: string;
|
|
20
21
|
};
|
|
21
22
|
image?: Image;
|
|
22
|
-
imageSide?: "
|
|
23
|
+
imageSide?: CampaignBlockEmbedData["imageSide"];
|
|
23
24
|
className?: string;
|
|
24
25
|
path?: string;
|
|
26
|
+
background?: CampaignBlockEmbedData["background"];
|
|
25
27
|
}
|
|
26
|
-
declare const CampaignBlock: ({ title, image, imageSide, description, headingLevel: InternalHeading, url, path, className, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare const CampaignBlock: ({ title, image, imageSide, description, headingLevel: InternalHeading, url, path, className, background, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export default CampaignBlock;
|
|
@@ -31,7 +31,6 @@ const Container = (0, _jsx2.styled)("div", {
|
|
|
31
31
|
base: {
|
|
32
32
|
display: "grid",
|
|
33
33
|
gridTemplateColumns: "1fr",
|
|
34
|
-
gap: "medium",
|
|
35
34
|
border: "1px solid",
|
|
36
35
|
borderColor: "stroke.default",
|
|
37
36
|
backgroundColor: "background.default",
|
|
@@ -61,31 +60,20 @@ const Container = (0, _jsx2.styled)("div", {
|
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
}
|
|
63
|
+
},
|
|
64
|
+
background: {
|
|
65
|
+
neutral: {},
|
|
66
|
+
brand1: {
|
|
67
|
+
backgroundColor: "surface.brand.1"
|
|
68
|
+
},
|
|
69
|
+
brand3: {
|
|
70
|
+
backgroundColor: "surface.brand.3"
|
|
71
|
+
}
|
|
64
72
|
}
|
|
65
73
|
},
|
|
66
74
|
defaultVariants: {
|
|
67
|
-
imageSide: "left"
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
const LinkText = (0, _jsx2.styled)(_primitives.Text, {
|
|
71
|
-
base: {
|
|
72
|
-
display: "flex",
|
|
73
|
-
gap: "xxsmall",
|
|
74
|
-
textDecoration: "underline",
|
|
75
|
-
_hover: {
|
|
76
|
-
textDecoration: "none"
|
|
77
|
-
},
|
|
78
|
-
paddingBlock: "xsmall",
|
|
79
|
-
fontWeight: "bold"
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
const LinkHeader = (0, _jsx2.styled)(_primitives.Text, {
|
|
83
|
-
base: {
|
|
84
|
-
display: "flex",
|
|
85
|
-
textDecoration: "underline",
|
|
86
|
-
_hover: {
|
|
87
|
-
textDecoration: "none"
|
|
88
|
-
}
|
|
75
|
+
imageSide: "left",
|
|
76
|
+
background: "neutral"
|
|
89
77
|
}
|
|
90
78
|
});
|
|
91
79
|
const StyledImg = (0, _jsx2.styled)("img", {
|
|
@@ -103,7 +91,8 @@ const StyledImg = (0, _jsx2.styled)("img", {
|
|
|
103
91
|
tabletWide: {
|
|
104
92
|
height: "340px"
|
|
105
93
|
}
|
|
106
|
-
}
|
|
94
|
+
},
|
|
95
|
+
backgroundColor: "background.default"
|
|
107
96
|
}
|
|
108
97
|
});
|
|
109
98
|
const ContentWrapper = (0, _jsx2.styled)("div", {
|
|
@@ -115,7 +104,8 @@ const ContentWrapper = (0, _jsx2.styled)("div", {
|
|
|
115
104
|
alignItems: "flex-start",
|
|
116
105
|
justifyContent: "center",
|
|
117
106
|
paddingBlock: "medium",
|
|
118
|
-
paddingInline: "medium"
|
|
107
|
+
paddingInline: "medium",
|
|
108
|
+
position: "relative"
|
|
119
109
|
}
|
|
120
110
|
});
|
|
121
111
|
const StyledText = (0, _jsx2.styled)(_primitives.Text, {
|
|
@@ -129,19 +119,24 @@ const StyledText = (0, _jsx2.styled)(_primitives.Text, {
|
|
|
129
119
|
}
|
|
130
120
|
}
|
|
131
121
|
});
|
|
132
|
-
const
|
|
122
|
+
const StyledSafeLinkButton = (0, _jsx2.styled)(_safelink.SafeLinkButton, {
|
|
133
123
|
base: {
|
|
134
|
-
|
|
124
|
+
boxShadow: "full",
|
|
125
|
+
border: "1px solid",
|
|
126
|
+
borderColor: "stroke.default"
|
|
135
127
|
}
|
|
136
128
|
});
|
|
137
|
-
const
|
|
129
|
+
const LinkButton = _ref => {
|
|
138
130
|
let {
|
|
139
131
|
url,
|
|
140
132
|
children,
|
|
141
133
|
path
|
|
142
134
|
} = _ref;
|
|
143
|
-
if (url) return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
135
|
+
if (url) return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSafeLinkButton, {
|
|
144
136
|
to: (0, _relativeUrl.getPossiblyRelativeUrl)(url, path),
|
|
137
|
+
target: "_blank",
|
|
138
|
+
variant: "secondary",
|
|
139
|
+
rel: "noopener noreferrer",
|
|
145
140
|
children: children
|
|
146
141
|
});
|
|
147
142
|
return children;
|
|
@@ -155,7 +150,8 @@ const CampaignBlock = _ref2 => {
|
|
|
155
150
|
headingLevel: InternalHeading = "h2",
|
|
156
151
|
url,
|
|
157
152
|
path,
|
|
158
|
-
className
|
|
153
|
+
className,
|
|
154
|
+
background
|
|
159
155
|
} = _ref2;
|
|
160
156
|
const imageComponent = image && /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImg, {
|
|
161
157
|
src: `${image.src}?width=455`,
|
|
@@ -163,34 +159,27 @@ const CampaignBlock = _ref2 => {
|
|
|
163
159
|
width: 455,
|
|
164
160
|
alt: image.alt
|
|
165
161
|
});
|
|
166
|
-
const HeaderComponent = url?.url ? LinkHeader : _primitives.Text;
|
|
167
162
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
168
163
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
169
164
|
className: className,
|
|
170
165
|
"data-embed-type": "campaign-block",
|
|
171
166
|
imageSide: imageSide,
|
|
167
|
+
background: background,
|
|
172
168
|
children: [imageSide === "left" && imageComponent, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
173
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
textStyle: "heading.small",
|
|
180
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalHeading, {
|
|
181
|
-
children: (0, _htmlReactParser.default)(title)
|
|
182
|
-
})
|
|
169
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
170
|
+
asChild: true,
|
|
171
|
+
consumeCss: true,
|
|
172
|
+
textStyle: "heading.small",
|
|
173
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InternalHeading, {
|
|
174
|
+
children: (0, _htmlReactParser.default)(title)
|
|
183
175
|
})
|
|
184
176
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, {
|
|
185
177
|
textStyle: "body.xlarge",
|
|
186
178
|
children: (0, _htmlReactParser.default)(description)
|
|
187
|
-
}), !!url?.url && /*#__PURE__*/(0, _jsxRuntime.
|
|
179
|
+
}), !!url?.url && /*#__PURE__*/(0, _jsxRuntime.jsxs)(LinkButton, {
|
|
188
180
|
url: url.url,
|
|
189
181
|
path: path,
|
|
190
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
191
|
-
textStyle: "body.medium",
|
|
192
|
-
children: [(0, _htmlReactParser.default)(url.text ?? ""), /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.ArrowRightLine, {})]
|
|
193
|
-
})
|
|
182
|
+
children: [(0, _htmlReactParser.default)(url.text ?? ""), /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.ArrowRightLine, {})]
|
|
194
183
|
})]
|
|
195
184
|
}), imageSide !== "left" && imageComponent]
|
|
196
185
|
})
|
package/lib/Embed/CodeEmbed.js
CHANGED
|
@@ -11,8 +11,10 @@ var _editor = require("@ndla/icons/editor");
|
|
|
11
11
|
var _primitives = require("@ndla/primitives");
|
|
12
12
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
13
13
|
var _util = require("@ndla/util");
|
|
14
|
+
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
14
15
|
var _CodeBlock = require("../CodeBlock");
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
18
|
/**
|
|
17
19
|
* Copyright (c) 2023-present, NDLA.
|
|
18
20
|
*
|
|
@@ -21,8 +23,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
23
|
*
|
|
22
24
|
*/
|
|
23
25
|
|
|
24
|
-
// TODO: We need an error state for this
|
|
25
|
-
|
|
26
26
|
const StyledFigCaption = (0, _jsx2.styled)("figcaption", {
|
|
27
27
|
base: {
|
|
28
28
|
textStyle: "label.large",
|
|
@@ -61,6 +61,11 @@ const CodeEmbed = _ref => {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
}, [isCopied]);
|
|
64
|
+
if (embed.status === "error") {
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
66
|
+
type: "code"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
64
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledFigure, {
|
|
65
70
|
"data-embed-type": "code-block",
|
|
66
71
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigCaption, {
|
|
@@ -47,6 +47,7 @@ const ConceptEmbed = _ref => {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
if (embed.status === "error") {
|
|
50
|
+
// TODO: This could be either concept or gloss. We don't know if it errors out. :)
|
|
50
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_EmbedErrorPlaceholder.default, {
|
|
51
52
|
type: "gloss"
|
|
52
53
|
});
|
|
@@ -22,16 +22,15 @@ const ErrorPlaceholder = (0, _jsx2.styled)("div", {
|
|
|
22
22
|
display: "flex",
|
|
23
23
|
alignItems: "center",
|
|
24
24
|
justifyContent: "center",
|
|
25
|
-
|
|
25
|
+
background: "background.subtle",
|
|
26
26
|
height: "surface.xsmall",
|
|
27
|
+
border: "1px solid",
|
|
28
|
+
borderColor: "stroke.default",
|
|
27
29
|
borderRadius: "xsmall",
|
|
28
30
|
"& svg": {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
"&[data-embed-type='audio']": {
|
|
34
|
-
height: "surface.3xsmall"
|
|
31
|
+
height: "5xlarge",
|
|
32
|
+
width: "5xlarge",
|
|
33
|
+
fill: "stroke.default"
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
});
|
|
@@ -55,7 +54,7 @@ const EmbedErrorPlaceholder = _ref => {
|
|
|
55
54
|
"data-embed-type": type,
|
|
56
55
|
children: [children ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorPlaceholder, {
|
|
57
56
|
"data-embed-type": type,
|
|
58
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.
|
|
57
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_common.Report, {})
|
|
59
58
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseByline.EmbedByline, {
|
|
60
59
|
error: true,
|
|
61
60
|
type: type
|
|
@@ -20,7 +20,7 @@ interface BaseProps {
|
|
|
20
20
|
hideCopyright?: boolean;
|
|
21
21
|
}
|
|
22
22
|
export interface EmbedBylineErrorProps extends BaseProps {
|
|
23
|
-
type: EmbedBylineTypeProps["type"] | "h5p" | "external";
|
|
23
|
+
type: EmbedBylineTypeProps["type"] | "h5p" | "external" | "code";
|
|
24
24
|
error: true;
|
|
25
25
|
}
|
|
26
26
|
interface ImageProps extends BaseProps {
|