@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
@@ -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
- "fontWeight]___[value:bold",
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
- "backgroundColor]___[value:surface.disabled",
249
- "fill]___[value:text.subtle]___[cond:& svg",
250
- "height]___[value:90%]___[cond:& svg",
251
- "width]___[value:90%]___[cond:& svg",
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
- .fw_bold {
709
- font-weight: var(--font-weights-bold);
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
- .ov-y_auto {
749
- overflow-y: auto;
756
+ .fw_bold {
757
+ font-weight: var(--font-weights-bold);
750
758
  }
751
759
 
752
- .bg-c_surface\.disabled {
753
- background-color: var(--colors-surface-disabled);
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\]\:fill_text\.subtle svg {
1063
- fill: var(--colors-text-subtle);
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\]\:w_90\% svg {
1071
- width: 90%;
1074
+ .\[\&_svg\]\:w_5xlarge svg {
1075
+ width: var(--sizes-5xlarge);
1072
1076
  }
1073
1077
 
1074
- .\[\&\[data-embed-type\=\'audio\'\]\]\:h_surface\.3xsmall[data-embed-type='audio'] {
1075
- height: var(--sizes-surface-3xsmall);
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 { SafeLink } from "@ndla/safelink";
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 StyledSafeLink = styled(SafeLink, {
115
+ const StyledSafeLinkButton = styled(SafeLinkButton, {
126
116
  base: {
127
- color: "inherit"
117
+ boxShadow: "full",
118
+ border: "1px solid",
119
+ borderColor: "stroke.default"
128
120
  }
129
121
  });
130
- const MaybeLinkText = _ref => {
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(StyledSafeLink, {
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(MaybeLinkText, {
167
- url: url?.url,
168
- path: path,
169
- children: /*#__PURE__*/_jsx(HeaderComponent, {
170
- asChild: true,
171
- consumeCss: true,
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__*/_jsx(MaybeLinkText, {
172
+ }), !!url?.url && /*#__PURE__*/_jsxs(LinkButton, {
181
173
  url: url.url,
182
174
  path: path,
183
- children: /*#__PURE__*/_jsxs(LinkText, {
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
  })
@@ -0,0 +1,30 @@
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 } from "@ndla/primitives";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const contentTypeToVariantMapping = {
13
+ "subject-material": "brand1",
14
+ "source-material": "brand1",
15
+ concept: "brand1",
16
+ "tasks-and-activities": "brand2",
17
+ "assessment-resources": "brand2"
18
+ };
19
+ export const ContentTypeBlockQuote = /*#__PURE__*/forwardRef((_ref, ref) => {
20
+ let {
21
+ variant,
22
+ contentType,
23
+ ...props
24
+ } = _ref;
25
+ return /*#__PURE__*/_jsx(BlockQuote, {
26
+ ...props,
27
+ variant: variant === "colored" && contentType ? contentTypeToVariantMapping[contentType] : undefined,
28
+ ref: ref
29
+ });
30
+ });
@@ -0,0 +1,30 @@
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 } from "@ndla/primitives";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const contentTypeToVariantMapping = {
13
+ "subject-material": "brand1",
14
+ "source-material": "brand1",
15
+ concept: "brand1",
16
+ "tasks-and-activities": "brand2",
17
+ "assessment-resources": "brand2"
18
+ };
19
+ export const ContentTypeFramedContent = /*#__PURE__*/forwardRef((_ref, ref) => {
20
+ let {
21
+ variant = "neutral",
22
+ contentType,
23
+ ...props
24
+ } = _ref;
25
+ return /*#__PURE__*/_jsx(FramedContent, {
26
+ ...props,
27
+ colorTheme: variant === "colored" && contentType ? contentTypeToVariantMapping[contentType] : undefined,
28
+ ref: ref
29
+ });
30
+ });
@@ -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, {
@@ -40,6 +40,7 @@ export const ConceptEmbed = _ref => {
40
40
  });
41
41
  }
42
42
  if (embed.status === "error") {
43
+ // TODO: This could be either concept or gloss. We don't know if it errors out. :)
43
44
  return /*#__PURE__*/_jsx(EmbedErrorPlaceholder, {
44
45
  type: "gloss"
45
46
  });
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { AlertLine } from "@ndla/icons/common";
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
- backgroundColor: "surface.disabled",
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
- fill: "text.subtle",
24
- height: "90%",
25
- width: "90%"
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(AlertLine, {})
51
+ children: /*#__PURE__*/_jsx(Report, {})
53
52
  }), /*#__PURE__*/_jsx(EmbedByline, {
54
53
  error: true,
55
54
  type: type
package/es/index.js CHANGED
@@ -33,6 +33,8 @@ export { i18nInstance, formatNestedMessages, useTagsInputTranslations, useTagSel
33
33
  export { OneColumn, PageContainer } from "./Layout";
34
34
  export { default as ContentTypeBadge, SubjectMaterialBadge, TasksAndActivitiesBadge, AssessmentResourcesBadge, LearningPathBadge, SubjectBadge, SourceMaterialBadge, ConceptBadge } from "./ContentTypeBadge";
35
35
  export { ContentTypeBadge as ContentTypeBadgeNew, contentTypeToBadgeVariantMap } from "./ContentTypeBadge/ContentTypeBadgeNew";
36
+ export { ContentTypeBlockQuote } from "./ContentTypeBlockQuote/ContentTypeBlockQuote";
37
+ export { ContentTypeFramedContent } from "./ContentTypeFramedContent/ContentTypeFramedContent";
36
38
  export { default as CopyParagraphButton } from "./CopyParagraphButton";
37
39
  export { TagSelectorRoot, TagSelectorLabel, TagSelectorItemInput, TagSelectorTrigger, TagSelectorControl, TagSelectorClearTrigger, TagSelectorInputBase, TagSelectorInput } from "./TagSelector/TagSelector";
38
40
  export { BlogPostV2 } from "./BlogPost";
@@ -1393,7 +1393,8 @@ const messages = {
1393
1393
  h5p: "H5P",
1394
1394
  external: "External resource",
1395
1395
  gloss: "Gloss",
1396
- copyright: "Text"
1396
+ copyright: "Text",
1397
+ code: "Code block"
1397
1398
  }
1398
1399
  },
1399
1400
  gloss: {
@@ -1393,7 +1393,8 @@ const messages = {
1393
1393
  h5p: "H5P",
1394
1394
  external: "Ekstern ressurs",
1395
1395
  gloss: "Glose",
1396
- copyright: "Tekst"
1396
+ copyright: "Tekst",
1397
+ code: "Kodeblokk"
1397
1398
  }
1398
1399
  },
1399
1400
  gloss: {
@@ -1393,7 +1393,8 @@ const messages = {
1393
1393
  h5p: "H5P",
1394
1394
  external: "Ekstern ressurs",
1395
1395
  gloss: "Glose",
1396
- copyright: "Tekst"
1396
+ copyright: "Tekst",
1397
+ code: "Kodeblokk"
1397
1398
  }
1398
1399
  },
1399
1400
  gloss: {
@@ -1393,7 +1393,8 @@ const messages = {
1393
1393
  h5p: "H5P",
1394
1394
  external: "Olgguldas resursa",
1395
1395
  gloss: "Glose",
1396
- copyright: "Tekst"
1396
+ copyright: "Tekst",
1397
+ code: "Kodeblokk"
1397
1398
  }
1398
1399
  },
1399
1400
  gloss: {
@@ -1393,7 +1393,8 @@ const messages = {
1393
1393
  h5p: "H5P",
1394
1394
  external: "Ekstern ressurs",
1395
1395
  gloss: "Glosa",
1396
- copyright: "Tekst"
1396
+ copyright: "Tekst",
1397
+ code: "Kodeblokk"
1397
1398
  }
1398
1399
  },
1399
1400
  gloss: {
@@ -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?: "left" | "right";
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 StyledSafeLink = (0, _jsx2.styled)(_safelink.SafeLink, {
122
+ const StyledSafeLinkButton = (0, _jsx2.styled)(_safelink.SafeLinkButton, {
133
123
  base: {
134
- color: "inherit"
124
+ boxShadow: "full",
125
+ border: "1px solid",
126
+ borderColor: "stroke.default"
135
127
  }
136
128
  });
137
- const MaybeLinkText = _ref => {
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)(StyledSafeLink, {
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)(MaybeLinkText, {
174
- url: url?.url,
175
- path: path,
176
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(HeaderComponent, {
177
- asChild: true,
178
- consumeCss: true,
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.jsx)(MaybeLinkText, {
179
+ }), !!url?.url && /*#__PURE__*/(0, _jsxRuntime.jsxs)(LinkButton, {
188
180
  url: url.url,
189
181
  path: path,
190
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(LinkText, {
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
  })
@@ -11,6 +11,7 @@ import * as contentTypes from "../model/ContentType";
11
11
  export interface ContentTypeBadgeProps extends Omit<BadgeProps, "colorTheme"> {
12
12
  contentType: ContentType | undefined;
13
13
  }
14
- export type ContentType = typeof contentTypes.SUBJECT_MATERIAL | typeof contentTypes.TASKS_AND_ACTIVITIES | typeof contentTypes.ASSESSMENT_RESOURCES | typeof contentTypes.SUBJECT | typeof contentTypes.SOURCE_MATERIAL | typeof contentTypes.LEARNING_PATH | typeof contentTypes.TOPIC | typeof contentTypes.MULTIDISCIPLINARY | typeof contentTypes.CONCEPT | typeof contentTypes.EXTERNAL | typeof contentTypes.IMAGE | typeof contentTypes.AUDIO | typeof contentTypes.VIDEO | typeof contentTypes.MISSING | typeof contentTypes.PODCAST | (string & {});
14
+ export type StrictContentType = typeof contentTypes.SUBJECT_MATERIAL | typeof contentTypes.TASKS_AND_ACTIVITIES | typeof contentTypes.ASSESSMENT_RESOURCES | typeof contentTypes.SUBJECT | typeof contentTypes.SOURCE_MATERIAL | typeof contentTypes.LEARNING_PATH | typeof contentTypes.TOPIC | typeof contentTypes.MULTIDISCIPLINARY | typeof contentTypes.CONCEPT | typeof contentTypes.EXTERNAL | typeof contentTypes.IMAGE | typeof contentTypes.AUDIO | typeof contentTypes.VIDEO | typeof contentTypes.MISSING | typeof contentTypes.PODCAST;
15
+ export type ContentType = StrictContentType | (string & {});
15
16
  export declare const contentTypeToBadgeVariantMap: Record<ContentType, BadgeVariant>;
16
17
  export declare const ContentTypeBadge: import("react").ForwardRefExoticComponent<ContentTypeBadgeProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -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 { BlockQuoteProps } from "@ndla/primitives";
10
+ import { ContentType } from "../ContentTypeBadge/ContentTypeBadgeNew";
11
+ export type ContentTypeBlockQuoteVariant = "colored" | "neutral";
12
+ interface Props extends Omit<BlockQuoteProps, "variant"> {
13
+ variant?: ContentTypeBlockQuoteVariant;
14
+ contentType?: ContentType;
15
+ }
16
+ export declare const ContentTypeBlockQuote: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLQuoteElement>>;
17
+ export {};