@ndla/ui 56.0.35-alpha.0 → 56.0.37-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.
Files changed (63) hide show
  1. package/dist/panda.buildinfo.json +7 -6
  2. package/dist/styles.css +20 -16
  3. package/es/CampaignBlock/CampaignBlock.js +36 -47
  4. package/es/ContentTypeBlockQuote/ContentTypeBlockQuote.js +30 -0
  5. package/es/ContentTypeFramedContent/ContentTypeFramedContent.js +30 -0
  6. package/es/Embed/CodeEmbed.js +6 -2
  7. package/es/Embed/ConceptEmbed.js +1 -0
  8. package/es/Embed/EmbedErrorPlaceholder.js +8 -9
  9. package/es/index.js +2 -0
  10. package/es/locale/messages-en.js +2 -1
  11. package/es/locale/messages-nb.js +2 -1
  12. package/es/locale/messages-nn.js +2 -1
  13. package/es/locale/messages-se.js +2 -1
  14. package/es/locale/messages-sma.js +2 -1
  15. package/lib/CampaignBlock/CampaignBlock.d.ts +4 -2
  16. package/lib/CampaignBlock/CampaignBlock.js +35 -46
  17. package/lib/ContentTypeBadge/ContentTypeBadgeNew.d.ts +2 -1
  18. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.d.ts +17 -0
  19. package/lib/ContentTypeBlockQuote/ContentTypeBlockQuote.js +36 -0
  20. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.d.ts +17 -0
  21. package/lib/ContentTypeFramedContent/ContentTypeFramedContent.js +36 -0
  22. package/lib/Embed/CodeEmbed.js +7 -2
  23. package/lib/Embed/ConceptEmbed.js +1 -0
  24. package/lib/Embed/EmbedErrorPlaceholder.js +7 -8
  25. package/lib/LicenseByline/EmbedByline.d.ts +1 -1
  26. package/lib/index.d.ts +5 -1
  27. package/lib/index.js +14 -0
  28. package/lib/locale/messages-en.d.ts +1 -0
  29. package/lib/locale/messages-en.js +2 -1
  30. package/lib/locale/messages-nb.d.ts +1 -0
  31. package/lib/locale/messages-nb.js +2 -1
  32. package/lib/locale/messages-nn.d.ts +1 -0
  33. package/lib/locale/messages-nn.js +2 -1
  34. package/lib/locale/messages-se.d.ts +1 -0
  35. package/lib/locale/messages-se.js +2 -1
  36. package/lib/locale/messages-sma.d.ts +1 -0
  37. package/lib/locale/messages-sma.js +2 -1
  38. package/package.json +7 -7
  39. package/src/CampaignBlock/CampaignBlock.tsx +43 -44
  40. package/src/ContentTypeBadge/ContentTypeBadgeNew.tsx +5 -2
  41. package/src/ContentTypeBlockQuote/ContentTypeBlockQuote.tsx +36 -0
  42. package/src/ContentTypeFramedContent/ContentTypeFramedContent.tsx +38 -0
  43. package/src/ContentTypeHero/ContentTypeHero.stories.tsx +3 -4
  44. package/src/Embed/AudioEmbed.stories.tsx +3 -3
  45. package/src/Embed/BrightcoveEmbed.stories.tsx +3 -3
  46. package/src/Embed/CodeEmbed.tsx +5 -2
  47. package/src/Embed/ConceptEmbed.stories.tsx +3 -3
  48. package/src/Embed/ConceptEmbed.tsx +1 -0
  49. package/src/Embed/EmbedErrorPlaceholder.tsx +8 -9
  50. package/src/Embed/ExternalEmbed.stories.tsx +3 -3
  51. package/src/Embed/H5pEmbed.stories.tsx +3 -3
  52. package/src/Embed/IframeEmbed.stories.tsx +3 -3
  53. package/src/Embed/ImageEmbed.stories.tsx +3 -4
  54. package/src/Embed/RelatedContentEmbed.stories.tsx +3 -3
  55. package/src/Embed/UuDisclaimerEmbed.stories.tsx +3 -4
  56. package/src/Grid/Grid.stories.tsx +4 -3
  57. package/src/LicenseByline/EmbedByline.tsx +1 -1
  58. package/src/index.ts +7 -1
  59. package/src/locale/messages-en.ts +1 -0
  60. package/src/locale/messages-nb.ts +1 -0
  61. package/src/locale/messages-nn.ts +1 -0
  62. package/src/locale/messages-se.ts +1 -0
  63. package/src/locale/messages-sma.ts +1 -0
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ContentTypeBlockQuote = void 0;
7
+ var _react = require("react");
8
+ var _primitives = require("@ndla/primitives");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /**
11
+ * Copyright (c) 2024-present, NDLA.
12
+ *
13
+ * This source code is licensed under the GPLv3 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ */
17
+
18
+ const contentTypeToVariantMapping = {
19
+ "subject-material": "brand1",
20
+ "source-material": "brand1",
21
+ concept: "brand1",
22
+ "tasks-and-activities": "brand2",
23
+ "assessment-resources": "brand2"
24
+ };
25
+ const ContentTypeBlockQuote = exports.ContentTypeBlockQuote = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
26
+ let {
27
+ variant,
28
+ contentType,
29
+ ...props
30
+ } = _ref;
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.BlockQuote, {
32
+ ...props,
33
+ variant: variant === "colored" && contentType ? contentTypeToVariantMapping[contentType] : undefined,
34
+ ref: ref
35
+ });
36
+ });
@@ -0,0 +1,17 @@
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
+ /// <reference types="react" />
9
+ import { FramedContentProps } from "@ndla/primitives";
10
+ import { ContentType } from "..";
11
+ export type ContentTypeFramedContentVariant = "colored" | "neutral";
12
+ interface Props extends FramedContentProps {
13
+ variant?: ContentTypeFramedContentVariant;
14
+ contentType?: ContentType;
15
+ }
16
+ export declare const ContentTypeFramedContent: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
17
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ContentTypeFramedContent = void 0;
7
+ var _react = require("react");
8
+ var _primitives = require("@ndla/primitives");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ /**
11
+ * Copyright (c) 2024-present, NDLA.
12
+ *
13
+ * This source code is licensed under the GPLv3 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ *
16
+ */
17
+
18
+ const contentTypeToVariantMapping = {
19
+ "subject-material": "brand1",
20
+ "source-material": "brand1",
21
+ concept: "brand1",
22
+ "tasks-and-activities": "brand2",
23
+ "assessment-resources": "brand2"
24
+ };
25
+ const ContentTypeFramedContent = exports.ContentTypeFramedContent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
26
+ let {
27
+ variant = "neutral",
28
+ contentType,
29
+ ...props
30
+ } = _ref;
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.FramedContent, {
32
+ ...props,
33
+ colorTheme: variant === "colored" && contentType ? contentTypeToVariantMapping[contentType] : undefined,
34
+ ref: ref
35
+ });
36
+ });
@@ -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
- backgroundColor: "surface.disabled",
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
- fill: "text.subtle",
30
- height: "90%",
31
- width: "90%"
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.AlertLine, {})
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 {
package/lib/index.d.ts CHANGED
@@ -30,8 +30,12 @@ export type { SimpleBreadcrumbItem, IndexedBreadcrumbItem } from "./Breadcrumb";
30
30
  export { i18nInstance, formatNestedMessages, useTagsInputTranslations, useTagSelectorTranslations, useComboboxTranslations, usePaginationTranslations, useAudioSearchTranslations, useImageSearchTranslations, useVideoSearchTranslations, } from "./i18n";
31
31
  export { OneColumn, PageContainer } from "./Layout";
32
32
  export { default as ContentTypeBadge, SubjectMaterialBadge, TasksAndActivitiesBadge, AssessmentResourcesBadge, LearningPathBadge, SubjectBadge, SourceMaterialBadge, ConceptBadge, } from "./ContentTypeBadge";
33
- export type { ContentTypeBadgeProps, ContentType } from "./ContentTypeBadge/ContentTypeBadgeNew";
33
+ export type { ContentTypeBadgeProps, StrictContentType, ContentType } from "./ContentTypeBadge/ContentTypeBadgeNew";
34
34
  export { ContentTypeBadge as ContentTypeBadgeNew, contentTypeToBadgeVariantMap, } from "./ContentTypeBadge/ContentTypeBadgeNew";
35
+ export { ContentTypeBlockQuote } from "./ContentTypeBlockQuote/ContentTypeBlockQuote";
36
+ export { type ContentTypeBlockQuoteVariant } from "./ContentTypeBlockQuote/ContentTypeBlockQuote";
37
+ export { ContentTypeFramedContent } from "./ContentTypeFramedContent/ContentTypeFramedContent";
38
+ export { type ContentTypeFramedContentVariant } from "./ContentTypeFramedContent/ContentTypeFramedContent";
35
39
  export { default as CopyParagraphButton } from "./CopyParagraphButton";
36
40
  export { TagSelectorRoot, TagSelectorLabel, TagSelectorItemInput, TagSelectorTrigger, TagSelectorControl, TagSelectorClearTrigger, TagSelectorInputBase, TagSelectorInput, } from "./TagSelector/TagSelector";
37
41
  export { BlogPostV2 } from "./BlogPost";
package/lib/index.js CHANGED
@@ -171,6 +171,18 @@ Object.defineProperty(exports, "ContentTypeBadgeNew", {
171
171
  return _ContentTypeBadgeNew.ContentTypeBadge;
172
172
  }
173
173
  });
174
+ Object.defineProperty(exports, "ContentTypeBlockQuote", {
175
+ enumerable: true,
176
+ get: function () {
177
+ return _ContentTypeBlockQuote.ContentTypeBlockQuote;
178
+ }
179
+ });
180
+ Object.defineProperty(exports, "ContentTypeFramedContent", {
181
+ enumerable: true,
182
+ get: function () {
183
+ return _ContentTypeFramedContent.ContentTypeFramedContent;
184
+ }
185
+ });
174
186
  Object.defineProperty(exports, "ContentTypeHero", {
175
187
  enumerable: true,
176
188
  get: function () {
@@ -633,6 +645,8 @@ var _i18n = require("./i18n");
633
645
  var _Layout = require("./Layout");
634
646
  var _ContentTypeBadge = _interopRequireWildcard(require("./ContentTypeBadge"));
635
647
  var _ContentTypeBadgeNew = require("./ContentTypeBadge/ContentTypeBadgeNew");
648
+ var _ContentTypeBlockQuote = require("./ContentTypeBlockQuote/ContentTypeBlockQuote");
649
+ var _ContentTypeFramedContent = require("./ContentTypeFramedContent/ContentTypeFramedContent");
636
650
  var _CopyParagraphButton = _interopRequireDefault(require("./CopyParagraphButton"));
637
651
  var _TagSelector = require("./TagSelector/TagSelector");
638
652
  var _BlogPost = require("./BlogPost");
@@ -1384,6 +1384,7 @@ declare const messages: {
1384
1384
  external: string;
1385
1385
  gloss: string;
1386
1386
  copyright: string;
1387
+ code: string;
1387
1388
  };
1388
1389
  };
1389
1390
  gloss: {
@@ -1400,7 +1400,8 @@ const messages = {
1400
1400
  h5p: "H5P",
1401
1401
  external: "External resource",
1402
1402
  gloss: "Gloss",
1403
- copyright: "Text"
1403
+ copyright: "Text",
1404
+ code: "Code block"
1404
1405
  }
1405
1406
  },
1406
1407
  gloss: {
@@ -1384,6 +1384,7 @@ declare const messages: {
1384
1384
  external: string;
1385
1385
  gloss: string;
1386
1386
  copyright: string;
1387
+ code: string;
1387
1388
  };
1388
1389
  };
1389
1390
  gloss: {
@@ -1400,7 +1400,8 @@ const messages = {
1400
1400
  h5p: "H5P",
1401
1401
  external: "Ekstern ressurs",
1402
1402
  gloss: "Glose",
1403
- copyright: "Tekst"
1403
+ copyright: "Tekst",
1404
+ code: "Kodeblokk"
1404
1405
  }
1405
1406
  },
1406
1407
  gloss: {
@@ -1384,6 +1384,7 @@ declare const messages: {
1384
1384
  external: string;
1385
1385
  gloss: string;
1386
1386
  copyright: string;
1387
+ code: string;
1387
1388
  };
1388
1389
  };
1389
1390
  gloss: {
@@ -1400,7 +1400,8 @@ const messages = {
1400
1400
  h5p: "H5P",
1401
1401
  external: "Ekstern ressurs",
1402
1402
  gloss: "Glose",
1403
- copyright: "Tekst"
1403
+ copyright: "Tekst",
1404
+ code: "Kodeblokk"
1404
1405
  }
1405
1406
  },
1406
1407
  gloss: {
@@ -1384,6 +1384,7 @@ declare const messages: {
1384
1384
  external: string;
1385
1385
  gloss: string;
1386
1386
  copyright: string;
1387
+ code: string;
1387
1388
  };
1388
1389
  };
1389
1390
  gloss: {
@@ -1400,7 +1400,8 @@ const messages = {
1400
1400
  h5p: "H5P",
1401
1401
  external: "Olgguldas resursa",
1402
1402
  gloss: "Glose",
1403
- copyright: "Tekst"
1403
+ copyright: "Tekst",
1404
+ code: "Kodeblokk"
1404
1405
  }
1405
1406
  },
1406
1407
  gloss: {
@@ -1384,6 +1384,7 @@ declare const messages: {
1384
1384
  external: string;
1385
1385
  gloss: string;
1386
1386
  copyright: string;
1387
+ code: string;
1387
1388
  };
1388
1389
  };
1389
1390
  gloss: {
@@ -1400,7 +1400,8 @@ const messages = {
1400
1400
  h5p: "H5P",
1401
1401
  external: "Ekstern ressurs",
1402
1402
  gloss: "Glosa",
1403
- copyright: "Tekst"
1403
+ copyright: "Tekst",
1404
+ code: "Kodeblokk"
1404
1405
  }
1405
1406
  },
1406
1407
  gloss: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.35-alpha.0",
3
+ "version": "56.0.37-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -33,11 +33,11 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ndla/core": "^5.0.2",
36
- "@ndla/icons": "^8.0.24-alpha.0",
36
+ "@ndla/icons": "^8.0.26-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.32-alpha.0",
39
- "@ndla/safelink": "^7.0.32-alpha.0",
40
- "@ndla/styled-system": "^0.0.22",
38
+ "@ndla/primitives": "^1.0.34-alpha.0",
39
+ "@ndla/safelink": "^7.0.34-alpha.0",
40
+ "@ndla/styled-system": "^0.0.23",
41
41
  "@ndla/util": "^5.0.0-alpha.0",
42
42
  "html-react-parser": "^5.1.8",
43
43
  "i18next-browser-languagedetector": "^7.1.0"
@@ -50,7 +50,7 @@
50
50
  "react-router-dom": "> 6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@ndla/preset-panda": "^0.0.33",
53
+ "@ndla/preset-panda": "^0.0.35",
54
54
  "@ndla/types-backend": "^0.2.86",
55
55
  "@ndla/types-embed": "^5.0.3-alpha.0",
56
56
  "@pandacss/dev": "^0.46.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "07ec7465840ff67d4bf2958dab58ead11fac1dee"
61
+ "gitHead": "5bad5d1659659f8f6a1a8cb790d43fdbbfcdedbc"
62
62
  }
@@ -10,8 +10,9 @@ import parse from "html-react-parser";
10
10
  import { ReactNode } from "react";
11
11
  import { ArrowRightLine } from "@ndla/icons/common";
12
12
  import { Text } from "@ndla/primitives";
13
- import { SafeLink } from "@ndla/safelink";
13
+ import { SafeLinkButton } from "@ndla/safelink";
14
14
  import { styled } from "@ndla/styled-system/jsx";
15
+ import { CampaignBlockEmbedData } from "@ndla/types-embed";
15
16
  import { HeadingLevel } from "../types";
16
17
  import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
17
18
 
@@ -29,9 +30,10 @@ interface Props {
29
30
  text?: string;
30
31
  };
31
32
  image?: Image;
32
- imageSide?: "left" | "right";
33
+ imageSide?: CampaignBlockEmbedData["imageSide"];
33
34
  className?: string;
34
35
  path?: string;
36
+ background?: CampaignBlockEmbedData["background"];
35
37
  }
36
38
 
37
39
  const Wrapper = styled("div", {
@@ -46,7 +48,6 @@ const Container = styled("div", {
46
48
  base: {
47
49
  display: "grid",
48
50
  gridTemplateColumns: "1fr",
49
- gap: "medium",
50
51
  border: "1px solid",
51
52
  borderColor: "stroke.default",
52
53
  backgroundColor: "background.default",
@@ -77,32 +78,19 @@ const Container = styled("div", {
77
78
  },
78
79
  },
79
80
  },
81
+ background: {
82
+ neutral: {},
83
+ brand1: {
84
+ backgroundColor: "surface.brand.1",
85
+ },
86
+ brand3: {
87
+ backgroundColor: "surface.brand.3",
88
+ },
89
+ },
80
90
  },
81
91
  defaultVariants: {
82
92
  imageSide: "left",
83
- },
84
- });
85
-
86
- const LinkText = styled(Text, {
87
- base: {
88
- display: "flex",
89
- gap: "xxsmall",
90
- textDecoration: "underline",
91
- _hover: {
92
- textDecoration: "none",
93
- },
94
- paddingBlock: "xsmall",
95
- fontWeight: "bold",
96
- },
97
- });
98
-
99
- const LinkHeader = styled(Text, {
100
- base: {
101
- display: "flex",
102
- textDecoration: "underline",
103
- _hover: {
104
- textDecoration: "none",
105
- },
93
+ background: "neutral",
106
94
  },
107
95
  });
108
96
 
@@ -122,6 +110,7 @@ const StyledImg = styled("img", {
122
110
  height: "340px",
123
111
  },
124
112
  },
113
+ backgroundColor: "background.default",
125
114
  },
126
115
  });
127
116
 
@@ -135,6 +124,7 @@ const ContentWrapper = styled("div", {
135
124
  justifyContent: "center",
136
125
  paddingBlock: "medium",
137
126
  paddingInline: "medium",
127
+ position: "relative",
138
128
  },
139
129
  });
140
130
 
@@ -150,20 +140,32 @@ const StyledText = styled(Text, {
150
140
  },
151
141
  });
152
142
 
153
- interface MaybeLinkTextProps {
143
+ interface LinkButtonProps {
154
144
  url?: string;
155
145
  path?: string;
156
146
  children: ReactNode;
157
147
  }
158
148
 
159
- const StyledSafeLink = styled(SafeLink, {
149
+ const StyledSafeLinkButton = styled(SafeLinkButton, {
160
150
  base: {
161
- color: "inherit",
151
+ boxShadow: "full",
152
+ border: "1px solid",
153
+ borderColor: "stroke.default",
162
154
  },
163
155
  });
164
156
 
165
- const MaybeLinkText = ({ url, children, path }: MaybeLinkTextProps) => {
166
- if (url) return <StyledSafeLink to={getPossiblyRelativeUrl(url, path)}>{children}</StyledSafeLink>;
157
+ const LinkButton = ({ url, children, path }: LinkButtonProps) => {
158
+ if (url)
159
+ return (
160
+ <StyledSafeLinkButton
161
+ to={getPossiblyRelativeUrl(url, path)}
162
+ target="_blank"
163
+ variant="secondary"
164
+ rel="noopener noreferrer"
165
+ >
166
+ {children}
167
+ </StyledSafeLinkButton>
168
+ );
167
169
  return children;
168
170
  };
169
171
 
@@ -176,27 +178,24 @@ const CampaignBlock = ({
176
178
  url,
177
179
  path,
178
180
  className,
181
+ background,
179
182
  }: Props) => {
180
183
  const imageComponent = image && <StyledImg src={`${image.src}?width=455`} height={340} width={455} alt={image.alt} />;
181
- const HeaderComponent = url?.url ? LinkHeader : Text;
184
+
182
185
  return (
183
186
  <Wrapper>
184
- <Container className={className} data-embed-type="campaign-block" imageSide={imageSide}>
187
+ <Container className={className} data-embed-type="campaign-block" imageSide={imageSide} background={background}>
185
188
  {imageSide === "left" && imageComponent}
186
189
  <ContentWrapper>
187
- <MaybeLinkText url={url?.url} path={path}>
188
- <HeaderComponent asChild consumeCss textStyle="heading.small">
189
- <InternalHeading>{parse(title)}</InternalHeading>
190
- </HeaderComponent>
191
- </MaybeLinkText>
190
+ <Text asChild consumeCss textStyle="heading.small">
191
+ <InternalHeading>{parse(title)}</InternalHeading>
192
+ </Text>
192
193
  <StyledText textStyle="body.xlarge">{parse(description)}</StyledText>
193
194
  {!!url?.url && (
194
- <MaybeLinkText url={url.url} path={path}>
195
- <LinkText textStyle="body.medium">
196
- {parse(url.text ?? "")}
197
- <ArrowRightLine />
198
- </LinkText>
199
- </MaybeLinkText>
195
+ <LinkButton url={url.url} path={path}>
196
+ {parse(url.text ?? "")}
197
+ <ArrowRightLine />
198
+ </LinkButton>
200
199
  )}
201
200
  </ContentWrapper>
202
201
  {imageSide !== "left" && imageComponent}
@@ -15,7 +15,7 @@ export interface ContentTypeBadgeProps extends Omit<BadgeProps, "colorTheme"> {
15
15
  contentType: ContentType | undefined;
16
16
  }
17
17
 
18
- export type ContentType =
18
+ export type StrictContentType =
19
19
  | typeof contentTypes.SUBJECT_MATERIAL
20
20
  | typeof contentTypes.TASKS_AND_ACTIVITIES
21
21
  | typeof contentTypes.ASSESSMENT_RESOURCES
@@ -30,7 +30,10 @@ export type ContentType =
30
30
  | typeof contentTypes.AUDIO
31
31
  | typeof contentTypes.VIDEO
32
32
  | typeof contentTypes.MISSING
33
- | typeof contentTypes.PODCAST
33
+ | typeof contentTypes.PODCAST;
34
+
35
+ export type ContentType =
36
+ | StrictContentType
34
37
  // This allows for us to fallback to string without getting a ts error, while still keeping intellisense
35
38
  | (string & {});
36
39
 
@@ -0,0 +1,36 @@
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 { forwardRef } from "react";
10
+ import { BlockQuote, BlockQuoteProps, BlockQuoteVariantProps } from "@ndla/primitives";
11
+ import { ContentType } from "../ContentTypeBadge/ContentTypeBadgeNew";
12
+
13
+ export type ContentTypeBlockQuoteVariant = "colored" | "neutral";
14
+
15
+ const contentTypeToVariantMapping = {
16
+ "subject-material": "brand1",
17
+ "source-material": "brand1",
18
+ concept: "brand1",
19
+ "tasks-and-activities": "brand2",
20
+ "assessment-resources": "brand2",
21
+ } as Record<ContentType, NonNullable<BlockQuoteVariantProps>["variant"]>;
22
+
23
+ interface Props extends Omit<BlockQuoteProps, "variant"> {
24
+ variant?: ContentTypeBlockQuoteVariant;
25
+ contentType?: ContentType;
26
+ }
27
+
28
+ export const ContentTypeBlockQuote = forwardRef<HTMLQuoteElement, Props>(({ variant, contentType, ...props }, ref) => {
29
+ return (
30
+ <BlockQuote
31
+ {...props}
32
+ variant={variant === "colored" && contentType ? contentTypeToVariantMapping[contentType] : undefined}
33
+ ref={ref}
34
+ />
35
+ );
36
+ });
@@ -0,0 +1,38 @@
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 { forwardRef } from "react";
10
+ import { FramedContent, FramedContentProps, FramedContentVariantProps } from "@ndla/primitives";
11
+ import { ContentType } from "..";
12
+
13
+ const contentTypeToVariantMapping = {
14
+ "subject-material": "brand1",
15
+ "source-material": "brand1",
16
+ concept: "brand1",
17
+ "tasks-and-activities": "brand2",
18
+ "assessment-resources": "brand2",
19
+ } as Record<ContentType, NonNullable<FramedContentVariantProps>["colorTheme"]>;
20
+
21
+ export type ContentTypeFramedContentVariant = "colored" | "neutral";
22
+
23
+ interface Props extends FramedContentProps {
24
+ variant?: ContentTypeFramedContentVariant;
25
+ contentType?: ContentType;
26
+ }
27
+
28
+ export const ContentTypeFramedContent = forwardRef<HTMLDivElement, Props>(
29
+ ({ variant = "neutral", contentType, ...props }, ref) => {
30
+ return (
31
+ <FramedContent
32
+ {...props}
33
+ colorTheme={variant === "colored" && contentType ? contentTypeToVariantMapping[contentType] : undefined}
34
+ ref={ref}
35
+ />
36
+ );
37
+ },
38
+ );
@@ -7,10 +7,9 @@
7
7
  */
8
8
 
9
9
  import { Meta, StoryFn } from "@storybook/react";
10
- import { HeroBackground, HeroContent, Text } from "@ndla/primitives";
10
+ import { HeroBackground, HeroContent, PageContent, Text } from "@ndla/primitives";
11
11
  import { styled } from "@ndla/styled-system/jsx";
12
12
  import { ContentTypeHero } from "./ContentTypeHero";
13
- import { OneColumn } from "../Layout";
14
13
 
15
14
  /**
16
15
  * A thin wrapper around the `Hero` component that automatically assigns a variant based on the provided content type
@@ -31,7 +30,7 @@ export default {
31
30
  export const HeroStory: StoryFn<typeof ContentTypeHero> = ({ ...args }) => (
32
31
  <ContentTypeHero {...args}>
33
32
  <HeroBackground />
34
- <OneColumn>
33
+ <PageContent>
35
34
  <HeroContent>Hello</HeroContent>
36
35
 
37
36
  <styled.div css={{ background: "surface.default", padding: "medium" }}>
@@ -69,7 +68,7 @@ export const HeroStory: StoryFn<typeof ContentTypeHero> = ({ ...args }) => (
69
68
  faucibus ac ut mauris. Fusce facilisis at erat a dignissim.
70
69
  </Text>
71
70
  </styled.div>
72
- </OneColumn>
71
+ </PageContent>
73
72
  </ContentTypeHero>
74
73
  );
75
74