@bonniernews/dn-design-system-web 11.2.1 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
4
4
 
5
5
 
6
6
 
7
+ ## [11.3.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@11.2.1...@bonniernews/dn-design-system-web@11.3.0) (2024-02-09)
8
+
9
+
10
+ ### Features
11
+
12
+ * **web:** teaser footer and podcast variant on large, standard and split teasers ([#1192](https://github.com/BonnierNews/dn-design-system/issues/1192)) ([99987f4](https://github.com/BonnierNews/dn-design-system/commit/99987f4235bd4d2b133a56ee9290c7f10c44ebf9))
13
+
7
14
  ## [11.2.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@11.2.0...@bonniernews/dn-design-system-web@11.2.1) (2024-02-07)
8
15
 
9
16
 
@@ -3,6 +3,7 @@
3
3
  @use "../../components/vip-badge/vip-badge.scss";
4
4
  @use "../../components/teaser-image/teaser-image.scss";
5
5
  @use "../../components/teaser-dot/teaser-dot.scss";
6
+ @use "../../components/teaser-footer/teaser-footer.scss";
6
7
 
7
8
  // used in standard and native teaser
8
9
  $ds-teaser-standard-image-width-mobile: 104px;
@@ -68,17 +69,6 @@ $grade-size: ds-px-to-rem(34px);
68
69
  }
69
70
  }
70
71
 
71
- .ds-teaser__publication-time {
72
- display: block;
73
- @include ds-typography($ds-typography-functional-meta02regular);
74
- color: $ds-color-text-primary-02;
75
- margin-top: ds-spacing($ds-s-050);
76
- }
77
-
78
- .ds-teaser__text + .ds-teaser__publication-time {
79
- margin-top: ds-spacing($ds-s-075);
80
- }
81
-
82
72
  .ds-icon.ds-icon--grade {
83
73
  color: $ds-color-icon-primary;
84
74
  border-radius: 50%;
@@ -121,4 +111,16 @@ $grade-size: ds-px-to-rem(34px);
121
111
  padding-right: ds-spacing($ds-s-075);
122
112
  }
123
113
  }
114
+
115
+ &--podcast {
116
+ .ds-teaser__vignette {
117
+ display: flex;
118
+ }
119
+
120
+ .ds-icon--headphones {
121
+ height: ds-px-to-rem(16px);
122
+ width: ds-px-to-rem(16px);
123
+ margin-right: ds-spacing($ds-s-025);
124
+ }
125
+ }
124
126
  }
@@ -0,0 +1,40 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-footer](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-footer)
2
+ - Storybook: [Subcomponents > TeaserFooter](https://designsystem.dn.se/?path=/docs/section-subcomponents-teaserfooter--docs)
3
+ - Storybook (Latest): [Subcomponents > TeaserFooter](https://designsystem-latest.dn.se/?path=/docs/section-subcomponents-teaserfooter--docs)
4
+
5
+ ----
6
+
7
+ # TeaserFooter
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |variant | String | yes | "informationText" or "podcast" | | The variant to render |
14
+ |publicationTime | String | no | | | |
15
+ |sectionName | String | no | | | Name of section the teaser is connected to |
16
+ |duration | String | no | | | The length of the podcast |
17
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
18
+ |classNames | String | no | | | Ex. "my-special-class" |
19
+ |~forcePx~ | | | | | Not supported |
20
+
21
+ ## Minimum requirement example
22
+
23
+ ### Nunjucks
24
+
25
+ These are copy paste friendly examples to quickliy get started using a component.
26
+
27
+ ```html
28
+ {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
29
+
30
+ {{ TeaserFooter({
31
+ variant: 'informationText',
32
+ publicationTime: '09:45',
33
+ sectionName; 'Nyheter'
34
+ }) }}
35
+ ```
36
+
37
+ ### SCSS
38
+ ```scss
39
+ @use "@bonniernews/dn-design-system-web/assets/teaser-footer/teaser-footer";
40
+ ```
@@ -0,0 +1,47 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
3
+
4
+ {% macro TeaserFooter(params) %}
5
+ {% set componentClassName = "ds-teaser-footer" %}
6
+ {% set classNamePrefix = componentClassName + "--" %}
7
+ {% set attributes = getAttributes(params.attributes) %}
8
+
9
+ {%- set classes = [
10
+ componentClassName,
11
+ classNamePrefix + params.variant if params.variant,
12
+ params.classNames if params.classNames
13
+ ] | join(" ") %}
14
+
15
+ <div class="{{ classes }}" {{- attributes | safe }}>
16
+ {% if params.variant === "informationText" %}
17
+ {{
18
+ InformationText({
19
+ publicationTime: params.publicationTime,
20
+ sectionName: params.sectionName
21
+ })
22
+ }}
23
+ {% elif params.variant === "podcast" %}
24
+ {{ Icon({ icon: 'play_arrow-filled' }) | safe }}
25
+ <div>
26
+ <span class="{{ componentClassName + '__title' }}">Lyssna på avsnittet</span>
27
+ {{
28
+ InformationText({
29
+ duration: params.duration,
30
+ publicationTime: params.publicationTime
31
+ })
32
+ }}
33
+ </div>
34
+ {% endif %}
35
+ </div>
36
+ {% endmacro %}
37
+
38
+ {% macro InformationText(params) %}
39
+ <div class="ds-teaser-footer__notes">
40
+ {% set notes = [params.duration, params.publicationTime, params.sectionName] %}
41
+ {% for note in notes %}
42
+ {% if note %}
43
+ {{ note }}{{ " • " if notes[loop.index0 + 1] }}
44
+ {% endif %}
45
+ {% endfor %}
46
+ </div>
47
+ {% endmacro %}
@@ -0,0 +1,43 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+
3
+ .ds-teaser-footer--informationText {
4
+ margin-top: ds-spacing($ds-s-050);
5
+ }
6
+
7
+ .ds-teaser__text + .ds-teaser-footer--informationText {
8
+ margin-top: ds-spacing($ds-s-075);
9
+ }
10
+
11
+ .ds-teaser-footer__notes {
12
+ @include ds-typography($ds-typography-functional-meta02regular);
13
+ display: block;
14
+ color: $ds-color-text-primary-02;
15
+ }
16
+
17
+ .ds-teaser-footer--podcast {
18
+ display: flex;
19
+ flex-wrap: wrap;
20
+ align-items: center;
21
+ margin-top: ds-spacing($ds-s-050);
22
+
23
+ .ds-teaser-footer__title {
24
+ @include ds-typography($ds-typography-functional-body01semibold);
25
+ color: $ds-color-text-primary;
26
+ }
27
+
28
+ .ds-teaser-footer__notes {
29
+ margin: 0;
30
+ }
31
+
32
+ .ds-icon {
33
+ height: ds-px-to-rem(24px);
34
+ width: ds-px-to-rem(24px);
35
+ margin-right: ds-spacing($ds-s-075);
36
+ background-color: $ds-color-component-primary;
37
+ border-radius: 50%;
38
+
39
+ > svg {
40
+ fill: $ds-color-icon-secondary;
41
+ }
42
+ }
43
+ }
@@ -12,7 +12,7 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |title | String | yes | | | Heading of the teaser |
14
14
  |targetLink | String | yes | | | Target URL for the teaser |
15
- |variant | String | no | "default" or "podd" | "default" | |
15
+ |variant | String | no | "default" or "podcast" | "default" | |
16
16
  |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
17
  |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
18
18
  |text | String | no | | | Teaser subtext |
@@ -28,6 +28,7 @@
28
28
  |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
29
29
  |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
30
30
  |publicationTime | string | no | | null | Publication time text. |
31
+ |duration | string | no | | null | Duration of podcast. |
31
32
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
32
33
  |classNames | String | no | | | Ex. "my-special-class" |
33
34
  |~forcePx~ | | | | | Not supported |
@@ -1,6 +1,8 @@
1
1
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
2
2
  {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
3
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
+ {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
5
+ {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
4
6
  {% from '@bonniernews/dn-design-system-web/foundations/icons/grade-icon.njk' import GetGrade %}
5
7
 
6
8
  {% macro TeaserLarge(params) %}
@@ -47,7 +49,12 @@
47
49
  <div class="{{ componentClassName + '__content'}}">
48
50
  <div class="ds-teaser__content-inner">
49
51
  {% if params.vignette %}
50
- <div class="ds-teaser__vignette">{{ params.vignette }}</div>
52
+ <div class="ds-teaser__vignette">
53
+ {% if params.variant === "podcast" %}
54
+ {{ IconUse({ icon: "headphones" }) }}
55
+ {% endif %}
56
+ {{ params.vignette }}
57
+ </div>
51
58
  {% endif %}
52
59
  <h2 class="ds-teaser__title">
53
60
  {% if params.highlight %}
@@ -68,8 +75,17 @@
68
75
  {{ params.text }}
69
76
  </p>
70
77
  {% endif %}
71
- {% if params.publicationTime %}
72
- <span class="ds-teaser__publication-time">{{ params.publicationTime }}</span>
78
+ {% if params.variant === "podcast" %}
79
+ {{ TeaserFooter({
80
+ variant: 'podcast',
81
+ publicationTime: params.publicationTime,
82
+ duration: params.duration
83
+ }) }}
84
+ {% elif params.publicationTime %}
85
+ {{ TeaserFooter({
86
+ variant: 'informationText',
87
+ publicationTime: params.publicationTime
88
+ }) }}
73
89
  {% endif %}
74
90
  </div>
75
91
 
@@ -3,6 +3,7 @@
3
3
  {% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
4
4
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
5
5
  {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
6
+ {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
6
7
 
7
8
  {% macro TeaserListVertical(params) %}
8
9
  {% set componentClassName = "ds-teaser-list-vertical" %}
@@ -65,14 +66,11 @@
65
66
  {% endif %}
66
67
  {{- teaser.title }}</h3>
67
68
  {% if teaser.publicationTime or teaser.sectionName %}
68
- <div class="ds-teaser-list-vertical__item-notes">
69
- {% if teaser.publicationTime %}
70
- <span>{{ teaser.publicationTime }}</span>
71
- {% endif %}
72
- {% if teaser.sectionName %}
73
- {{ " • " if teaser.publicationTime }}<span>{{ teaser.sectionName }}</span>
74
- {% endif %}
75
- </div>
69
+ {{ TeaserFooter({
70
+ variant: 'informationText',
71
+ publicationTime: teaser.publicationTime,
72
+ sectionName: teaser.sectionName
73
+ }) }}
76
74
  {% endif %}
77
75
  </div>
78
76
 
@@ -57,8 +57,7 @@ $ds-teaser-list-vertical-media-icon-size: 20px;
57
57
  }
58
58
 
59
59
  .ds-teaser-list-vertical__item-text,
60
- .ds-teaser-list-vertical__item-title,
61
- .ds-teaser-list-vertical__item-notes {
60
+ .ds-teaser-list-vertical__item-title {
62
61
  margin: 0;
63
62
  }
64
63
 
@@ -83,9 +82,7 @@ $ds-teaser-list-vertical-media-icon-size: 20px;
83
82
  @include ds-typography($ds-typography-expressive-heading01italicregular);
84
83
  }
85
84
 
86
- .ds-teaser-list-vertical__item-notes {
87
- @include ds-typography($ds-typography-functional-meta02regular);
88
- color: $ds-color-text-primary-02;
85
+ .ds-teaser-footer {
89
86
  margin-top: ds-spacing($ds-s-050, rem);
90
87
  }
91
88
 
@@ -12,7 +12,7 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |title | String | yes | | | Heading of the teaser |
14
14
  |targetLink | String | yes | | | Target URL for the teaser |
15
- |~variant~ | String | no | "default" or "podd" | "default" | Not implemented |
15
+ |~variant~ | String | no | "default" or "podcast" | "default" | Not implemented |
16
16
  |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
17
  |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
18
18
  |text | String | no | | | Teaser subtext |
@@ -23,6 +23,8 @@
23
23
  |mediaHtml | HTML String | no | | | Main image or other media |
24
24
  |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
25
25
  |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
26
+ |publicationTime | string | no | | null | Publication time text. |
27
+ |duration | string | no | | null | Duration of podcast. |
26
28
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
27
29
  |classNames | String | no | | | Ex. "my-special-class" |
28
30
  |~forcePx~ | | | | | Not supported |
@@ -2,6 +2,8 @@
2
2
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
3
3
  {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
4
4
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
5
+ {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
6
+ {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
5
7
  {% from '@bonniernews/dn-design-system-web/foundations/icons/grade-icon.njk' import GetGrade %}
6
8
 
7
9
  {% macro TeaserSplit(params) %}
@@ -34,7 +36,12 @@
34
36
 
35
37
  <div class="{{ componentClassName + '__content'}}">
36
38
  {% if params.vignette %}
37
- <div class="ds-teaser__vignette">{{ params.vignette }}</div>
39
+ <div class="ds-teaser__vignette">
40
+ {% if params.variant === "podcast" %}
41
+ {{ IconUse({ icon: "headphones" }) }}
42
+ {% endif %}
43
+ {{ params.vignette }}
44
+ </div>
38
45
  {% endif %}
39
46
 
40
47
  <h2 class="{{ componentClassName + '__title' }}">
@@ -55,6 +62,14 @@
55
62
  {% endif %}
56
63
  {{ params.text }}
57
64
  </p>
65
+
66
+ {% if params.variant === "podcast" %}
67
+ {{ TeaserFooter({
68
+ variant: "podcast",
69
+ publicationTime: params.publicationTime,
70
+ duration: params.duration
71
+ }) }}
72
+ {% endif %}
58
73
  {% endif %}
59
74
  </div>
60
75
  {% endcall %}
@@ -12,7 +12,7 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |title | String | yes | | | Heading of the teaser |
14
14
  |targetLink | String | yes | | | Target URL for the teaser |
15
- |variant | String | no | "default" or "podd" | "default" | |
15
+ |variant | String | no | "default" or "podcast" | "default" | |
16
16
  |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
17
  |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
18
18
  |text | String | no | | | Teaser subtext |
@@ -26,6 +26,7 @@
26
26
  |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
27
27
  |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
28
28
  |publicationTime | string | no | | null | Publication time text. |
29
+ |duration | string | no | | null | Duration of podcast. |
29
30
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
30
31
  |classNames | String | no | | | Ex. "my-special-class" |
31
32
  |~forcePx~ | | | | | Not supported |
@@ -1,6 +1,8 @@
1
1
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
2
2
  {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
3
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
+ {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
5
+ {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
4
6
  {% from '@bonniernews/dn-design-system-web/foundations/icons/grade-icon.njk' import GetGrade %}
5
7
 
6
8
  {% macro TeaserStandard(params) %}
@@ -43,7 +45,12 @@
43
45
  {% endif %}
44
46
 
45
47
  {% if params.vignette %}
46
- <div class="ds-teaser__vignette">{{ params.vignette }}</div>
48
+ <div class="ds-teaser__vignette">
49
+ {% if params.variant === "podcast" %}
50
+ {{ IconUse({ icon: "headphones" }) }}
51
+ {% endif %}
52
+ {{ params.vignette }}
53
+ </div>
47
54
  {% endif %}
48
55
 
49
56
  <h2 class="{{ componentClassName + '__title'}} {{ componentClassName + '__title--italic' if params.isItalicHeadline}}">
@@ -57,7 +64,7 @@
57
64
  {% set gradeHtml = GetGrade({ grade: params.grade, type: "single" }) | trim if params.grade else "" %}
58
65
  <p class="{{ componentClassName + '__text' }} {{ componentClassName + '__text--with-grade' if gradeHtml.length }}">
59
66
  {{ gradeHtml if gradeHtml.length else TeaserDot({ flashing: params.isFlashingDot }) }}
60
-
67
+
61
68
  {% if params.sticker %}
62
69
  <span class="ds-teaser__sticker">
63
70
  {{ params.sticker }}
@@ -66,8 +73,19 @@
66
73
  {{ params.text }}
67
74
  </p>
68
75
  {% endif %}
69
- {% if params.publicationTime %}
70
- <span class="ds-teaser__publication-time">{{ params.publicationTime }}</span>
76
+ {% if params.variant === "podcast" %}
77
+ {{ TeaserFooter({
78
+ variant: "podcast",
79
+ publicationTime: params.publicationTime,
80
+ duration: params.duration
81
+ })}}
82
+ {% elif params.publicationTime %}
83
+ {{
84
+ TeaserFooter({
85
+ variant: "informationText",
86
+ publicationTime: params.publicationTime
87
+ })
88
+ }}
71
89
  {% endif %}
72
90
  </div>
73
91
  {% endcall %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "11.2.1",
3
+ "version": "11.3.0",
4
4
  "description": "DN design system for web.",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",