@ndla/ui 56.0.52-alpha.0 → 56.0.53-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.
@@ -97,25 +97,6 @@
97
97
  "minWidth]___[value:small",
98
98
  "paddingInline]___[value:small",
99
99
  "srOnly]___[value:true",
100
- "backgroundColor]___[value:background.default",
101
- "transitionDuration]___[value:fast",
102
- "transitionProperty]___[value:background-color, border-color, max-width",
103
- "transitionTimingFunction]___[value:default",
104
- "height]___[value:100%",
105
- "borderColor]___[value:stroke.hover]___[cond:&:hover, &:focus-visible",
106
- "backgroundColor]___[value:surface.actionSubtle.hover]___[cond:&:hover, &:focus-visible",
107
- "textDecoration]___[value:underline]___[cond:&:hover, &:focus-visible<___>& h1, h2, h3, h4, h5, h6",
108
- "maxWidth]___[value:350px]___[cond:tabletWide",
109
- "paddingBlock]___[value:xlarge",
110
- "paddingInline]___[value:xxlarge",
111
- "maxWidth]___[value:532px]___[cond:tabletWide",
112
- "textTransform]___[value:uppercase",
113
- "textStyle]___[value:body.large",
114
- "objectFit]___[value:cover",
115
- "border]___[value:0",
116
- "display]___[value:inline-block",
117
- "width]___[value:fit-content",
118
- "maxWidth]___[value:8xl",
119
100
  "flexWrap]___[value:wrap",
120
101
  "alignItems]___[value:flex-start]___[cond:mobileDown",
121
102
  "justifyContent]___[value:center]___[cond:mobileDown",
@@ -128,15 +109,18 @@
128
109
  "textDecoration]___[value:none]___[cond:_hover",
129
110
  "textDecoration]___[value:none]___[cond:_focusVisible",
130
111
  "display]___[value:none]___[cond:tabletDown",
112
+ "height]___[value:100%",
131
113
  "containerType]___[value:inline-size",
132
114
  "display]___[value:grid",
133
115
  "gridTemplateColumns]___[value:1fr",
116
+ "backgroundColor]___[value:background.default",
134
117
  "gridTemplateColumns]___[value:minmax(230px, 455px) auto]___[cond:@/tablet",
135
118
  "gridTemplateColumns]___[value:minmax(230px, 455px) auto]___[cond:@supports not (container-type: inline-size)<___>tabletWide",
136
119
  "gridTemplateColumns]___[value:auto minmax(230px, 455px)]___[cond:@/tablet",
137
120
  "gridTemplateColumns]___[value:auto minmax(230px, 455px)]___[cond:@supports not (container-type: inline-size)<___>tabletWide",
138
121
  "backgroundColor]___[value:surface.brand.1",
139
122
  "backgroundColor]___[value:surface.brand.3",
123
+ "objectFit]___[value:cover",
140
124
  "height]___[value:215px",
141
125
  "height]___[value:340px]___[cond:@/tablet",
142
126
  "height]___[value:265px]___[cond:@supports not (container-type: inline-size)<___>tablet",
@@ -146,6 +130,8 @@
146
130
  "position]___[value:relative]___[cond:tablet",
147
131
  "lineClamp]___[value:4]___[cond:tablet",
148
132
  "boxOrient]___[value:vertical]___[cond:tablet",
133
+ "maxWidth]___[value:8xl",
134
+ "textStyle]___[value:body.large",
149
135
  "display]___[value:inline",
150
136
  "display]___[value:inline]___[cond:& p",
151
137
  "minWidth]___[value:surface.xxsmall",
@@ -211,6 +197,7 @@
211
197
  "cursor]___[value:pointer",
212
198
  "opacity]___[value:1]___[cond:&:focus, &:focus-visible, &:active",
213
199
  "marginInlineStart]___[value:xsmall",
200
+ "border]___[value:0",
214
201
  "height]___[value:auto",
215
202
  "textStyle]___[value:label.large",
216
203
  "fontWeight]___[value:bold",
@@ -255,6 +242,7 @@
255
242
  "borderStyle]___[value:dashed",
256
243
  "borderColor]___[value:stroke.hover",
257
244
  "paddingBlockStart]___[value:5xsmall",
245
+ "width]___[value:fit-content",
258
246
  "borderColor]___[value:text.link]___[cond:_hover",
259
247
  "background]___[value:surface.actionSubtle.hover]___[cond:_hover",
260
248
  "borderColor]___[value:text.link]___[cond:_active",
@@ -396,6 +384,10 @@
396
384
  "width]___[value:large]___[cond:_hover<___>& [data-forward]",
397
385
  "height]___[value:large]___[cond:_hover<___>& [data-forward]",
398
386
  "color]___[value:icon.strong",
387
+ "paddingBlockStart]___[value:medium",
388
+ "paddingBlockEnd]___[value:medium",
389
+ "aspectRatio]___[value:16/9",
390
+ "height]___[value:unset",
399
391
  "gridTemplateColumns]___[value:repeat(2, 1fr)",
400
392
  "gridTemplateColumns]___[value:1fr]___[cond:tabletDown",
401
393
  "marginBlockStart]___[value:xsmall",
package/dist/styles.css CHANGED
@@ -329,42 +329,6 @@
329
329
  border-width: 0;
330
330
  }
331
331
 
332
- .h_100\% {
333
- height: 100%;
334
- }
335
-
336
- .py_xlarge {
337
- padding-block: var(--spacing-xlarge);
338
- }
339
-
340
- .px_xxlarge {
341
- padding-inline: var(--spacing-xxlarge);
342
- }
343
-
344
- .tt_uppercase {
345
- text-transform: uppercase;
346
- }
347
-
348
- .obj-f_cover {
349
- object-fit: cover;
350
- }
351
-
352
- .bd_0 {
353
- border: 0;
354
- }
355
-
356
- .d_inline-block {
357
- display: inline-block;
358
- }
359
-
360
- .w_fit-content {
361
- width: fit-content;
362
- }
363
-
364
- .max-w_8xl {
365
- max-width: 8xl;
366
- }
367
-
368
332
  .c_inherit {
369
333
  color: inherit;
370
334
  }
@@ -373,6 +337,10 @@
373
337
  text-decoration: underline;
374
338
  }
375
339
 
340
+ .h_100\% {
341
+ height: 100%;
342
+ }
343
+
376
344
  .cq-t_inline-size {
377
345
  container-type: inline-size;
378
346
  }
@@ -381,10 +349,18 @@
381
349
  display: grid;
382
350
  }
383
351
 
352
+ .obj-f_cover {
353
+ object-fit: cover;
354
+ }
355
+
384
356
  .h_215px {
385
357
  height: 215px;
386
358
  }
387
359
 
360
+ .max-w_8xl {
361
+ max-width: 8xl;
362
+ }
363
+
388
364
  .d_inline {
389
365
  display: inline;
390
366
  }
@@ -469,6 +445,10 @@
469
445
  margin-inline-start: var(--spacing-xsmall);
470
446
  }
471
447
 
448
+ .bd_0 {
449
+ border: 0;
450
+ }
451
+
472
452
  .h_auto {
473
453
  height: auto;
474
454
  }
@@ -529,6 +509,10 @@
529
509
  padding-block-start: var(--spacing-5xsmall);
530
510
  }
531
511
 
512
+ .w_fit-content {
513
+ width: fit-content;
514
+ }
515
+
532
516
  .ps_4xsmall {
533
517
  padding-inline-start: var(--spacing-4xsmall);
534
518
  }
@@ -617,6 +601,22 @@
617
601
  color: var(--colors-icon-strong);
618
602
  }
619
603
 
604
+ .pbs_medium {
605
+ padding-block-start: var(--spacing-medium);
606
+ }
607
+
608
+ .pbe_medium {
609
+ padding-block-end: var(--spacing-medium);
610
+ }
611
+
612
+ .asp_16\/9 {
613
+ aspect-ratio: 16/9;
614
+ }
615
+
616
+ .h_unset {
617
+ height: unset;
618
+ }
619
+
620
620
  .mbs_xsmall {
621
621
  margin-block-start: var(--spacing-xsmall);
622
622
  }
@@ -665,25 +665,6 @@
665
665
  justify-content: center;
666
666
  }
667
667
 
668
- .bg-c_background\.default {
669
- background-color: var(--colors-background-default);
670
- }
671
-
672
- .trs-dur_fast {
673
- --transition-duration: var(--durations-fast);
674
- transition-duration: var(--durations-fast);
675
- }
676
-
677
- .trs-prop_background-color\,_border-color\,_max-width {
678
- --transition-prop: background-color, border-color, max-width;
679
- transition-property: background-color, border-color, max-width;
680
- }
681
-
682
- .trs-tmf_default {
683
- --transition-easing: var(--easings-default);
684
- transition-timing-function: var(--easings-default);
685
- }
686
-
687
668
  .flex-wrap_wrap {
688
669
  flex-wrap: wrap;
689
670
  }
@@ -696,6 +677,10 @@
696
677
  grid-template-columns: 1fr;
697
678
  }
698
679
 
680
+ .bg-c_background\.default {
681
+ background-color: var(--colors-background-default);
682
+ }
683
+
699
684
  .bg-c_surface\.brand\.1 {
700
685
  background-color: var(--colors-surface-brand-1);
701
686
  }
@@ -1229,14 +1214,6 @@
1229
1214
  border-radius: 0;
1230
1215
  }
1231
1216
 
1232
- .\[\&\:hover\,_\&\:focus-visible\]\:bd-c_stroke\.hover:hover,.\[\&\:hover\,_\&\:focus-visible\]\:bd-c_stroke\.hover:focus-visible {
1233
- border-color: var(--colors-stroke-hover);
1234
- }
1235
-
1236
- .\[\&\:hover\,_\&\:focus-visible\]\:bg-c_surface\.actionSubtle\.hover:hover,.\[\&\:hover\,_\&\:focus-visible\]\:bg-c_surface\.actionSubtle\.hover:focus-visible {
1237
- background-color: var(--colors-surface-action-subtle-hover);
1238
- }
1239
-
1240
1217
  .hover\:td_none:is(:hover, [data-hover]) {
1241
1218
  text-decoration: none;
1242
1219
  }
@@ -1281,10 +1258,6 @@
1281
1258
  font-weight: var(--font-weights-bold);
1282
1259
  }
1283
1260
 
1284
- .\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:hover h1,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:hover h2,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:hover h3,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:hover h4,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:hover h5,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:hover h6,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:focus-visible h1,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:focus-visible h2,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:focus-visible h3,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:focus-visible h4,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:focus-visible h5,.\[\&\:hover\,_\&\:focus-visible\]\:\[\&_h1\,_h2\,_h3\,_h4\,_h5\,_h6\]\:td_underline:focus-visible h6 {
1285
- text-decoration: underline;
1286
- }
1287
-
1288
1261
  .focusVisible\:after\:pos_absolute:is(:focus-visible, [data-focus-visible])::after {
1289
1262
  position: absolute;
1290
1263
  }
@@ -1472,12 +1445,6 @@
1472
1445
  @media screen and (min-width: 48rem) {
1473
1446
  .tabletWide\:w_100\% {
1474
1447
  width: 100%;
1475
- }
1476
- .tabletWide\:max-w_350px {
1477
- max-width: 350px;
1478
- }
1479
- .tabletWide\:max-w_532px {
1480
- max-width: 532px;
1481
1448
  }
1482
1449
  .tabletWide\:flex-d_row {
1483
1450
  flex-direction: row;
@@ -0,0 +1,83 @@
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 parse from "html-react-parser";
10
+ import { CardHeading, CardImage, CardRoot, Text } from "@ndla/primitives";
11
+ import { SafeLink } from "@ndla/safelink";
12
+ import { styled } from "@ndla/styled-system/jsx";
13
+ import { linkOverlay } from "@ndla/styled-system/patterns";
14
+ import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const StyledCardHeading = styled(CardHeading, {
17
+ base: {
18
+ paddingBlockStart: "medium"
19
+ }
20
+ });
21
+ const StyledText = styled(Text, {
22
+ base: {
23
+ paddingBlockEnd: "medium"
24
+ }
25
+ });
26
+ const StyledCardRoot = styled(CardRoot, {
27
+ base: {
28
+ border: "0",
29
+ display: "flex",
30
+ flexDirection: "column",
31
+ gap: "small"
32
+ }
33
+ });
34
+ const StyledCardImage = styled(CardImage, {
35
+ base: {
36
+ aspectRatio: "16/9",
37
+ height: "unset"
38
+ }
39
+ });
40
+ export const Pitch = _ref => {
41
+ let {
42
+ title,
43
+ url,
44
+ metaImage,
45
+ path,
46
+ description
47
+ } = _ref;
48
+ const href = getPossiblyRelativeUrl(url, path);
49
+ return /*#__PURE__*/_jsx(StyledCardRoot, {
50
+ variant: "subtle",
51
+ "data-embed-type": "pitch",
52
+ asChild: true,
53
+ consumeCss: true,
54
+ children: /*#__PURE__*/_jsxs("div", {
55
+ children: [/*#__PURE__*/_jsx(StyledCardHeading, {
56
+ textStyle: "heading.small",
57
+ asChild: true,
58
+ consumeCss: true,
59
+ children: /*#__PURE__*/_jsx(SafeLink, {
60
+ to: href,
61
+ unstyled: true,
62
+ css: linkOverlay.raw(),
63
+ children: parse(title)
64
+ })
65
+ }), !!description && /*#__PURE__*/_jsx(StyledText, {
66
+ textStyle: "body.xlarge",
67
+ asChild: true,
68
+ consumeCss: true,
69
+ children: /*#__PURE__*/_jsx("div", {
70
+ children: parse(description)
71
+ })
72
+ }), /*#__PURE__*/_jsx(StyledCardImage, {
73
+ variant: "rounded",
74
+ src: metaImage.url,
75
+ alt: metaImage.alt,
76
+ sizes: "180px",
77
+ fallbackWidth: 300,
78
+ width: 550,
79
+ height: 310
80
+ })]
81
+ })
82
+ });
83
+ };
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export { default as BlogPostV2 } from "./BlogPost";
9
+ export { Pitch } from "./Pitch";
package/es/index.js CHANGED
@@ -37,7 +37,7 @@ export { ContentTypeBlockQuote } from "./ContentTypeBlockQuote/ContentTypeBlockQ
37
37
  export { ContentTypeFramedContent } from "./ContentTypeFramedContent/ContentTypeFramedContent";
38
38
  export { default as CopyParagraphButton } from "./CopyParagraphButton";
39
39
  export { TagSelectorRoot, TagSelectorLabel, TagSelectorItemInput, TagSelectorTrigger, TagSelectorControl, TagSelectorClearTrigger, TagSelectorInputBase, TagSelectorInput } from "./TagSelector/TagSelector";
40
- export { BlogPostV2 } from "./BlogPost";
40
+ export { Pitch } from "./Pitch";
41
41
  export { KeyFigure } from "./KeyFigure";
42
42
  export { ContactBlock, contactBlockBackgrounds } from "./ContactBlock";
43
43
  export { CampaignBlock } from "./CampaignBlock";
@@ -0,0 +1,18 @@
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
+ export interface Props {
9
+ title: string;
10
+ url: string;
11
+ description?: string;
12
+ metaImage: {
13
+ url: string;
14
+ alt: string;
15
+ };
16
+ path?: string;
17
+ }
18
+ export declare const Pitch: ({ title, url, metaImage, path, description }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Pitch = void 0;
7
+ var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
8
+ var _primitives = require("@ndla/primitives");
9
+ var _safelink = require("@ndla/safelink");
10
+ var _jsx2 = require("@ndla/styled-system/jsx");
11
+ var _patterns = require("@ndla/styled-system/patterns");
12
+ var _relativeUrl = require("../utils/relativeUrl");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ /**
16
+ * Copyright (c) 2024-present, NDLA.
17
+ *
18
+ * This source code is licensed under the GPLv3 license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ *
21
+ */
22
+
23
+ const StyledCardHeading = (0, _jsx2.styled)(_primitives.CardHeading, {
24
+ base: {
25
+ paddingBlockStart: "medium"
26
+ }
27
+ });
28
+ const StyledText = (0, _jsx2.styled)(_primitives.Text, {
29
+ base: {
30
+ paddingBlockEnd: "medium"
31
+ }
32
+ });
33
+ const StyledCardRoot = (0, _jsx2.styled)(_primitives.CardRoot, {
34
+ base: {
35
+ border: "0",
36
+ display: "flex",
37
+ flexDirection: "column",
38
+ gap: "small"
39
+ }
40
+ });
41
+ const StyledCardImage = (0, _jsx2.styled)(_primitives.CardImage, {
42
+ base: {
43
+ aspectRatio: "16/9",
44
+ height: "unset"
45
+ }
46
+ });
47
+ const Pitch = _ref => {
48
+ let {
49
+ title,
50
+ url,
51
+ metaImage,
52
+ path,
53
+ description
54
+ } = _ref;
55
+ const href = (0, _relativeUrl.getPossiblyRelativeUrl)(url, path);
56
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledCardRoot, {
57
+ variant: "subtle",
58
+ "data-embed-type": "pitch",
59
+ asChild: true,
60
+ consumeCss: true,
61
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
62
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledCardHeading, {
63
+ textStyle: "heading.small",
64
+ asChild: true,
65
+ consumeCss: true,
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_safelink.SafeLink, {
67
+ to: href,
68
+ unstyled: true,
69
+ css: _patterns.linkOverlay.raw(),
70
+ children: (0, _htmlReactParser.default)(title)
71
+ })
72
+ }), !!description && /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, {
73
+ textStyle: "body.xlarge",
74
+ asChild: true,
75
+ consumeCss: true,
76
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
77
+ children: (0, _htmlReactParser.default)(description)
78
+ })
79
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledCardImage, {
80
+ variant: "rounded",
81
+ src: metaImage.url,
82
+ alt: metaImage.alt,
83
+ sizes: "180px",
84
+ fallbackWidth: 300,
85
+ width: 550,
86
+ height: 310
87
+ })]
88
+ })
89
+ });
90
+ };
91
+ exports.Pitch = Pitch;
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export { default as BlogPostV2 } from "./BlogPost";
8
+ export { Pitch } from "./Pitch";
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Pitch", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Pitch.Pitch;
10
+ }
11
+ });
12
+ var _Pitch = require("./Pitch");
package/lib/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export { type ContentTypeFramedContentVariant } from "./ContentTypeFramedContent
40
40
  export { default as CopyParagraphButton } from "./CopyParagraphButton";
41
41
  export type { TagSelectorControlProps, TagSelectorInputProps, TagSelectorRootProps } from "./TagSelector/TagSelector";
42
42
  export { TagSelectorRoot, TagSelectorLabel, TagSelectorItemInput, TagSelectorTrigger, TagSelectorControl, TagSelectorClearTrigger, TagSelectorInputBase, TagSelectorInput, } from "./TagSelector/TagSelector";
43
- export { BlogPostV2 } from "./BlogPost";
43
+ export { Pitch } from "./Pitch";
44
44
  export { KeyFigure } from "./KeyFigure";
45
45
  export { ContactBlock, contactBlockBackgrounds } from "./ContactBlock";
46
46
  export type { ContactBlockBackground } from "./ContactBlock";
package/lib/index.js CHANGED
@@ -87,12 +87,6 @@ Object.defineProperty(exports, "BlockConcept", {
87
87
  return _Embed.BlockConcept;
88
88
  }
89
89
  });
90
- Object.defineProperty(exports, "BlogPostV2", {
91
- enumerable: true,
92
- get: function () {
93
- return _BlogPost.BlogPostV2;
94
- }
95
- });
96
90
  Object.defineProperty(exports, "Breadcrumb", {
97
91
  enumerable: true,
98
92
  get: function () {
@@ -381,6 +375,12 @@ Object.defineProperty(exports, "PdfFile", {
381
375
  return _FileList.PdfFile;
382
376
  }
383
377
  });
378
+ Object.defineProperty(exports, "Pitch", {
379
+ enumerable: true,
380
+ get: function () {
381
+ return _Pitch.Pitch;
382
+ }
383
+ });
384
384
  Object.defineProperty(exports, "RelatedArticle", {
385
385
  enumerable: true,
386
386
  get: function () {
@@ -655,7 +655,7 @@ var _ContentTypeBlockQuote = require("./ContentTypeBlockQuote/ContentTypeBlockQu
655
655
  var _ContentTypeFramedContent = require("./ContentTypeFramedContent/ContentTypeFramedContent");
656
656
  var _CopyParagraphButton = _interopRequireDefault(require("./CopyParagraphButton"));
657
657
  var _TagSelector = require("./TagSelector/TagSelector");
658
- var _BlogPost = require("./BlogPost");
658
+ var _Pitch = require("./Pitch");
659
659
  var _KeyFigure = require("./KeyFigure");
660
660
  var _ContactBlock = require("./ContactBlock");
661
661
  var _CampaignBlock = require("./CampaignBlock");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.52-alpha.0",
3
+ "version": "56.0.53-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -33,10 +33,10 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ndla/core": "^5.0.2",
36
- "@ndla/icons": "^8.0.31-alpha.0",
36
+ "@ndla/icons": "^8.0.32-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.46-alpha.0",
39
- "@ndla/safelink": "^7.0.46-alpha.0",
38
+ "@ndla/primitives": "^1.0.47-alpha.0",
39
+ "@ndla/safelink": "^7.0.47-alpha.0",
40
40
  "@ndla/styled-system": "^0.0.24",
41
41
  "@ndla/util": "^5.0.0-alpha.0",
42
42
  "html-react-parser": "^5.1.8",
@@ -50,13 +50,13 @@
50
50
  "react-router-dom": "> 6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@ndla/preset-panda": "^0.0.40",
53
+ "@ndla/preset-panda": "^0.0.41",
54
54
  "@ndla/types-backend": "^0.2.86",
55
- "@ndla/types-embed": "^5.0.3-alpha.0",
55
+ "@ndla/types-embed": "^5.0.4-alpha.0",
56
56
  "@pandacss/dev": "^0.46.0"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "2277fee3427d8c14db9b299485dc57f2779af69f"
61
+ "gitHead": "1566b12dac651e40b3300afe8f41080649a9eed5"
62
62
  }
@@ -10,8 +10,8 @@ import { Meta, StoryFn } from "@storybook/react";
10
10
  import { PageContent } from "@ndla/primitives";
11
11
  import { ArticleContent, ArticleWrapper } from "@ndla/ui";
12
12
  import { Grid } from "./Grid";
13
- import { BlogPostStory } from "../BlogPost/BlogPost.stories";
14
13
  import { Plain } from "../KeyFigure/KeyFigure.stories";
14
+ import { Default as PitchStory } from "../Pitch/Pitch.stories";
15
15
 
16
16
  export default {
17
17
  title: "Components/Grid",
@@ -59,17 +59,15 @@ export const GridKeyPerformanceStory: StoryFn<typeof Grid> = ({ ...args }) => {
59
59
  return <Grid {...args}>{items}</Grid>;
60
60
  };
61
61
 
62
- export const GridBlogPostStory: StoryFn<typeof Grid> = ({ ...args }) => {
62
+ export const GridPitchStory: StoryFn<typeof Grid> = ({ ...args }) => {
63
63
  const columns = args.columns === "2x2" ? 4 : parseInt(args.columns);
64
64
  const items = new Array(columns).fill(
65
65
  <div data-type="grid-cell" data-parallax-cell="false">
66
- <BlogPostStory
67
- metaImage={BlogPostStory.args?.metaImage!}
68
- title={BlogPostStory.args?.title!}
69
- size={"normal"}
70
- headingLevel={BlogPostStory.args?.headingLevel}
71
- url={BlogPostStory.args?.url!}
72
- author={BlogPostStory.args?.author}
66
+ <PitchStory
67
+ metaImage={PitchStory.args?.metaImage!}
68
+ title={PitchStory.args?.title!}
69
+ url={PitchStory.args?.url!}
70
+ description={PitchStory.args?.description}
73
71
  />
74
72
  </div>,
75
73
  );
@@ -0,0 +1,49 @@
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 { Meta, StoryFn } from "@storybook/react";
10
+ import { PageContent } from "@ndla/primitives";
11
+ import { Pitch } from "./Pitch";
12
+ import { ArticleContent, ArticleWrapper } from "../Article";
13
+ import { Grid } from "../Grid";
14
+
15
+ export default {
16
+ title: "Components/Pitch",
17
+ component: Pitch,
18
+ tags: ["autodocs"],
19
+ args: {
20
+ title: "Min bloggpost",
21
+ description:
22
+ "Vil du øve på spansk? Kunne du tenke deg hjelp til naturfag? Drømmer du om en prat med Mandela? Lag din egen praterobot!",
23
+ url: "#",
24
+ metaImage: {
25
+ alt: "Yonghetempelet i Beijing. Foto.",
26
+ url: "https://api.test.ndla.no/image-api/raw/id//62870",
27
+ },
28
+ },
29
+ decorators: [
30
+ (Story) => (
31
+ <PageContent variant="page" asChild>
32
+ <ArticleWrapper>
33
+ <ArticleContent>
34
+ <Story />
35
+ </ArticleContent>
36
+ </ArticleWrapper>
37
+ </PageContent>
38
+ ),
39
+ ],
40
+ } as Meta<typeof Pitch>;
41
+
42
+ export const Default: StoryFn<typeof Pitch> = ({ ...args }) => {
43
+ return (
44
+ <Grid columns="2" background="transparent">
45
+ <Pitch {...args} />
46
+ <Pitch {...args} />
47
+ </Grid>
48
+ );
49
+ };
@@ -0,0 +1,83 @@
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 parse from "html-react-parser";
10
+ import { CardHeading, CardImage, CardRoot, Text } from "@ndla/primitives";
11
+ import { SafeLink } from "@ndla/safelink";
12
+ import { styled } from "@ndla/styled-system/jsx";
13
+ import { linkOverlay } from "@ndla/styled-system/patterns";
14
+ import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
15
+
16
+ export interface Props {
17
+ title: string;
18
+ url: string;
19
+ description?: string;
20
+ metaImage: {
21
+ url: string;
22
+ alt: string;
23
+ };
24
+ path?: string;
25
+ }
26
+
27
+ const StyledCardHeading = styled(CardHeading, {
28
+ base: {
29
+ paddingBlockStart: "medium",
30
+ },
31
+ });
32
+
33
+ const StyledText = styled(Text, {
34
+ base: {
35
+ paddingBlockEnd: "medium",
36
+ },
37
+ });
38
+
39
+ const StyledCardRoot = styled(CardRoot, {
40
+ base: {
41
+ border: "0",
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ gap: "small",
45
+ },
46
+ });
47
+
48
+ const StyledCardImage = styled(CardImage, {
49
+ base: {
50
+ aspectRatio: "16/9",
51
+ height: "unset",
52
+ },
53
+ });
54
+
55
+ export const Pitch = ({ title, url, metaImage, path, description }: Props) => {
56
+ const href = getPossiblyRelativeUrl(url, path);
57
+
58
+ return (
59
+ <StyledCardRoot variant="subtle" data-embed-type="pitch" asChild consumeCss>
60
+ <div>
61
+ <StyledCardHeading textStyle="heading.small" asChild consumeCss>
62
+ <SafeLink to={href} unstyled css={linkOverlay.raw()}>
63
+ {parse(title)}
64
+ </SafeLink>
65
+ </StyledCardHeading>
66
+ {!!description && (
67
+ <StyledText textStyle="body.xlarge" asChild consumeCss>
68
+ <div>{parse(description)}</div>
69
+ </StyledText>
70
+ )}
71
+ <StyledCardImage
72
+ variant="rounded"
73
+ src={metaImage.url}
74
+ alt={metaImage.alt}
75
+ sizes="180px"
76
+ fallbackWidth={300}
77
+ width={550}
78
+ height={310}
79
+ />
80
+ </div>
81
+ </StyledCardRoot>
82
+ );
83
+ };
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- export { default as BlogPostV2 } from "./BlogPost";
9
+ export { Pitch } from "./Pitch";
package/src/index.ts CHANGED
@@ -133,7 +133,7 @@ export {
133
133
  TagSelectorInput,
134
134
  } from "./TagSelector/TagSelector";
135
135
 
136
- export { BlogPostV2 } from "./BlogPost";
136
+ export { Pitch } from "./Pitch";
137
137
  export { KeyFigure } from "./KeyFigure";
138
138
  export { ContactBlock, contactBlockBackgrounds } from "./ContactBlock";
139
139
  export type { ContactBlockBackground } from "./ContactBlock";
@@ -1,129 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-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 parse from "html-react-parser";
10
- import { useTranslation } from "react-i18next";
11
- import { Heading } from "@ndla/primitives";
12
- import { SafeLink } from "@ndla/safelink";
13
- import { styled } from "@ndla/styled-system/jsx";
14
- import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
15
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
- const Container = styled(SafeLink, {
17
- base: {
18
- display: "flex",
19
- flexDirection: "column",
20
- color: "text.default",
21
- backgroundColor: "background.default",
22
- gap: "medium",
23
- border: "1px solid",
24
- borderColor: "stroke.subtle",
25
- borderRadius: "xsmall",
26
- transitionDuration: "fast",
27
- transitionProperty: "background-color, border-color, max-width",
28
- transitionTimingFunction: "default",
29
- height: "100%",
30
- "&:hover, &:focus-visible": {
31
- borderColor: "stroke.hover",
32
- backgroundColor: "surface.actionSubtle.hover",
33
- "& h1, h2, h3, h4, h5, h6": {
34
- textDecoration: "underline"
35
- }
36
- }
37
- },
38
- defaultVariants: {
39
- size: "normal"
40
- },
41
- variants: {
42
- // TODO: Reconsider these sizes. Maybe they should match up with surface?
43
- size: {
44
- normal: {
45
- paddingBlock: "medium",
46
- paddingInline: "medium",
47
- tabletWide: {
48
- maxWidth: "350px"
49
- }
50
- },
51
- large: {
52
- paddingBlock: "xlarge",
53
- paddingInline: "xxlarge",
54
- tabletWide: {
55
- maxWidth: "532px"
56
- }
57
- }
58
- }
59
- }
60
- },
61
- // TODO: Reconsider this once we handle SafeLink
62
- {
63
- baseComponent: true
64
- });
65
- const AuthorContainer = styled("div", {
66
- base: {
67
- display: "flex",
68
- alignItems: "center",
69
- gap: "xsmall",
70
- textTransform: "uppercase",
71
- textStyle: "body.large"
72
- }
73
- });
74
- const StyledImg = styled("img", {
75
- base: {
76
- borderRadius: "xsmall",
77
- flex: "1",
78
- objectFit: "cover",
79
- width: "100%",
80
- height: "100%",
81
- border: "0"
82
- }
83
- });
84
- const StyledHeading = styled(Heading, {
85
- base: {
86
- display: "inline-block",
87
- width: "fit-content"
88
- }
89
- });
90
- const BlogPost = _ref => {
91
- let {
92
- title,
93
- author,
94
- url,
95
- metaImage,
96
- headingLevel: Heading = "h3",
97
- size = "normal",
98
- path
99
- } = _ref;
100
- const {
101
- t
102
- } = useTranslation();
103
- const href = getPossiblyRelativeUrl(url, path);
104
- const imageWidth = size === "large" ? 532 : 350;
105
- return /*#__PURE__*/_jsxs(Container, {
106
- "data-size": size,
107
- to: href,
108
- size: size,
109
- "data-embed-type": "blog-post",
110
- children: [/*#__PURE__*/_jsx(StyledHeading, {
111
- className: "blog-title",
112
- asChild: true,
113
- consumeCss: true,
114
- textStyle: "title.large",
115
- children: /*#__PURE__*/_jsx(Heading, {
116
- children: parse(title)
117
- })
118
- }), /*#__PURE__*/_jsx(StyledImg, {
119
- src: `${metaImage.url}?width=${imageWidth}`,
120
- alt: metaImage.alt
121
- }), !!author && /*#__PURE__*/_jsx(AuthorContainer, {
122
- "aria-label": t("article.writtenBy", {
123
- authors: author
124
- }),
125
- children: author
126
- })]
127
- });
128
- };
129
- export default BlogPost;
@@ -1,22 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-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
- import { HeadingLevel } from "../types";
9
- export interface Props {
10
- title: string;
11
- author?: string;
12
- url: string;
13
- headingLevel?: HeadingLevel;
14
- size?: "normal" | "large";
15
- metaImage: {
16
- url: string;
17
- alt: string;
18
- };
19
- path?: string;
20
- }
21
- declare const BlogPost: ({ title, author, url, metaImage, headingLevel: Heading, size, path }: Props) => import("react/jsx-runtime").JSX.Element;
22
- export default BlogPost;
@@ -1,136 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
8
- var _reactI18next = require("react-i18next");
9
- var _primitives = require("@ndla/primitives");
10
- var _safelink = require("@ndla/safelink");
11
- var _jsx2 = require("@ndla/styled-system/jsx");
12
- var _relativeUrl = require("../utils/relativeUrl");
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- /**
16
- * Copyright (c) 2023-present, NDLA.
17
- *
18
- * This source code is licensed under the GPLv3 license found in the
19
- * LICENSE file in the root directory of this source tree.
20
- *
21
- */
22
-
23
- const Container = (0, _jsx2.styled)(_safelink.SafeLink, {
24
- base: {
25
- display: "flex",
26
- flexDirection: "column",
27
- color: "text.default",
28
- backgroundColor: "background.default",
29
- gap: "medium",
30
- border: "1px solid",
31
- borderColor: "stroke.subtle",
32
- borderRadius: "xsmall",
33
- transitionDuration: "fast",
34
- transitionProperty: "background-color, border-color, max-width",
35
- transitionTimingFunction: "default",
36
- height: "100%",
37
- "&:hover, &:focus-visible": {
38
- borderColor: "stroke.hover",
39
- backgroundColor: "surface.actionSubtle.hover",
40
- "& h1, h2, h3, h4, h5, h6": {
41
- textDecoration: "underline"
42
- }
43
- }
44
- },
45
- defaultVariants: {
46
- size: "normal"
47
- },
48
- variants: {
49
- // TODO: Reconsider these sizes. Maybe they should match up with surface?
50
- size: {
51
- normal: {
52
- paddingBlock: "medium",
53
- paddingInline: "medium",
54
- tabletWide: {
55
- maxWidth: "350px"
56
- }
57
- },
58
- large: {
59
- paddingBlock: "xlarge",
60
- paddingInline: "xxlarge",
61
- tabletWide: {
62
- maxWidth: "532px"
63
- }
64
- }
65
- }
66
- }
67
- },
68
- // TODO: Reconsider this once we handle SafeLink
69
- {
70
- baseComponent: true
71
- });
72
- const AuthorContainer = (0, _jsx2.styled)("div", {
73
- base: {
74
- display: "flex",
75
- alignItems: "center",
76
- gap: "xsmall",
77
- textTransform: "uppercase",
78
- textStyle: "body.large"
79
- }
80
- });
81
- const StyledImg = (0, _jsx2.styled)("img", {
82
- base: {
83
- borderRadius: "xsmall",
84
- flex: "1",
85
- objectFit: "cover",
86
- width: "100%",
87
- height: "100%",
88
- border: "0"
89
- }
90
- });
91
- const StyledHeading = (0, _jsx2.styled)(_primitives.Heading, {
92
- base: {
93
- display: "inline-block",
94
- width: "fit-content"
95
- }
96
- });
97
- const BlogPost = _ref => {
98
- let {
99
- title,
100
- author,
101
- url,
102
- metaImage,
103
- headingLevel: Heading = "h3",
104
- size = "normal",
105
- path
106
- } = _ref;
107
- const {
108
- t
109
- } = (0, _reactI18next.useTranslation)();
110
- const href = (0, _relativeUrl.getPossiblyRelativeUrl)(url, path);
111
- const imageWidth = size === "large" ? 532 : 350;
112
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
113
- "data-size": size,
114
- to: href,
115
- size: size,
116
- "data-embed-type": "blog-post",
117
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeading, {
118
- className: "blog-title",
119
- asChild: true,
120
- consumeCss: true,
121
- textStyle: "title.large",
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Heading, {
123
- children: (0, _htmlReactParser.default)(title)
124
- })
125
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledImg, {
126
- src: `${metaImage.url}?width=${imageWidth}`,
127
- alt: metaImage.alt
128
- }), !!author && /*#__PURE__*/(0, _jsxRuntime.jsx)(AuthorContainer, {
129
- "aria-label": t("article.writtenBy", {
130
- authors: author
131
- }),
132
- children: author
133
- })]
134
- });
135
- };
136
- var _default = exports.default = BlogPost;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BlogPostV2", {
7
- enumerable: true,
8
- get: function () {
9
- return _BlogPost.default;
10
- }
11
- });
12
- var _BlogPost = _interopRequireDefault(require("./BlogPost"));
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -1,36 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-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 { Meta, StoryFn } from "@storybook/react";
10
- import BlogPost, { Props } from "./BlogPost";
11
-
12
- const args: Props = {
13
- title: "Min bloggpost",
14
- author: "Ola Nordmann",
15
- url: "#",
16
- headingLevel: "h3",
17
- size: "large",
18
- metaImage: {
19
- alt: "Yonghetempelet i Beijing. Foto.",
20
- url: "https://api.test.ndla.no/image-api/raw/id//62870",
21
- },
22
- };
23
-
24
- export default {
25
- title: "Components/Blog Post",
26
- component: BlogPost,
27
- tags: ["autodocs"],
28
- args: args,
29
- } as Meta<typeof BlogPost>;
30
-
31
- export const BlogPostStory: StoryFn<typeof BlogPost> = ({ ...args }) => {
32
- return <BlogPost {...args} />;
33
- };
34
-
35
- BlogPostStory.args = args;
36
- BlogPostStory.storyName = "BlogPost";
@@ -1,124 +0,0 @@
1
- /**
2
- * Copyright (c) 2023-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 parse from "html-react-parser";
10
- import { useTranslation } from "react-i18next";
11
- import { Heading } from "@ndla/primitives";
12
- import { SafeLink } from "@ndla/safelink";
13
- import { styled } from "@ndla/styled-system/jsx";
14
- import { HeadingLevel } from "../types";
15
- import { getPossiblyRelativeUrl } from "../utils/relativeUrl";
16
-
17
- export interface Props {
18
- title: string;
19
- author?: string;
20
- url: string;
21
- headingLevel?: HeadingLevel;
22
- size?: "normal" | "large";
23
- metaImage: {
24
- url: string;
25
- alt: string;
26
- };
27
- path?: string;
28
- }
29
-
30
- const Container = styled(
31
- SafeLink,
32
- {
33
- base: {
34
- display: "flex",
35
- flexDirection: "column",
36
- color: "text.default",
37
- backgroundColor: "background.default",
38
- gap: "medium",
39
- border: "1px solid",
40
- borderColor: "stroke.subtle",
41
- borderRadius: "xsmall",
42
- transitionDuration: "fast",
43
- transitionProperty: "background-color, border-color, max-width",
44
- transitionTimingFunction: "default",
45
- height: "100%",
46
- "&:hover, &:focus-visible": {
47
- borderColor: "stroke.hover",
48
- backgroundColor: "surface.actionSubtle.hover",
49
- "& h1, h2, h3, h4, h5, h6": {
50
- textDecoration: "underline",
51
- },
52
- },
53
- },
54
- defaultVariants: {
55
- size: "normal",
56
- },
57
- variants: {
58
- // TODO: Reconsider these sizes. Maybe they should match up with surface?
59
- size: {
60
- normal: {
61
- paddingBlock: "medium",
62
- paddingInline: "medium",
63
- tabletWide: {
64
- maxWidth: "350px",
65
- },
66
- },
67
- large: {
68
- paddingBlock: "xlarge",
69
- paddingInline: "xxlarge",
70
- tabletWide: {
71
- maxWidth: "532px",
72
- },
73
- },
74
- },
75
- },
76
- },
77
- // TODO: Reconsider this once we handle SafeLink
78
- { baseComponent: true },
79
- );
80
-
81
- const AuthorContainer = styled("div", {
82
- base: {
83
- display: "flex",
84
- alignItems: "center",
85
- gap: "xsmall",
86
- textTransform: "uppercase",
87
- textStyle: "body.large",
88
- },
89
- });
90
-
91
- const StyledImg = styled("img", {
92
- base: {
93
- borderRadius: "xsmall",
94
- flex: "1",
95
- objectFit: "cover",
96
- width: "100%",
97
- height: "100%",
98
- border: "0",
99
- },
100
- });
101
-
102
- const StyledHeading = styled(Heading, {
103
- base: {
104
- display: "inline-block",
105
- width: "fit-content",
106
- },
107
- });
108
-
109
- const BlogPost = ({ title, author, url, metaImage, headingLevel: Heading = "h3", size = "normal", path }: Props) => {
110
- const { t } = useTranslation();
111
- const href = getPossiblyRelativeUrl(url, path);
112
- const imageWidth = size === "large" ? 532 : 350;
113
- return (
114
- <Container data-size={size} to={href} size={size} data-embed-type="blog-post">
115
- <StyledHeading className="blog-title" asChild consumeCss textStyle="title.large">
116
- <Heading>{parse(title)}</Heading>
117
- </StyledHeading>
118
- <StyledImg src={`${metaImage.url}?width=${imageWidth}`} alt={metaImage.alt} />
119
- {!!author && <AuthorContainer aria-label={t("article.writtenBy", { authors: author })}>{author}</AuthorContainer>}
120
- </Container>
121
- );
122
- };
123
-
124
- export default BlogPost;