@ndla/ui 56.0.81-alpha.0 → 56.0.83-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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ndla-ui
2
2
 
3
- Main UI component library for NDLA
3
+ Main UI component library for NDLA.
4
4
 
5
5
  ## Installation
6
6
 
@@ -116,11 +116,7 @@ export const ArticleByline = _ref => {
116
116
  return /*#__PURE__*/_jsxs(Wrapper, {
117
117
  children: [!!displayByline && /*#__PURE__*/_jsxs(TextWrapper, {
118
118
  learningpath: bylineType === "learningPath",
119
- children: [!!showPrimaryContributors &&
120
- /*#__PURE__*/
121
- //eslint-disable-next-line react/no-unknown-property
122
- _jsxs("span", {
123
- property: "cc:attributionName",
119
+ children: [!!showPrimaryContributors && /*#__PURE__*/_jsxs("span", {
124
120
  children: [authors.length > 0 && `${t("article.authorsLabel", {
125
121
  names: renderContributors(authors, t),
126
122
  interpolation: {
@@ -30,12 +30,13 @@ const RelatedContentEmbed = _ref => {
30
30
  if (embedData.articleId && data) {
31
31
  const typeId = data.resource?.resourceTypes.find(rt => contentTypeMapping[rt.id])?.id;
32
32
  const type = typeId ? contentTypeMapping[typeId] : undefined;
33
- const path = data.resource?.paths.find(p => p.split("/")[1] === subject?.replace("urn:", "")) ?? data.resource?.path ?? `/article/${embedData.articleId}`;
33
+ const context = data.resource?.contexts.find(c => c.rootId === subject);
34
+ const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
34
35
  return /*#__PURE__*/_jsx(RelatedArticle, {
35
36
  title: data.article.title?.title ?? "",
36
37
  introduction: data.article.metaDescription?.metaDescription ?? "",
37
38
  target: isOembed ? "_blank" : undefined,
38
- to: `${ndlaFrontendDomain ?? ""}${path ?? ""}`,
39
+ to: `${ndlaFrontendDomain ?? ""}${url ?? ""}`,
39
40
  type: type
40
41
  });
41
42
  }
@@ -186,7 +186,6 @@ export const LicenseContainerContent = _ref3 => {
186
186
  const [isOpen, setIsOpen] = useState(false);
187
187
  const content = /*#__PURE__*/_jsxs(_Fragment, {
188
188
  children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/_jsx("span", {
189
- property: "cc:attributionName",
190
189
  children: captionAuthors.map(author => author.name).join(", ")
191
190
  }), license ? /*#__PURE__*/_jsxs(_Fragment, {
192
191
  children: [" / ", /*#__PURE__*/_jsx(LicenseLink, {
@@ -122,11 +122,7 @@ const ArticleByline = _ref => {
122
122
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
123
123
  children: [!!displayByline && /*#__PURE__*/(0, _jsxRuntime.jsxs)(TextWrapper, {
124
124
  learningpath: bylineType === "learningPath",
125
- children: [!!showPrimaryContributors &&
126
- /*#__PURE__*/
127
- //eslint-disable-next-line react/no-unknown-property
128
- (0, _jsxRuntime.jsxs)("span", {
129
- property: "cc:attributionName",
125
+ children: [!!showPrimaryContributors && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
130
126
  children: [authors.length > 0 && `${t("article.authorsLabel", {
131
127
  names: renderContributors(authors, t),
132
128
  interpolation: {
@@ -36,12 +36,13 @@ const RelatedContentEmbed = _ref => {
36
36
  if (embedData.articleId && data) {
37
37
  const typeId = data.resource?.resourceTypes.find(rt => _ContentType.contentTypeMapping[rt.id])?.id;
38
38
  const type = typeId ? _ContentType.contentTypeMapping[typeId] : undefined;
39
- const path = data.resource?.paths.find(p => p.split("/")[1] === subject?.replace("urn:", "")) ?? data.resource?.path ?? `/article/${embedData.articleId}`;
39
+ const context = data.resource?.contexts.find(c => c.rootId === subject);
40
+ const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
40
41
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelatedArticleList.RelatedArticle, {
41
42
  title: data.article.title?.title ?? "",
42
43
  introduction: data.article.metaDescription?.metaDescription ?? "",
43
44
  target: isOembed ? "_blank" : undefined,
44
- to: `${ndlaFrontendDomain ?? ""}${path ?? ""}`,
45
+ to: `${ndlaFrontendDomain ?? ""}${url ?? ""}`,
45
46
  type: type
46
47
  });
47
48
  }
@@ -193,7 +193,6 @@ const LicenseContainerContent = _ref3 => {
193
193
  const [isOpen, setIsOpen] = (0, _react.useState)(false);
194
194
  const content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
195
195
  children: [children, ` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
196
- property: "cc:attributionName",
197
196
  children: captionAuthors.map(author => author.name).join(", ")
198
197
  }), license ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
199
198
  children: [" / ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_LicenseLink.LicenseLink, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.81-alpha.0",
3
+ "version": "56.0.83-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.48-alpha.0",
37
37
  "@ndla/licenses": "^8.0.6-alpha.0",
38
- "@ndla/primitives": "^1.0.65-alpha.0",
39
- "@ndla/safelink": "^7.0.66-alpha.0",
38
+ "@ndla/primitives": "^1.0.67-alpha.0",
39
+ "@ndla/safelink": "^7.0.68-alpha.0",
40
40
  "@ndla/styled-system": "^0.0.29",
41
41
  "@ndla/util": "^5.0.5-alpha.0",
42
42
  "html-react-parser": "^5.1.19",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "3d07532b83827e3b1dd62cbcfbe316797db14d4e"
61
+ "gitHead": "05b33be72aef0446dffee0deac725f630b59ab6b"
62
62
  }
@@ -153,8 +153,7 @@ export const ArticleByline = ({
153
153
  {!!displayByline && (
154
154
  <TextWrapper learningpath={bylineType === "learningPath"}>
155
155
  {!!showPrimaryContributors && (
156
- //eslint-disable-next-line react/no-unknown-property
157
- <span property="cc:attributionName">
156
+ <span>
158
157
  {authors.length > 0 &&
159
158
  `${t("article.authorsLabel", {
160
159
  names: renderContributors(authors, t),
@@ -29,16 +29,14 @@ const RelatedContentEmbed = ({ embed, isOembed, subject, ndlaFrontendDomain }: P
29
29
  if (embedData.articleId && data) {
30
30
  const typeId = data.resource?.resourceTypes.find((rt) => contentTypeMapping[rt.id])?.id;
31
31
  const type = typeId ? contentTypeMapping[typeId] : undefined;
32
- const path =
33
- data.resource?.paths.find((p) => p.split("/")[1] === subject?.replace("urn:", "")) ??
34
- data.resource?.path ??
35
- `/article/${embedData.articleId}`;
32
+ const context = data.resource?.contexts.find((c) => c.rootId === subject);
33
+ const url = context?.url ?? data.resource?.url ?? `/article/${embedData.articleId}`;
36
34
  return (
37
35
  <RelatedArticle
38
36
  title={data.article.title?.title ?? ""}
39
37
  introduction={data.article.metaDescription?.metaDescription ?? ""}
40
38
  target={isOembed ? "_blank" : undefined}
41
- to={`${ndlaFrontendDomain ?? ""}${path ?? ""}`}
39
+ to={`${ndlaFrontendDomain ?? ""}${url ?? ""}`}
42
40
  type={type}
43
41
  />
44
42
  );
@@ -244,8 +244,7 @@ export const LicenseContainerContent = ({ children, copyright, type }: LicenseCo
244
244
  <>
245
245
  {children}
246
246
  {` ${t(`embed.type.${type}`)}${captionAuthors.length ? ": " : ""}`}
247
- {/*eslint-disable-next-line react/no-unknown-property */}
248
- <span property="cc:attributionName">{captionAuthors.map((author) => author.name).join(", ")}</span>
247
+ <span>{captionAuthors.map((author) => author.name).join(", ")}</span>
249
248
  {license ? (
250
249
  <>
251
250
  {" / "}