@bonniernews/dn-design-system-web 5.0.2 → 5.1.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
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 5.1.0 (2023-09-27)
7
+
8
+
9
+ ### Features
10
+
11
+ * **web:** media variant of vertical list ([#1014](https://github.com/BonnierNews/dn-design-system/issues/1014)) ([34e72fa](https://github.com/BonnierNews/dn-design-system/commit/34e72fa41664fa754d2bf6f71ea9415643033a39))
12
+
13
+
14
+
15
+ ## 5.0.3 (2023-09-27)
16
+
17
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
18
+
19
+
20
+
21
+
22
+
6
23
  ## 5.0.2 (2023-09-26)
7
24
 
8
25
  **Note:** Version bump only for package @bonniernews/dn-design-system-web
@@ -12,10 +12,11 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |listTitle | String | yes | | | List title |
14
14
  |listLink | Object | no | | | Ex. { text: "Alla nyheter", url: "#" } |
15
+ |listType | String | no | default, media | (empty) | |
15
16
  |flexible | bool | no | true, false | false | |
16
17
  |teasers | Array | yes | | | Array with teaser objects. Ex. [ { title: 'Malmö var det enda rimliga valet för Eurovision', targetLink: '#', highlight: 'Hanna Fahl:', publicationTime: 'I GÅR 12:28', sectionName: 'Kultur', attributes: { "data-test": "list-item-test-data" } } ] |
17
18
  |~areaType~ | String | no | "right" or "bauta" or "bautaxl" | | Not implemented |
18
- |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to _all_ teasers in the list |
19
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to _all_ teasers in the list. |
19
20
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
20
21
  |classNames | String | no | | | Ex. "my-special-class" |
21
22
  |~forcePx~ | | | | | Not supported |
@@ -36,6 +37,14 @@ These are copy paste friendly examples to quickliy get started using a component
36
37
  theme: "ekonomi",
37
38
  teasers: [ { title: 'Malmö var det enda rimliga valet för Eurovision', targetLink: '#', highlight: 'Hanna Fahl:', publicationTime: 'I GÅR 12:28', sectionName: 'Kultur', attributes: { "data-test": "list-item-test-data" } } ]
38
39
  })}}
40
+
41
+ {# listType == media #}
42
+ {{ TeaserListVertical({
43
+ listTitle: "Senaste klippen",
44
+ listType: "media",
45
+ mediaIcon: "play_arrow-filled",
46
+ teasers: [ { title: 'Svenska hjältehunden Killian arbetar mot klockan i Marocko – är det försent?', targetLink: '#', publicationTime: 'I går 21:22', mediaHtml: '<div class="picture"><img class="picture__img" src="??"></div>', video: 'true', attributes: { "data-test": "list-item-test-data" } } ]
47
+ })}}
39
48
  ```
40
49
 
41
50
  ### SCSS
@@ -2,18 +2,21 @@
2
2
  {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
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
+ {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
5
6
 
6
7
  {% macro TeaserListVertical(params) %}
7
8
  {% set componentClassName = "ds-teaser-list-vertical" %}
8
9
  {% set classNamePrefix = componentClassName + "--" %}
9
10
  {% set attributes = getAttributes(params.attributes) %}
10
11
  {% set showButton = params.listLink and params.listLink.text and params.listLink.url %}
12
+ {% set isMediaList = params.listType === 'media' %}
11
13
 
12
14
  {%- set classes = [
13
15
  componentClassName,
14
- "ds-theme--" + params.theme,
16
+ "ds-theme--" + params.theme if params.theme,
15
17
  classNamePrefix + "flexible" if params.flexible,
16
18
  classNamePrefix + "linked" if showButton,
19
+ classNamePrefix + "media" if isMediaList,
17
20
  params.classNames if params.classNames
18
21
  ] | join(" ") %}
19
22
 
@@ -25,7 +28,11 @@
25
28
 
26
29
  <div class="{{ componentClassName + '__content'}}">
27
30
  {% for teaser in params.teasers %}
28
- {{ TeaserListVerticalItem(teaser) }}
31
+ {% if isMediaList %}
32
+ {{ TeaserListVerticalMediaItem(teaser) }}
33
+ {% else %}
34
+ {{ TeaserListVerticalItem(teaser) }}
35
+ {% endif %}
29
36
  {% endfor %}
30
37
  </div>
31
38
  {% if showButton %}
@@ -60,3 +67,31 @@
60
67
  {% endif %}
61
68
  </a>
62
69
  {% endmacro %}
70
+
71
+ {% macro TeaserListVerticalMediaItem(teaser) %}
72
+ {% set attributes = getAttributes(teaser.attributes) %}
73
+ {%- set classes = [
74
+ "ds-teaser-list-vertical__media-item",
75
+ teaser.classNames if teaser.classNames
76
+ ] | join(" ") %}
77
+
78
+ <a href="{{teaser.targetLink}}" class="{{ classes }}" {{- attributes | safe }}>
79
+ <div class="ds-teaser-list-vertical__media-item-text">
80
+ <h3 class="ds-teaser-list-vertical__media-item-title">{{ teaser.highlight }} {{ teaser.title }}</h3>
81
+ {% if teaser.publicationTime or teaser.sectionName %}
82
+ <div class="ds-teaser-list-vertical__media-item-notes">
83
+ <span>{{ teaser.publicationTime }}</span>
84
+ </div>
85
+ {% endif %}
86
+ </div>
87
+
88
+ {% if teaser.mediaHtml %}
89
+ <div class="ds-teaser-list-vertical__media-item-img">
90
+ {{ teaser.mediaHtml | safe }}
91
+ {% if teaser.video %}
92
+ {{ IconUse({ icon: 'play_arrow-filled' }) -}}
93
+ {% endif %}
94
+ </div>
95
+ {% endif %}
96
+ </a>
97
+ {% endmacro %}
@@ -4,10 +4,22 @@
4
4
  @use "../../components/teaser-dot/teaser-dot.scss";
5
5
 
6
6
  $ds-dot-size: ds-px-to-rem(10px);
7
+ $ds-teaser-list-vertical-media-icon-size: 20px;
7
8
 
8
9
  .ds-teaser-list-vertical {
9
10
  background-color: $ds-color-surface-background;
10
11
 
12
+ &.ds-teaser-list-vertical--flexible {
13
+ display: flex;
14
+ flex: 1 0 300px;
15
+ flex-direction: column;
16
+ overflow: hidden;
17
+
18
+ .ds-teaser-list-vertical__content {
19
+ overflow-y: auto;
20
+ }
21
+ }
22
+
11
23
  .ds-teaser-list-vertical__link {
12
24
  position: relative;
13
25
  padding: ds-spacing-component($ds-sc-x4, rem);
@@ -52,10 +64,6 @@ $ds-dot-size: ds-px-to-rem(10px);
52
64
  @include ds-typography($ds-typography-expressive-heading01bold);
53
65
  color: $ds-color-text-primary;
54
66
  word-break: break-word;
55
-
56
- @include ds-hover(true) {
57
- @include ds-underline(2px, 1px);
58
- }
59
67
  }
60
68
 
61
69
  .ds-teaser-list-vertical__item-notes {
@@ -63,16 +71,71 @@ $ds-dot-size: ds-px-to-rem(10px);
63
71
  color: $ds-color-text-primary-02;
64
72
  margin-top: ds-spacing-component($ds-sc-x2, rem);
65
73
  }
74
+
75
+ @include ds-hover() {
76
+ &:hover .ds-teaser-list-vertical__item-title {
77
+ @include ds-underline(2px, 1px);
78
+ }
79
+ }
66
80
  }
67
81
 
68
- &.ds-teaser-list-vertical--flexible {
82
+ .ds-teaser-list-vertical__media-item {
83
+ padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4, rem);
69
84
  display: flex;
70
- flex: 1 0 300px;
71
- flex-direction: column;
72
- overflow: hidden;
85
+ justify-content: space-between;
86
+ text-decoration: none;
87
+ position: relative;
73
88
 
74
- .ds-teaser-list-vertical__content {
75
- overflow-y: auto;
89
+ &:not(:last-child)::after {
90
+ content: "";
91
+ position: absolute;
92
+ bottom: 0;
93
+ height: ds-metrics-border-width(x1);
94
+ width: calc(100% - ds-spacing-component($ds-sc-x8));
95
+ background-color: $ds-color-border-primary;
96
+ }
97
+
98
+ .ds-teaser-list-vertical__media-item-text,
99
+ .ds-teaser-list-vertical__media-item-title,
100
+ .ds-teaser-list-vertical__media-item-notes {
101
+ margin: 0;
102
+ }
103
+
104
+ .ds-teaser-list-vertical__media-item-title {
105
+ @include ds-typography($ds-typography-expressive-heading01bold);
106
+ color: $ds-color-text-primary;
107
+ word-break: break-word;
108
+ }
109
+
110
+ .ds-teaser-list-vertical__media-item-notes {
111
+ @include ds-typography($ds-typography-functional-meta02regular);
112
+ color: $ds-color-text-primary-02;
113
+ margin-top: ds-spacing-component($ds-sc-x2, rem);
114
+ }
115
+
116
+ .ds-teaser-list-vertical__media-item-img {
117
+ flex: 0 0 91px;
118
+ align-self: flex-start;
119
+ position: relative;
120
+ margin-left: ds-spacing-component($ds-sc-x4);
121
+
122
+ .ds-icon {
123
+ width: $ds-teaser-list-vertical-media-icon-size;
124
+ height: $ds-teaser-list-vertical-media-icon-size;
125
+ background: $ds-color-static-red-500;
126
+ color: $ds-color-static-white;
127
+ position: absolute;
128
+ z-index: 1;
129
+ bottom: 0;
130
+ left: 0;
131
+ font-size: 0;
132
+ }
133
+ }
134
+
135
+ @include ds-hover() {
136
+ &:hover .ds-teaser-list-vertical__media-item-title {
137
+ @include ds-underline(2px, 1px);
138
+ }
76
139
  }
77
140
  }
78
141
  }
@@ -12,5 +12,6 @@ $spacingLayout: (
12
12
  teaser-vertical-small: 8,
13
13
  teaser-horizontal: 16,
14
14
  gap-vertical-xsmall: 4,
15
- teaser-vertical-medium: 12
15
+ teaser-vertical-medium: 12,
16
+ direkt-header-bottom: 48
16
17
  );
@@ -9,6 +9,7 @@ $spacingLayoutLargeScreen: (
9
9
  teaser-horizontal: 16,
10
10
  gap-vertical-xsmall: 8,
11
11
  teaser-vertical-medium: 16,
12
+ direkt-header-bottom: 64,
12
13
  gap-vertical-static-medium: 16,
13
14
  gap-vertical-static-large: 32,
14
15
  gap-horizontal-static-small: 8,
@@ -12,3 +12,4 @@ $ds-sl-teaser-vertical-small: teaser-vertical-small;
12
12
  $ds-sl-teaser-horizontal: teaser-horizontal;
13
13
  $ds-sl-gap-vertical-xsmall: gap-vertical-xsmall;
14
14
  $ds-sl-teaser-vertical-medium: teaser-vertical-medium;
15
+ $ds-sl-direkt-header-bottom: direkt-header-bottom;
@@ -91,3 +91,4 @@ $ds-typography-detailarticle-quote: 'detailarticle-quote';
91
91
  $ds-typography-detailmellanrubrik: 'detailmellanrubrik';
92
92
  $ds-typography-detailarticle-direkt: 'detailarticle-direkt';
93
93
  $ds-typography-detailarticle-direkt-opinion: 'detailarticle-direkt-opinion';
94
+ $ds-typography-detaildirekt-header: 'detaildirekt-header';
@@ -233,6 +233,12 @@ $typographyTokensScreenExtraLarge: (
233
233
  fontSize: 32,
234
234
  fontStyle: italic
235
235
  ),
236
+ detaildirekt-header: (
237
+ fontFamily: "DN Serif Display",
238
+ fontWeight: Regular,
239
+ lineHeight: 52,
240
+ fontSize: 48
241
+ ),
236
242
  detaildropcap: (
237
243
  fontFamily: "DN Serif Display",
238
244
  fontWeight: Bold,
@@ -458,6 +458,12 @@ $typographyTokensScreenLarge: (
458
458
  fontSize: 26,
459
459
  fontStyle: italic
460
460
  ),
461
+ detaildirekt-header: (
462
+ fontFamily: "DN Serif Display",
463
+ fontWeight: Regular,
464
+ lineHeight: 52,
465
+ fontSize: 48
466
+ ),
461
467
  detailstandard-button: (
462
468
  fontFamily: "DN Sans",
463
469
  fontWeight: SemiBold,
@@ -597,5 +597,11 @@ $typographyTokensScreenSmall: (
597
597
  lineHeight: 24,
598
598
  fontSize: 20,
599
599
  fontStyle: italic
600
+ ),
601
+ detaildirekt-header: (
602
+ fontFamily: "DN Serif Display",
603
+ fontWeight: Regular,
604
+ fontSize: 32,
605
+ lineHeight: 36
600
606
  )
601
607
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "5.0.2",
3
+ "version": "5.1.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",
@@ -12,5 +12,6 @@
12
12
  "teaser-vertical-small": "teaser-vertical-small",
13
13
  "teaser-horizontal": "teaser-horizontal",
14
14
  "gap-vertical-xsmall": "gap-vertical-xsmall",
15
- "teaser-vertical-medium": "teaser-vertical-medium"
15
+ "teaser-vertical-medium": "teaser-vertical-medium",
16
+ "direkt-header-bottom": "direkt-header-bottom"
16
17
  }
@@ -91,5 +91,6 @@
91
91
  "detailarticle-quote": "'detailarticle-quote'",
92
92
  "detailmellanrubrik": "'detailmellanrubrik'",
93
93
  "detailarticle-direkt": "'detailarticle-direkt'",
94
- "detailarticle-direkt-opinion": "'detailarticle-direkt-opinion'"
94
+ "detailarticle-direkt-opinion": "'detailarticle-direkt-opinion'",
95
+ "detaildirekt-header": "'detaildirekt-header'"
95
96
  }