@ndla/ui 56.0.92-alpha.0 → 56.0.93-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 +3 -8
- package/dist/styles.css +12 -35
- package/es/Article/ArticleByline.js +2 -2
- package/es/Embed/ExternalEmbed.js +2 -77
- package/es/ResourceBox/ResourceBox.js +2 -2
- package/lib/Article/ArticleByline.js +2 -2
- package/lib/Embed/ExternalEmbed.js +0 -75
- package/lib/ResourceBox/ResourceBox.d.ts +1 -1
- package/lib/ResourceBox/ResourceBox.js +2 -2
- package/package.json +5 -5
- package/src/Article/ArticleByline.tsx +5 -3
- package/src/Embed/ExternalEmbed.stories.tsx +0 -11
- package/src/Embed/ExternalEmbed.tsx +1 -77
- package/src/ResourceBox/ResourceBox.tsx +9 -7
|
@@ -219,14 +219,6 @@
|
|
|
219
219
|
"clear]___[value:both]___[cond:& + [data-embed-wrapper]",
|
|
220
220
|
"height]___[value:auto]___[cond:& iframe",
|
|
221
221
|
"width]___[value:100%]___[cond:& iframe",
|
|
222
|
-
"color]___[value:text.link",
|
|
223
|
-
"textDecoration]___[value:unset]___[cond:_hover",
|
|
224
|
-
"backgroundColor]___[value:surface.brand.2.subtle",
|
|
225
|
-
"borderRadius]___[value:xxsmall",
|
|
226
|
-
"borderColor]___[value:stroke.info",
|
|
227
|
-
"lineClamp]___[value:1",
|
|
228
|
-
"inset]___[value:0]___[cond:_before",
|
|
229
|
-
"zIndex]___[value:0]___[cond:_before",
|
|
230
222
|
"textStyle]___[value:label.xsmall]___[cond:& a",
|
|
231
223
|
"marginInlineStart]___[value:1]___[cond:& a",
|
|
232
224
|
"borderRadius]___[value:0]___[cond:& img",
|
|
@@ -298,6 +290,8 @@
|
|
|
298
290
|
"paddingInlineEnd]___[value:medium",
|
|
299
291
|
"paddingInlineStart]___[value:small",
|
|
300
292
|
"flexDirection]___[value:row",
|
|
293
|
+
"inset]___[value:0]___[cond:_before",
|
|
294
|
+
"zIndex]___[value:0]___[cond:_before",
|
|
301
295
|
"background]___[value:surface.infoSubtle",
|
|
302
296
|
"borderBlockEnd]___[value:1px solid",
|
|
303
297
|
"backgroundColor]___[value:surface.infoSubtle.hover]___[cond:_hover",
|
|
@@ -351,6 +345,7 @@
|
|
|
351
345
|
"whiteSpace]___[value:pre-wrap]___[cond:mobileWideDown<___>_open",
|
|
352
346
|
"maxHeight]___[value:none]___[cond:mobileWideDown<___>_open",
|
|
353
347
|
"display]___[value:none]___[cond:mobileWide",
|
|
348
|
+
"color]___[value:text.link",
|
|
354
349
|
"whiteSpace]___[value:nowrap",
|
|
355
350
|
"textDecoration]___[value:none]___[cond:_focusWithin",
|
|
356
351
|
"display]___[value:none]___[cond:mobileWideDown<___>_disabled",
|
package/dist/styles.css
CHANGED
|
@@ -445,21 +445,6 @@
|
|
|
445
445
|
background: var(--colors-background-subtle);
|
|
446
446
|
}
|
|
447
447
|
|
|
448
|
-
.c_text\.link {
|
|
449
|
-
color: var(--colors-text-link);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
.bdr_xxsmall {
|
|
453
|
-
border-radius: xxsmall;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.lc_1 {
|
|
457
|
-
overflow: hidden;
|
|
458
|
-
display: -webkit-box;
|
|
459
|
-
-webkit-line-clamp: 1;
|
|
460
|
-
-webkit-box-orient: vertical;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
448
|
.z_docked {
|
|
464
449
|
z-index: var(--z-index-docked);
|
|
465
450
|
}
|
|
@@ -544,6 +529,10 @@
|
|
|
544
529
|
white-space: pre-wrap;
|
|
545
530
|
}
|
|
546
531
|
|
|
532
|
+
.c_text\.link {
|
|
533
|
+
color: var(--colors-text-link);
|
|
534
|
+
}
|
|
535
|
+
|
|
547
536
|
.white-space_nowrap {
|
|
548
537
|
white-space: nowrap;
|
|
549
538
|
}
|
|
@@ -680,14 +669,6 @@
|
|
|
680
669
|
border-color: var(--colors-stroke-hover);
|
|
681
670
|
}
|
|
682
671
|
|
|
683
|
-
.bg-c_surface\.brand\.2\.subtle {
|
|
684
|
-
background-color: var(--colors-surface-brand-2-subtle);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
.bd-c_stroke\.info {
|
|
688
|
-
border-color: var(--colors-stroke-info);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
672
|
.top_xsmall {
|
|
692
673
|
top: var(--spacing-xsmall);
|
|
693
674
|
}
|
|
@@ -918,14 +899,6 @@
|
|
|
918
899
|
width: 100%;
|
|
919
900
|
}
|
|
920
901
|
|
|
921
|
-
.before\:inset_0::before {
|
|
922
|
-
inset: 0;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.before\:z_0::before {
|
|
926
|
-
z-index: 0;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
902
|
.\[\&_a\]\:ms_1 a {
|
|
930
903
|
margin-inline-start: var(--spacing-1);
|
|
931
904
|
}
|
|
@@ -994,6 +967,14 @@
|
|
|
994
967
|
padding-block-end: var(--spacing-xsmall);
|
|
995
968
|
}
|
|
996
969
|
|
|
970
|
+
.before\:inset_0::before {
|
|
971
|
+
inset: 0;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.before\:z_0::before {
|
|
975
|
+
z-index: 0;
|
|
976
|
+
}
|
|
977
|
+
|
|
997
978
|
.first\:bg_surface\.brand\.1\.subtle:first-child {
|
|
998
979
|
background: var(--colors-surface-brand-1-subtle);
|
|
999
980
|
}
|
|
@@ -1149,10 +1130,6 @@
|
|
|
1149
1130
|
background: var(--colors-surface-action-subtle-hover);
|
|
1150
1131
|
}
|
|
1151
1132
|
|
|
1152
|
-
.hover\:td_unset:is(:hover, [data-hover]) {
|
|
1153
|
-
text-decoration: unset;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
1133
|
.hover\:bd-c_text\.link:is(:hover, [data-hover]) {
|
|
1157
1134
|
border-color: var(--colors-text-link);
|
|
1158
1135
|
}
|
|
@@ -123,10 +123,10 @@ export const ArticleByline = _ref => {
|
|
|
123
123
|
escapeValue: false
|
|
124
124
|
}
|
|
125
125
|
})}. `, getSuppliersText(suppliers, t)]
|
|
126
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
126
|
+
}), published ? /*#__PURE__*/_jsxs("div", {
|
|
127
127
|
"data-contributors": showPrimaryContributors,
|
|
128
128
|
children: [t(`${bylineType}.lastUpdated`), " ", published]
|
|
129
|
-
})]
|
|
129
|
+
}) : null]
|
|
130
130
|
}), (!!licenseBox || !!footnotes?.length) && /*#__PURE__*/_jsxs(StyledAccordionRoot, {
|
|
131
131
|
multiple: true,
|
|
132
132
|
value: openAccordions,
|
|
@@ -8,14 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
import { useEffect, useRef } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import {
|
|
12
|
-
import { Figure, Text } from "@ndla/primitives";
|
|
13
|
-
import { SafeLink } from "@ndla/safelink";
|
|
11
|
+
import { Figure } from "@ndla/primitives";
|
|
14
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import { linkOverlay } from "@ndla/styled-system/patterns";
|
|
16
13
|
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
17
14
|
import { ResourceBox } from "../ResourceBox";
|
|
18
|
-
import { jsx as _jsx
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
16
|
const StyledFigure = styled(Figure, {
|
|
20
17
|
base: {
|
|
21
18
|
"& iframe": {
|
|
@@ -24,54 +21,6 @@ const StyledFigure = styled(Figure, {
|
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
});
|
|
27
|
-
|
|
28
|
-
// TODO: Move this to own component in UI? Use variant of existing?
|
|
29
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
30
|
-
base: {
|
|
31
|
-
textDecoration: "underline",
|
|
32
|
-
textStyle: "label.large",
|
|
33
|
-
color: "text.link",
|
|
34
|
-
fontWeight: "bold",
|
|
35
|
-
_hover: {
|
|
36
|
-
textDecoration: "unset"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const LinkWrapper = styled("div", {
|
|
41
|
-
base: {
|
|
42
|
-
display: "flex",
|
|
43
|
-
alignItems: "center",
|
|
44
|
-
justifyContent: "space-between",
|
|
45
|
-
gap: "xsmall"
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const TextWrapper = styled("div", {
|
|
49
|
-
base: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
flexDirection: "column",
|
|
52
|
-
alignItems: "flex-start",
|
|
53
|
-
gap: "xxsmall"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
const Wrapper = styled("div", {
|
|
57
|
-
base: {
|
|
58
|
-
display: "flex",
|
|
59
|
-
width: "100%",
|
|
60
|
-
gap: "small",
|
|
61
|
-
flexDirection: "column",
|
|
62
|
-
backgroundColor: "surface.brand.2.subtle",
|
|
63
|
-
borderRadius: "xxsmall",
|
|
64
|
-
padding: "medium",
|
|
65
|
-
border: "1px solid",
|
|
66
|
-
borderColor: "stroke.info"
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
const UrlText = styled(Text, {
|
|
70
|
-
base: {
|
|
71
|
-
lineClamp: "1",
|
|
72
|
-
overflow: "hidden"
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
24
|
const ExternalEmbed = _ref => {
|
|
76
25
|
let {
|
|
77
26
|
embed
|
|
@@ -114,30 +63,6 @@ const ExternalEmbed = _ref => {
|
|
|
114
63
|
})
|
|
115
64
|
});
|
|
116
65
|
}
|
|
117
|
-
if (embedData.type === "link") {
|
|
118
|
-
return /*#__PURE__*/_jsx(Figure, {
|
|
119
|
-
"data-embed-type": "external",
|
|
120
|
-
children: /*#__PURE__*/_jsxs(Wrapper, {
|
|
121
|
-
children: [/*#__PURE__*/_jsxs(LinkWrapper, {
|
|
122
|
-
children: [/*#__PURE__*/_jsxs(TextWrapper, {
|
|
123
|
-
children: [/*#__PURE__*/_jsx(StyledSafeLink, {
|
|
124
|
-
to: embedData.url,
|
|
125
|
-
unstyled: true,
|
|
126
|
-
css: linkOverlay.raw(),
|
|
127
|
-
children: embedData.title
|
|
128
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
129
|
-
textStyle: "label.medium",
|
|
130
|
-
children: embedData.caption
|
|
131
|
-
})]
|
|
132
|
-
}), /*#__PURE__*/_jsx(ArrowRightShortLine, {})]
|
|
133
|
-
}), /*#__PURE__*/_jsx(UrlText, {
|
|
134
|
-
textStyle: "label.medium",
|
|
135
|
-
color: "text.subtle",
|
|
136
|
-
children: embedData.url
|
|
137
|
-
})]
|
|
138
|
-
})
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
66
|
return /*#__PURE__*/_jsx(StyledFigure, {
|
|
142
67
|
"data-embed-type": "external",
|
|
143
68
|
ref: figRef,
|
|
@@ -70,12 +70,12 @@ export const ResourceBox = _ref => {
|
|
|
70
70
|
buttonText
|
|
71
71
|
} = _ref;
|
|
72
72
|
return /*#__PURE__*/_jsxs(Container, {
|
|
73
|
-
children: [/*#__PURE__*/_jsx(StyledImage, {
|
|
73
|
+
children: [image ? /*#__PURE__*/_jsx(StyledImage, {
|
|
74
74
|
src: image.src,
|
|
75
75
|
alt: image.alt,
|
|
76
76
|
sizes: `(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`,
|
|
77
77
|
variant: "rounded"
|
|
78
|
-
}), /*#__PURE__*/_jsxs(ContentWrapper, {
|
|
78
|
+
}) : null, /*#__PURE__*/_jsxs(ContentWrapper, {
|
|
79
79
|
children: [/*#__PURE__*/_jsx(Heading, {
|
|
80
80
|
textStyle: "label.large",
|
|
81
81
|
fontWeight: "bold",
|
|
@@ -129,10 +129,10 @@ const ArticleByline = _ref => {
|
|
|
129
129
|
escapeValue: false
|
|
130
130
|
}
|
|
131
131
|
})}. `, getSuppliersText(suppliers, t)]
|
|
132
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
132
|
+
}), published ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
133
133
|
"data-contributors": showPrimaryContributors,
|
|
134
134
|
children: [t(`${bylineType}.lastUpdated`), " ", published]
|
|
135
|
-
})]
|
|
135
|
+
}) : null]
|
|
136
136
|
}), (!!licenseBox || !!footnotes?.length) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledAccordionRoot, {
|
|
137
137
|
multiple: true,
|
|
138
138
|
value: openAccordions,
|
|
@@ -6,11 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactI18next = require("react-i18next");
|
|
9
|
-
var _icons = require("@ndla/icons");
|
|
10
9
|
var _primitives = require("@ndla/primitives");
|
|
11
|
-
var _safelink = require("@ndla/safelink");
|
|
12
10
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
13
|
-
var _patterns = require("@ndla/styled-system/patterns");
|
|
14
11
|
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
15
12
|
var _ResourceBox = require("../ResourceBox");
|
|
16
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -31,54 +28,6 @@ const StyledFigure = (0, _jsx2.styled)(_primitives.Figure, {
|
|
|
31
28
|
}
|
|
32
29
|
}
|
|
33
30
|
});
|
|
34
|
-
|
|
35
|
-
// TODO: Move this to own component in UI? Use variant of existing?
|
|
36
|
-
const StyledSafeLink = (0, _jsx2.styled)(_safelink.SafeLink, {
|
|
37
|
-
base: {
|
|
38
|
-
textDecoration: "underline",
|
|
39
|
-
textStyle: "label.large",
|
|
40
|
-
color: "text.link",
|
|
41
|
-
fontWeight: "bold",
|
|
42
|
-
_hover: {
|
|
43
|
-
textDecoration: "unset"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
const LinkWrapper = (0, _jsx2.styled)("div", {
|
|
48
|
-
base: {
|
|
49
|
-
display: "flex",
|
|
50
|
-
alignItems: "center",
|
|
51
|
-
justifyContent: "space-between",
|
|
52
|
-
gap: "xsmall"
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
const TextWrapper = (0, _jsx2.styled)("div", {
|
|
56
|
-
base: {
|
|
57
|
-
display: "flex",
|
|
58
|
-
flexDirection: "column",
|
|
59
|
-
alignItems: "flex-start",
|
|
60
|
-
gap: "xxsmall"
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
const Wrapper = (0, _jsx2.styled)("div", {
|
|
64
|
-
base: {
|
|
65
|
-
display: "flex",
|
|
66
|
-
width: "100%",
|
|
67
|
-
gap: "small",
|
|
68
|
-
flexDirection: "column",
|
|
69
|
-
backgroundColor: "surface.brand.2.subtle",
|
|
70
|
-
borderRadius: "xxsmall",
|
|
71
|
-
padding: "medium",
|
|
72
|
-
border: "1px solid",
|
|
73
|
-
borderColor: "stroke.info"
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const UrlText = (0, _jsx2.styled)(_primitives.Text, {
|
|
77
|
-
base: {
|
|
78
|
-
lineClamp: "1",
|
|
79
|
-
overflow: "hidden"
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
31
|
const ExternalEmbed = _ref => {
|
|
83
32
|
let {
|
|
84
33
|
embed
|
|
@@ -121,30 +70,6 @@ const ExternalEmbed = _ref => {
|
|
|
121
70
|
})
|
|
122
71
|
});
|
|
123
72
|
}
|
|
124
|
-
if (embedData.type === "link") {
|
|
125
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
|
|
126
|
-
"data-embed-type": "external",
|
|
127
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
128
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(LinkWrapper, {
|
|
129
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(TextWrapper, {
|
|
130
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledSafeLink, {
|
|
131
|
-
to: embedData.url,
|
|
132
|
-
unstyled: true,
|
|
133
|
-
css: _patterns.linkOverlay.raw(),
|
|
134
|
-
children: embedData.title
|
|
135
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Text, {
|
|
136
|
-
textStyle: "label.medium",
|
|
137
|
-
children: embedData.caption
|
|
138
|
-
})]
|
|
139
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ArrowRightShortLine, {})]
|
|
140
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(UrlText, {
|
|
141
|
-
textStyle: "label.medium",
|
|
142
|
-
color: "text.subtle",
|
|
143
|
-
children: embedData.url
|
|
144
|
-
})]
|
|
145
|
-
})
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledFigure, {
|
|
149
74
|
"data-embed-type": "external",
|
|
150
75
|
ref: figRef,
|
|
@@ -76,12 +76,12 @@ const ResourceBox = _ref => {
|
|
|
76
76
|
buttonText
|
|
77
77
|
} = _ref;
|
|
78
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
79
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImage, {
|
|
79
|
+
children: [image ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImage, {
|
|
80
80
|
src: image.src,
|
|
81
81
|
alt: image.alt,
|
|
82
82
|
sizes: `(min-width: ${_core.breakpoints.desktop}) 150px, (max-width: ${_core.breakpoints.tablet} ) 400px, 200px`,
|
|
83
83
|
variant: "rounded"
|
|
84
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
84
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(ContentWrapper, {
|
|
85
85
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Heading, {
|
|
86
86
|
textStyle: "label.large",
|
|
87
87
|
fontWeight: "bold",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.93-alpha.0",
|
|
4
4
|
"description": "UI component library for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@ndla/core": "^5.0.3",
|
|
36
36
|
"@ndla/icons": "^8.0.50-alpha.0",
|
|
37
37
|
"@ndla/licenses": "^8.0.6-alpha.0",
|
|
38
|
-
"@ndla/primitives": "^1.0.
|
|
39
|
-
"@ndla/safelink": "^7.0.
|
|
38
|
+
"@ndla/primitives": "^1.0.70-alpha.0",
|
|
39
|
+
"@ndla/safelink": "^7.0.71-alpha.0",
|
|
40
40
|
"@ndla/styled-system": "^0.0.30",
|
|
41
41
|
"@ndla/util": "^5.0.5-alpha.0",
|
|
42
42
|
"html-react-parser": "^5.1.19",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@ndla/preset-panda": "^0.0.49",
|
|
54
54
|
"@ndla/types-backend": "^1.0.1",
|
|
55
|
-
"@ndla/types-embed": "^5.0.
|
|
55
|
+
"@ndla/types-embed": "^5.0.10-alpha.0",
|
|
56
56
|
"@pandacss/dev": "^0.48.0"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "bc5f8092371f02515fc71673766a799654edb5e5"
|
|
62
62
|
}
|
|
@@ -162,9 +162,11 @@ export const ArticleByline = ({
|
|
|
162
162
|
{getSuppliersText(suppliers, t)}
|
|
163
163
|
</span>
|
|
164
164
|
)}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
{published ? (
|
|
166
|
+
<div data-contributors={showPrimaryContributors}>
|
|
167
|
+
{t(`${bylineType}.lastUpdated`)} {published}
|
|
168
|
+
</div>
|
|
169
|
+
) : null}
|
|
168
170
|
</TextWrapper>
|
|
169
171
|
)}
|
|
170
172
|
{(!!licenseBox || !!footnotes?.length) && (
|
|
@@ -174,14 +174,3 @@ export const Fullscreen: StoryObj<typeof ExternalEmbed> = {
|
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
176
|
};
|
|
177
|
-
|
|
178
|
-
export const Link: StoryObj<typeof ExternalEmbed> = {
|
|
179
|
-
args: {
|
|
180
|
-
embed: {
|
|
181
|
-
resource: "external",
|
|
182
|
-
status: "success",
|
|
183
|
-
embedData: { ...embedDataFullscreen, type: "link" },
|
|
184
|
-
data: opensInNewMetaData,
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
};
|
|
@@ -8,11 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import { useEffect, useRef } from "react";
|
|
10
10
|
import { useTranslation } from "react-i18next";
|
|
11
|
-
import {
|
|
12
|
-
import { Figure, Text } from "@ndla/primitives";
|
|
13
|
-
import { SafeLink } from "@ndla/safelink";
|
|
11
|
+
import { Figure } from "@ndla/primitives";
|
|
14
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
15
|
-
import { linkOverlay } from "@ndla/styled-system/patterns";
|
|
16
13
|
import type { OembedMetaData } from "@ndla/types-embed";
|
|
17
14
|
import EmbedErrorPlaceholder from "./EmbedErrorPlaceholder";
|
|
18
15
|
import { ResourceBox } from "../ResourceBox";
|
|
@@ -30,58 +27,6 @@ const StyledFigure = styled(Figure, {
|
|
|
30
27
|
},
|
|
31
28
|
});
|
|
32
29
|
|
|
33
|
-
// TODO: Move this to own component in UI? Use variant of existing?
|
|
34
|
-
const StyledSafeLink = styled(SafeLink, {
|
|
35
|
-
base: {
|
|
36
|
-
textDecoration: "underline",
|
|
37
|
-
textStyle: "label.large",
|
|
38
|
-
color: "text.link",
|
|
39
|
-
fontWeight: "bold",
|
|
40
|
-
_hover: {
|
|
41
|
-
textDecoration: "unset",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const LinkWrapper = styled("div", {
|
|
47
|
-
base: {
|
|
48
|
-
display: "flex",
|
|
49
|
-
alignItems: "center",
|
|
50
|
-
justifyContent: "space-between",
|
|
51
|
-
gap: "xsmall",
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const TextWrapper = styled("div", {
|
|
56
|
-
base: {
|
|
57
|
-
display: "flex",
|
|
58
|
-
flexDirection: "column",
|
|
59
|
-
alignItems: "flex-start",
|
|
60
|
-
gap: "xxsmall",
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const Wrapper = styled("div", {
|
|
65
|
-
base: {
|
|
66
|
-
display: "flex",
|
|
67
|
-
width: "100%",
|
|
68
|
-
gap: "small",
|
|
69
|
-
flexDirection: "column",
|
|
70
|
-
backgroundColor: "surface.brand.2.subtle",
|
|
71
|
-
borderRadius: "xxsmall",
|
|
72
|
-
padding: "medium",
|
|
73
|
-
border: "1px solid",
|
|
74
|
-
borderColor: "stroke.info",
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const UrlText = styled(Text, {
|
|
79
|
-
base: {
|
|
80
|
-
lineClamp: "1",
|
|
81
|
-
overflow: "hidden",
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
|
|
85
30
|
const ExternalEmbed = ({ embed }: Props) => {
|
|
86
31
|
const { t } = useTranslation();
|
|
87
32
|
const figRef = useRef<HTMLElement>(null);
|
|
@@ -120,27 +65,6 @@ const ExternalEmbed = ({ embed }: Props) => {
|
|
|
120
65
|
);
|
|
121
66
|
}
|
|
122
67
|
|
|
123
|
-
if (embedData.type === "link") {
|
|
124
|
-
return (
|
|
125
|
-
<Figure data-embed-type="external">
|
|
126
|
-
<Wrapper>
|
|
127
|
-
<LinkWrapper>
|
|
128
|
-
<TextWrapper>
|
|
129
|
-
<StyledSafeLink to={embedData.url} unstyled css={linkOverlay.raw()}>
|
|
130
|
-
{embedData.title}
|
|
131
|
-
</StyledSafeLink>
|
|
132
|
-
<Text textStyle="label.medium">{embedData.caption}</Text>
|
|
133
|
-
</TextWrapper>
|
|
134
|
-
<ArrowRightShortLine />
|
|
135
|
-
</LinkWrapper>
|
|
136
|
-
<UrlText textStyle="label.medium" color="text.subtle">
|
|
137
|
-
{embedData.url}
|
|
138
|
-
</UrlText>
|
|
139
|
-
</Wrapper>
|
|
140
|
-
</Figure>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
68
|
return (
|
|
145
69
|
<StyledFigure
|
|
146
70
|
data-embed-type="external"
|
|
@@ -71,7 +71,7 @@ interface ImageMeta {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
interface Props {
|
|
74
|
-
image
|
|
74
|
+
image?: ImageMeta;
|
|
75
75
|
title: string;
|
|
76
76
|
caption: string;
|
|
77
77
|
url: string;
|
|
@@ -81,12 +81,14 @@ interface Props {
|
|
|
81
81
|
export const ResourceBox = ({ image, title, caption, url, buttonText }: Props) => {
|
|
82
82
|
return (
|
|
83
83
|
<Container>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
{image ? (
|
|
85
|
+
<StyledImage
|
|
86
|
+
src={image.src}
|
|
87
|
+
alt={image.alt}
|
|
88
|
+
sizes={`(min-width: ${breakpoints.desktop}) 150px, (max-width: ${breakpoints.tablet} ) 400px, 200px`}
|
|
89
|
+
variant="rounded"
|
|
90
|
+
/>
|
|
91
|
+
) : null}
|
|
90
92
|
<ContentWrapper>
|
|
91
93
|
<Heading textStyle="label.large" fontWeight="bold" asChild consumeCss>
|
|
92
94
|
<h3>{title}</h3>
|