@bonniernews/dn-design-system-web 32.7.37 → 32.7.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/assets/types/teaser-props.ts +2 -0
- package/components/teaser-large/README.md +1 -0
- package/components/teaser-longlife/README.md +1 -1
- package/components/teaser-standard/README-njk.md +68 -0
- package/components/teaser-standard/README.md +42 -68
- package/components/teaser-swipe-card/README.md +2 -1
- package/package.json +1 -1
- package/preact/assets/types/teaser-props.d.ts +2 -0
- package/preact/components/teaser-counter/teaser-counter.js +6 -2
- package/preact/components/teaser-counter/teaser-counter.js.map +2 -2
- package/preact/components/teaser-large/teaser-large.js +8 -4
- package/preact/components/teaser-large/teaser-large.js.map +2 -2
- package/preact/components/teaser-list-swipe/teaser-list-swipe.js +2 -2
- package/preact/components/teaser-list-swipe/teaser-list-swipe.js.map +2 -2
- package/preact/components/teaser-longlife/teaser-longlife.js +8 -4
- package/preact/components/teaser-longlife/teaser-longlife.js.map +2 -2
- package/preact/components/teaser-native/teaser-native.js +8 -4
- package/preact/components/teaser-native/teaser-native.js.map +2 -2
- package/preact/components/teaser-onsite/teaser-onsite.js +8 -4
- package/preact/components/teaser-onsite/teaser-onsite.js.map +2 -2
- package/preact/components/teaser-right-now/teaser-right-now.js +2 -2
- package/preact/components/teaser-right-now/teaser-right-now.js.map +2 -2
- package/preact/components/teaser-slideshow/teaser-slideshow.js +8 -4
- package/preact/components/teaser-slideshow/teaser-slideshow.js.map +2 -2
- package/preact/components/teaser-split/teaser-split.js +8 -4
- package/preact/components/teaser-split/teaser-split.js.map +2 -2
- package/preact/components/teaser-standard/teaser-standard.d.ts +13 -0
- package/preact/components/teaser-standard/teaser-standard.js +177 -0
- package/preact/components/teaser-standard/teaser-standard.js.map +7 -0
- package/preact/components/teaser-swipe-card/teaser-swipe-card.js +2 -2
- package/preact/components/teaser-swipe-card/teaser-swipe-card.js.map +2 -2
- package/preact/components/teaser-tipsa/teaser-tipsa.js +2 -2
- package/preact/components/teaser-tipsa/teaser-tipsa.js.map +2 -2
- package/preact/helpers/teaser.d.ts +4 -4
- package/components/teaser-standard/README-UXD.md +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [32.7.38](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.7.37...@bonniernews/dn-design-system-web@32.7.38) (2025-07-18)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **web:** teaser standard tsx ([#1838](https://github.com/BonnierNews/dn-design-system/issues/1838)) ([b490e9b](https://github.com/BonnierNews/dn-design-system/commit/b490e9b6835d585fd9d7d7928018b9e7897ab3bb))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Maintenance
|
|
16
|
+
|
|
17
|
+
* **deps-dev:** bump @react-native/babel-preset from 0.75.2 to 0.80.1 ([#1808](https://github.com/BonnierNews/dn-design-system/issues/1808)) ([45be5ae](https://github.com/BonnierNews/dn-design-system/commit/45be5aed0a32046ddcf483940332dea685107b3c))
|
|
18
|
+
* **deps-dev:** bump @react-native/metro-config from 0.79.1 to 0.80.1 ([#1797](https://github.com/BonnierNews/dn-design-system/issues/1797)) ([a282a9b](https://github.com/BonnierNews/dn-design-system/commit/a282a9b8113e21cec1085db91dc62931c3dec85e))
|
|
19
|
+
* **deps:** bump @react-native-community/datetimepicker from 8.4.1 to 8.4.2 ([#1789](https://github.com/BonnierNews/dn-design-system/issues/1789)) ([b67f703](https://github.com/BonnierNews/dn-design-system/commit/b67f70383d20031b6ae48601c5acd231b1dde491))
|
|
20
|
+
* **deps:** bump @react-native/typescript-config from 0.75.2 to 0.80.1 ([#1799](https://github.com/BonnierNews/dn-design-system/issues/1799)) ([8c4eb5e](https://github.com/BonnierNews/dn-design-system/commit/8c4eb5e7c5f34b077e22ef24b2bbd1b11bce1e1d))
|
|
21
|
+
* **deps:** bump brace-expansion from 1.1.11 to 1.1.12 in /server ([#1837](https://github.com/BonnierNews/dn-design-system/issues/1837)) ([3c86ccd](https://github.com/BonnierNews/dn-design-system/commit/3c86ccd7a2d5381b197e49c11a0def6fec94835b))
|
|
22
|
+
* prerelease packages ([75deb71](https://github.com/BonnierNews/dn-design-system/commit/75deb71018f14f60f1f6b25fbf9f752a3f58791f))
|
|
23
|
+
* prerelease packages ([427ad11](https://github.com/BonnierNews/dn-design-system/commit/427ad11fc5ff365d19fe488939f7842b384b28be))
|
|
24
|
+
|
|
7
25
|
## [32.7.37](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.7.36...@bonniernews/dn-design-system-web@32.7.37) (2025-07-18)
|
|
8
26
|
|
|
9
27
|
|
|
@@ -22,6 +22,8 @@ export interface TeaserProps extends SharedProps {
|
|
|
22
22
|
sticker?: string;
|
|
23
23
|
/** Main image or other media */
|
|
24
24
|
media?: ComponentChild;
|
|
25
|
+
/** Flag so we can handle square teaser images */
|
|
26
|
+
isSquareImage?: boolean
|
|
25
27
|
/** Image of the author */
|
|
26
28
|
bylinePicture?: ComponentChild;
|
|
27
29
|
/** If the headline should be italic */
|
|
@@ -20,6 +20,7 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
20
20
|
| isLargeHeadline | If the headline should be large (only if `isItalicHeadline` is true)<br />boolean | false |
|
|
21
21
|
| isItalicHeadline | If the headline should be italic<br />boolean | false |
|
|
22
22
|
| title\* | Heading of the teaser<br />string | \- |
|
|
23
|
+
| isSquareImage | Flag so we can handle square teaser images<br />boolean | \- |
|
|
23
24
|
| media | Main image or other media<br />ComponentChild | \- |
|
|
24
25
|
| sticker | Red text before the text<br />string | \- |
|
|
25
26
|
| highlight | Text before the heading<br />string | \- |
|
|
@@ -13,8 +13,8 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
13
13
|
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
14
14
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | \- |
|
|
15
15
|
| theme | The theme-class to apply to the teaser<br />"kultur", "nyheter" | \- |
|
|
16
|
-
| vignette | Top text in the teaser<br />string | \- |
|
|
17
16
|
| media | Main image or other media<br />ComponentChild | \- |
|
|
17
|
+
| vignette | Top text in the teaser<br />string | \- |
|
|
18
18
|
|
|
19
19
|
```jsx
|
|
20
20
|
<TeaserLonglife
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-standard](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-standard)
|
|
2
|
+
- Storybook: [TeaserStandard](https://designsystem.dn.se/?path=/docs/section-teaserstandard--docs)
|
|
3
|
+
- Storybook (Latest): [TeaserStandard](https://designsystem-latest.dn.se/?path=/docs/section-teaserstandard--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-standard
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|title | String | yes | | | Heading of the teaser |
|
|
14
|
+
|targetLink | String | yes | | | Target URL for the teaser |
|
|
15
|
+
|variant | String | no | "default" or "podcast" | "default" | |
|
|
16
|
+
|areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
|
|
17
|
+
|theme | String | no | nyheter, kultur | (empty) | The theme-class to apply to the teaser |
|
|
18
|
+
|text | String | no | | | Teaser subtext |
|
|
19
|
+
|vignette | String | no | | | Top text in the teaser |
|
|
20
|
+
|highlight | String | no | | | Text before the heading |
|
|
21
|
+
|sticker | String | no | | | Red text before the text |
|
|
22
|
+
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
23
|
+
|bylineHtml | HTML String | no | | | Side image of the author |
|
|
24
|
+
|isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
|
|
25
|
+
|isCompact | bool | no | true, false | false | If the headline should be compact |
|
|
26
|
+
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
27
|
+
|publicationTime | string | no | | null | Publication time text. |
|
|
28
|
+
|duration | string | no | | null | Duration of podcast. |
|
|
29
|
+
|isSquareImage | boolean | no | | false | Flag so we can handle square teaser images |
|
|
30
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
31
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
32
|
+
|~forcePx~ | | | | | Not supported |
|
|
33
|
+
|
|
34
|
+
## Minimum requirement example
|
|
35
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
36
|
+
|
|
37
|
+
### Nunjucks
|
|
38
|
+
```html
|
|
39
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard.njk' import TeaserStandard %}
|
|
40
|
+
|
|
41
|
+
{{ TeaserStandard({
|
|
42
|
+
title: "Upp på börsen",
|
|
43
|
+
text: "Det ser ganska normalt ut på Stockholmsbörsen.",
|
|
44
|
+
highlight: "Ekonominytt:"
|
|
45
|
+
})}}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### SCSS
|
|
49
|
+
```scss
|
|
50
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard" as *;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Javascript
|
|
54
|
+
This version is rarely used to render a teaser dynamically in the browser. For example, it is used to render reserv-teasers in failover. This version **ONLY** supports the `title`, `text`, `targetLink`, `classNames` and `attributes` parameters.
|
|
55
|
+
|
|
56
|
+
```javascript
|
|
57
|
+
import { dsTeaserStandard } from "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard";
|
|
58
|
+
|
|
59
|
+
// NB: javascript only supports a subset of all parameters
|
|
60
|
+
const parameters = {
|
|
61
|
+
title: "Upp på börsen",
|
|
62
|
+
text: "Det ser ganska normalt ut på Stockholmsbörsen",
|
|
63
|
+
targetLink: "https://www.dn.se/ekonomi/",
|
|
64
|
+
attributes: { "data-test" : "test-value" }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const teaserStandardHtml = dsTeaserStandard(parameters);
|
|
68
|
+
```
|
|
@@ -1,68 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
text: "Det ser ganska normalt ut på Stockholmsbörsen.",
|
|
44
|
-
highlight: "Ekonominytt:"
|
|
45
|
-
})}}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### SCSS
|
|
49
|
-
```scss
|
|
50
|
-
@use "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard" as *;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Javascript
|
|
54
|
-
This version is rarely used to render a teaser dynamically in the browser. For example, it is used to render reserv-teasers in failover. This version **ONLY** supports the `title`, `text`, `targetLink`, `classNames` and `attributes` parameters.
|
|
55
|
-
|
|
56
|
-
```javascript
|
|
57
|
-
import { dsTeaserStandard } from "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard";
|
|
58
|
-
|
|
59
|
-
// NB: javascript only supports a subset of all parameters
|
|
60
|
-
const parameters = {
|
|
61
|
-
title: "Upp på börsen",
|
|
62
|
-
text: "Det ser ganska normalt ut på Stockholmsbörsen",
|
|
63
|
-
targetLink: "https://www.dn.se/ekonomi/",
|
|
64
|
-
attributes: { "data-test" : "test-value" }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const teaserStandardHtml = dsTeaserStandard(parameters);
|
|
68
|
-
```
|
|
1
|
+
TeaserStandard
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
* GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-standard](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-standard)
|
|
5
|
+
* Storybook: [TeaserStandard](https://designsystem.dn.se/?path=/docs/section-teaserstandard--docs)
|
|
6
|
+
|
|
7
|
+
The component will not include styling by itself. Make sure to include the right styles for the component. See example below: `@use '@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard.scss'`
|
|
8
|
+
|
|
9
|
+
| Name | Description | Default |
|
|
10
|
+
|:--- | :--- | :--- |
|
|
11
|
+
| isSquareImage | Flag so we can handle square teaser images<br />boolean | false |
|
|
12
|
+
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | { } |
|
|
13
|
+
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
14
|
+
| sectionName | Shows in teaser footer<br />string | \- |
|
|
15
|
+
| bylineHtml | Byline HTML<br />string | \- |
|
|
16
|
+
| bylineAspectRatio | Byline aspect ratio<br />string | \- |
|
|
17
|
+
| duration | Duration of podcast<br />string | \- |
|
|
18
|
+
| publicationTime | Publication time text<br />string | \- |
|
|
19
|
+
| isFlashingDot | If there should be a flashing ball before the text<br />boolean | false |
|
|
20
|
+
| isLargeHeadline | If the headline should be large (only if `isItalicHeadline` is true)<br />boolean | \- |
|
|
21
|
+
| isItalicHeadline | If the headline should be italic<br />boolean | \- |
|
|
22
|
+
| bylinePicture | Image of the author<br />ComponentChild | \- |
|
|
23
|
+
| isCompact | If the teaser should be compact<br />boolean | \- |
|
|
24
|
+
| media | Main image or other media<br />ComponentChild | \- |
|
|
25
|
+
| sticker | Red text before the text<br />string | \- |
|
|
26
|
+
| highlight | Text before the heading<br />string | \- |
|
|
27
|
+
| vignette | Top text in the teaser<br />string | \- |
|
|
28
|
+
| text | Teaser subtext<br />string | \- |
|
|
29
|
+
| theme | The theme-class to apply to the teaser<br />"kultur", "nyheter" | \- |
|
|
30
|
+
| areaType | The area where the column is rendered<br />"right", "bauta", "bautaxl" | \- |
|
|
31
|
+
| variant | Variant of the teaser<br />"default", "podcast", "insandare", "direkt" | \- |
|
|
32
|
+
| targetLink\* | Target URL for the teaser<br />string | \- |
|
|
33
|
+
| title\* | Heading of the teaser<br />string | \- |
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
<TeaserStandard
|
|
37
|
+
media={<TeaserImage byline="Foto: Paul Hansen" image={<ExamplePicture alt="" className="picture picture--placeholder" sizes="(min-width: 1340px) 1010px, (min-width: 1100px) calc(100vw - 330px), 100vw" src="https://cached-images.bonnier.news/gcs/bilder/dn-mly/752e4f6d-7c66-4d24-81b1-4b24b12771a9.jpeg" srcSet="https://cached-images.bonnier.news/gcs/bilder/dn-mly/752e4f6d-7c66-4d24-81b1-4b24b12771a9.jpeg?interpolation=lanczos-none&fit=around%7C770:434&crop=770:h;center,top&output-quality=80 770w, https://cached-images.bonnier.news/gcs/bilder/dn-mly/752e4f6d-7c66-4d24-81b1-4b24b12771a9.jpeg?interpolation=lanczos-none&fit=around%7C1010:569&crop=1010:h;center,top&output-quality=80 1010w, https://cached-images.bonnier.news/gcs/bilder/dn-mly/752e4f6d-7c66-4d24-81b1-4b24b12771a9.jpeg?interpolation=lanczos-none&fit=around%7C1540:867&crop=1540:h;center,top&output-quality=60 1540w, https://cached-images.bonnier.news/gcs/bilder/dn-mly/752e4f6d-7c66-4d24-81b1-4b24b12771a9.jpeg?interpolation=lanczos-none&fit=around%7C2020:1137&crop=2020:h;center,top&output-quality=60 2020w" style={{aspectRatio: '16 / 9'}}/>}/>}
|
|
38
|
+
targetLink="https://www.dn.se/sverige/ryska-militarflyg-over-ostersjon/"
|
|
39
|
+
text=" Flög utan transpondrar • Upptäcktes av tyska flygvapnet."
|
|
40
|
+
title="Ryska militärflyg över Östersjön"
|
|
41
|
+
/>
|
|
42
|
+
```
|
|
@@ -8,7 +8,7 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
8
8
|
|
|
9
9
|
| Name | Description | Default |
|
|
10
10
|
|:--- | :--- | :--- |
|
|
11
|
-
|
|
|
11
|
+
| isSquareImage | Flag so we can handle square teaser images<br />boolean | \- |
|
|
12
12
|
| attributes | Ex. { target: "\_blank", "data-test": "lorem ipsum" }<br />Record<string, unknown> | \- |
|
|
13
13
|
| classNames | Ex. "my-special-class"<br />string | \- |
|
|
14
14
|
| sectionName | Shows in teaser footer<br />string | \- |
|
|
@@ -19,6 +19,7 @@ The component will not include styling by itself. Make sure to include the right
|
|
|
19
19
|
| isFlashingDot | If there should be a flashing ball before the text<br />boolean | \- |
|
|
20
20
|
| isLargeHeadline | If the headline should be large (only if `isItalicHeadline` is true)<br />boolean | \- |
|
|
21
21
|
| isItalicHeadline | If the headline should be italic<br />boolean | \- |
|
|
22
|
+
| bylinePicture | Image of the author<br />ComponentChild | \- |
|
|
22
23
|
| time | The timestamp text of the teaser<br />string | \- |
|
|
23
24
|
| media | Main image or other media<br />ComponentChild | \- |
|
|
24
25
|
| sticker | Red text before the text<br />string | \- |
|
package/package.json
CHANGED
|
@@ -21,6 +21,8 @@ export interface TeaserProps extends SharedProps {
|
|
|
21
21
|
sticker?: string;
|
|
22
22
|
/** Main image or other media */
|
|
23
23
|
media?: ComponentChild;
|
|
24
|
+
/** Flag so we can handle square teaser images */
|
|
25
|
+
isSquareImage?: boolean;
|
|
24
26
|
/** Image of the author */
|
|
25
27
|
bylinePicture?: ComponentChild;
|
|
26
28
|
/** If the headline should be italic */
|
|
@@ -32,8 +32,12 @@ import { jsx as jsx4 } from "preact/jsx-runtime";
|
|
|
32
32
|
|
|
33
33
|
// ../src/helpers/teaser.tsx
|
|
34
34
|
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "preact/jsx-runtime";
|
|
35
|
-
var Media = ({ media, rounded }) => {
|
|
36
|
-
const classNames =
|
|
35
|
+
var Media = ({ media, rounded, isSquareImage }) => {
|
|
36
|
+
const classNames = formatClassString([
|
|
37
|
+
"ds-teaser__media",
|
|
38
|
+
rounded && "ds-teaser__media--rounded",
|
|
39
|
+
isSquareImage && "ds-teaser__media--square-image"
|
|
40
|
+
]);
|
|
37
41
|
return media ? /* @__PURE__ */ jsx5("div", { className: classNames, children: media }) : null;
|
|
38
42
|
};
|
|
39
43
|
var Content = ({ children, bylinePicture }) => {
|