@bonniernews/dn-design-system-web 5.0.3 → 6.0.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 +22 -0
- package/components/group-header/group-header.scss +1 -1
- package/components/teaser-list-swipe/README.md +4 -1
- package/components/teaser-list-swipe/teaser-list-swipe.njk +13 -8
- package/components/teaser-list-swipe/teaser-list-swipe.scss +4 -4
- package/components/teaser-list-vertical/README.md +10 -1
- package/components/teaser-list-vertical/teaser-list-vertical.njk +37 -2
- package/components/teaser-list-vertical/teaser-list-vertical.scss +73 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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
|
+
## 6.0.0 (2023-09-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **web:** change TeaserListSwipe to use variant instead of scrollType (#1015)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **web:** change TeaserListSwipe to use variant instead of scrollType ([#1015](https://github.com/BonnierNews/dn-design-system/issues/1015)) ([b0a4400](https://github.com/BonnierNews/dn-design-system/commit/b0a440032a2ba65f89946c1f005b442b6d0479c0))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 5.1.0 (2023-09-27)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **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))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## 5.0.3 (2023-09-27)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|title | String | yes | | | Heading of the teaser |
|
|
14
14
|
|titleHref | String | no | | | Target URL for the header |
|
|
15
15
|
|areaType | String | no | "main", "right", "bauta", "bautaxl" | | The area where the column is rendered |
|
|
16
|
-
|
|
|
16
|
+
|arrowPosition | String | no | "floating", "header" | "floating" | Determines where the scroll arrows are rendered |
|
|
17
17
|
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
18
18
|
|teasers | Object | yes | | | A list of arguments to TeaserSwipeCard |
|
|
19
19
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
@@ -40,3 +40,6 @@ These are copy paste friendly examples to quickly get started using a component.
|
|
|
40
40
|
```scss
|
|
41
41
|
@use "@bonniernews/dn-design-system-web/components/teaser-list-swipe/teaser-list-swipe";
|
|
42
42
|
```
|
|
43
|
+
|
|
44
|
+
### JS
|
|
45
|
+
This component does not come with any JS to facilitate scrolling via the buttons. Implementing that is left as an exercise to the reader.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
|
|
2
3
|
{% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
|
|
3
4
|
{% from '@bonniernews/dn-design-system-web/components/group-header/group-header.njk' import GroupHeader %}
|
|
4
5
|
{% from '@bonniernews/dn-design-system-web/components/teaser-swipe-card/teaser-swipe-card.njk' import TeaserSwipeCard %}
|
|
@@ -6,19 +7,23 @@
|
|
|
6
7
|
{% macro TeaserListSwipe(params) %}
|
|
7
8
|
{% set componentClassName = "ds-teaser" %}
|
|
8
9
|
{% set classNamePrefix = componentClassName + "--" %}
|
|
9
|
-
{% set
|
|
10
|
+
{% set arrowPosition = params.arrowPosition or 'floating' %}
|
|
10
11
|
{%- set classes = [
|
|
11
|
-
componentClassName,
|
|
12
12
|
"ds-teaser--list-swipe",
|
|
13
|
-
"ds-theme--" + params.theme if params.theme,
|
|
14
|
-
classNamePrefix + params.areaType if params.areaType,
|
|
15
13
|
params.classNames if params.classNames
|
|
16
14
|
] | join(" ") %}
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
{%- call TeaserCard({
|
|
17
|
+
areaType: params.areaType,
|
|
18
|
+
theme: params.theme,
|
|
19
|
+
attributes: params.attributes,
|
|
20
|
+
classNames: classes
|
|
21
|
+
}) %}
|
|
18
22
|
{{ GroupHeader({
|
|
19
23
|
title: params.title,
|
|
20
24
|
href: params.titleHref,
|
|
21
|
-
variant: 'arrows' if
|
|
25
|
+
variant: 'arrows' if arrowPosition === 'header' else 'link',
|
|
26
|
+
linkText: 'Visa alla' if arrowPosition === 'floating'
|
|
22
27
|
}) }}
|
|
23
28
|
<div class="{{ componentClassName + '__carousel'}}">
|
|
24
29
|
{% for teaser in params.teasers %}
|
|
@@ -26,7 +31,7 @@
|
|
|
26
31
|
{% endfor %}
|
|
27
32
|
</div>
|
|
28
33
|
|
|
29
|
-
{% if
|
|
34
|
+
{% if arrowPosition === 'floating' %}
|
|
30
35
|
{{ IconButton({
|
|
31
36
|
iconName: 'arrow_back',
|
|
32
37
|
variant: 'elevated',
|
|
@@ -44,5 +49,5 @@
|
|
|
44
49
|
forcePx: true
|
|
45
50
|
}) }}
|
|
46
51
|
{% endif %}
|
|
47
|
-
|
|
52
|
+
{% endcall %}
|
|
48
53
|
{% endmacro %}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
@include ds-teaser-focus(2px);
|
|
12
12
|
|
|
13
13
|
.ds-teaser__carousel {
|
|
14
|
-
|
|
14
|
+
margin: ds-spacing-component(0 $ds-sc-x4);
|
|
15
15
|
padding-bottom: ds-spacing-component($ds-sc-x3);
|
|
16
16
|
overflow-x: scroll;
|
|
17
17
|
display: grid;
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
position: absolute;
|
|
28
28
|
top: 50%;
|
|
29
29
|
transform: translateY(-50%);
|
|
30
|
-
z-index:
|
|
30
|
+
z-index: 2;
|
|
31
31
|
|
|
32
32
|
&--back {
|
|
33
|
-
left:
|
|
33
|
+
left: 0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&--forward {
|
|
37
|
-
right:
|
|
37
|
+
right: 0;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
82
|
+
.ds-teaser-list-vertical__media-item {
|
|
83
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4, rem);
|
|
69
84
|
display: flex;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
position: relative;
|
|
73
88
|
|
|
74
|
-
|
|
75
|
-
|
|
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
|
}
|
package/package.json
CHANGED