@bonniernews/dn-design-system-web 31.1.0 → 31.2.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 +49 -0
- package/components/byline/README.md +15 -28
- package/components/byline/byline-interaction.js +14 -0
- package/components/byline/byline.njk +106 -33
- package/components/byline/byline.scss +120 -1
- package/components/byline-list-item/README-UXD.md +0 -0
- package/components/byline-list-item/README.md +68 -0
- package/components/byline-list-item/byline-list-item.njk +36 -0
- package/components/byline-list-item/byline-list-item.scss +1 -0
- package/components/list-item/list-item.scss +5 -1
- package/components/modal/modal.scss +2 -0
- package/components/teaser-text-on-image/teaser-text-on-image.scss +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,55 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [31.2.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.1.3...@bonniernews/dn-design-system-web@31.2.0) (2025-03-26)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **web:** byline redesign ([#1665](https://github.com/BonnierNews/dn-design-system/issues/1665)) ([a0151d5](https://github.com/BonnierNews/dn-design-system/commit/a0151d5487884219bcb7cc34f3bb0d285bcbe70b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Maintenance
|
|
16
|
+
|
|
17
|
+
* **deps-dev:** bump @babel/runtime from 7.26.9 to 7.26.10 ([#1658](https://github.com/BonnierNews/dn-design-system/issues/1658)) ([ddc2a6a](https://github.com/BonnierNews/dn-design-system/commit/ddc2a6ab0fa1603fe3728eb3d52e2125ac84c386))
|
|
18
|
+
* **deps-dev:** bump axios from 1.7.9 to 1.8.3 ([#1662](https://github.com/BonnierNews/dn-design-system/issues/1662)) ([3973c15](https://github.com/BonnierNews/dn-design-system/commit/3973c15536a52a70d629a30c7b41e27f5c672b75))
|
|
19
|
+
* **deps-dev:** bump shelljs from 0.8.5 to 0.9.2 ([#1664](https://github.com/BonnierNews/dn-design-system/issues/1664)) ([c9c7d3f](https://github.com/BonnierNews/dn-design-system/commit/c9c7d3fccb8becc4e42b61ff16000a4a8115b009))
|
|
20
|
+
* **deps-dev:** bump style-dictionary from 4.3.2 to 4.3.3 ([#1644](https://github.com/BonnierNews/dn-design-system/issues/1644)) ([d1e8c22](https://github.com/BonnierNews/dn-design-system/commit/d1e8c22df91652382f5e7d994eb3a371e886bffa))
|
|
21
|
+
* **deps:** bump @babel/helpers from 7.26.9 to 7.26.10 ([#1659](https://github.com/BonnierNews/dn-design-system/issues/1659)) ([c26c060](https://github.com/BonnierNews/dn-design-system/commit/c26c060896f7de866302dde2355d249e79e3e2c8))
|
|
22
|
+
* **foundations:** update variables action ([#1669](https://github.com/BonnierNews/dn-design-system/issues/1669)) ([173c902](https://github.com/BonnierNews/dn-design-system/commit/173c9024860ad82ed2f47e6d5ef844b0f7dc174e))
|
|
23
|
+
* **web:** fix failing gh actions ([#1671](https://github.com/BonnierNews/dn-design-system/issues/1671)) ([4c66ae1](https://github.com/BonnierNews/dn-design-system/commit/4c66ae1897d279483d74b5a69cce91cdd63663fc))
|
|
24
|
+
|
|
25
|
+
## [31.1.3](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.1.2...@bonniernews/dn-design-system-web@31.1.3) (2025-03-18)
|
|
26
|
+
|
|
27
|
+
## [31.1.2](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.1.0...@bonniernews/dn-design-system-web@31.1.2) (2025-03-18)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **web:** make room for photo credit on teasers with text on image ([#1666](https://github.com/BonnierNews/dn-design-system/issues/1666)) ([6e204fa](https://github.com/BonnierNews/dn-design-system/commit/6e204fa2f1fc0a53fc21a29bb006b56ae291ab60))
|
|
33
|
+
* **web:** set exit with status 1 if failed to generate documentation ([#1668](https://github.com/BonnierNews/dn-design-system/issues/1668)) ([36c8d4a](https://github.com/BonnierNews/dn-design-system/commit/36c8d4afac9ac9b7e9adbd30c115a18a2dce6ebd))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Maintenance
|
|
37
|
+
|
|
38
|
+
* remove vs code settings ([#1646](https://github.com/BonnierNews/dn-design-system/issues/1646)) ([bcf9f02](https://github.com/BonnierNews/dn-design-system/commit/bcf9f022b47cb018e2ac0a39e75104ab489df76a))
|
|
39
|
+
* replace tj-actions ([#1663](https://github.com/BonnierNews/dn-design-system/issues/1663)) ([5122022](https://github.com/BonnierNews/dn-design-system/commit/5122022570c2547588cd3967d5aba3dba18f613a))
|
|
40
|
+
* **web:** released version v31.1.1 ([5f3670c](https://github.com/BonnierNews/dn-design-system/commit/5f3670c1ca51740145b472f5c5f06b6516c4b32d))
|
|
41
|
+
|
|
42
|
+
## [31.1.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.1.0...@bonniernews/dn-design-system-web@31.1.1) (2025-03-18)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* **web:** make room for photo credit on teasers with text on image ([#1666](https://github.com/BonnierNews/dn-design-system/issues/1666)) ([6e204fa](https://github.com/BonnierNews/dn-design-system/commit/6e204fa2f1fc0a53fc21a29bb006b56ae291ab60))
|
|
48
|
+
* **web:** set exit with status 1 if failed to generate documentation ([#1668](https://github.com/BonnierNews/dn-design-system/issues/1668)) ([36c8d4a](https://github.com/BonnierNews/dn-design-system/commit/36c8d4afac9ac9b7e9adbd30c115a18a2dce6ebd))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Maintenance
|
|
52
|
+
|
|
53
|
+
* remove vs code settings ([#1646](https://github.com/BonnierNews/dn-design-system/issues/1646)) ([bcf9f02](https://github.com/BonnierNews/dn-design-system/commit/bcf9f022b47cb018e2ac0a39e75104ab489df76a))
|
|
54
|
+
* replace tj-actions ([#1663](https://github.com/BonnierNews/dn-design-system/issues/1663)) ([5122022](https://github.com/BonnierNews/dn-design-system/commit/5122022570c2547588cd3967d5aba3dba18f613a))
|
|
55
|
+
|
|
7
56
|
## [31.1.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.0.1...@bonniernews/dn-design-system-web@31.1.0) (2025-03-13)
|
|
8
57
|
|
|
9
58
|
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
- GitHub: [BonnierNews/dn-design-system/../web/src/components/byline](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/byline)
|
|
2
2
|
- Storybook: [Byline](https://designsystem.dn.se/?path=/docs/article-byline--docs)
|
|
3
|
-
- Storybook (Latest): [Byline](https://designsystem-latest.dn.se/?path=/docs/article-byline--docs)
|
|
4
3
|
|
|
5
4
|
----
|
|
6
5
|
|
|
7
6
|
# Byline
|
|
8
7
|
|
|
9
|
-
The byline is a list item and should be wrapped in a list.
|
|
10
|
-
|
|
11
|
-
* variant:'follow' can render both a button and a link
|
|
12
|
-
|
|
13
8
|
## Parameters
|
|
14
9
|
|
|
15
10
|
|parameter | type | required | options | default | description |
|
|
16
11
|
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|followed | Boolean | no | true, false | false | If true the toggle button will be in "selected" state. Depends on followable parameter. |
|
|
12
|
+
|largeByline | Boolean | no | true, false | false | Specify if web should render a large byline, used for profile articles |
|
|
13
|
+
|bylineTitle | String | yes | | | The titles of the bylines, supplied by the api |
|
|
14
|
+
|bylines | Array | yes | | | Array of bylines from api |
|
|
15
|
+
|authorImages | Array[HTML] | no | | | Array with html image from bang. The component only makes the image round. Scaling is up to the user. Should be 44px for non retina screens. |
|
|
16
|
+
|hideBylineImages | Boolean | no | true, false | true | Specify if byline images should be renderd or not |
|
|
17
|
+
|renderBylineModal | Boolean | false | true, false | false | Specify if byline sheet should be renderd. Should be true for bottomByline |
|
|
18
|
+
|showNameAsLink | Boolean | false | true, false | false | If true, author names will be renders as link and sheet will not load. Used for desktop |
|
|
25
19
|
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
26
|
-
|elementAttributes | Object | no | | | Sets attributes on actual toggle element and not byline list item. Same structure as attributes above, for accessability reasons it's important to send in "aria-label": "Följ " + byline.name |
|
|
27
|
-
|linkAttributes | Object | no | | | Sets attributes on the link element. |
|
|
28
20
|
|classNames | String | no | | | Ex. "my-special-class" |
|
|
29
|
-
|elementClassNames | String | no | | | Sets classes on actual toggle element and not byline list item. Same structure as classNames above |
|
|
30
|
-
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
31
21
|
|
|
32
22
|
## Minimum requirement example
|
|
33
23
|
|
|
@@ -39,18 +29,15 @@ These are copy paste friendly examples to quickliy get started using a component
|
|
|
39
29
|
{% from '@bonniernews/dn-design-system-web/components/byline/byline.njk' import Byline %}
|
|
40
30
|
|
|
41
31
|
{{ Byline({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
followable: followable,
|
|
32
|
+
largeByline: largeByline,
|
|
33
|
+
bylineTitle: bylineTitle,
|
|
34
|
+
bylines: bylines,
|
|
35
|
+
authorImages: [imageHtml(), imageHtml(), imageHtml()],
|
|
36
|
+
hideBylineImages: hideBylineImages,
|
|
37
|
+
renderBylineModal: renderBylineModal,
|
|
49
38
|
attributes: attributes,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
classNames: "",
|
|
53
|
-
forcePx: false
|
|
39
|
+
classNames: classNames
|
|
40
|
+
variant: variant,
|
|
54
41
|
})}}
|
|
55
42
|
```
|
|
56
43
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { initModal, openModal } from '@bonniernews/dn-design-system-web/components/modal/modal.js'
|
|
2
|
+
|
|
3
|
+
export function initModalByline() {
|
|
4
|
+
const modalEl = document.querySelector(".ds-modal--byline");
|
|
5
|
+
if (!modalEl) return;
|
|
6
|
+
initModal(modalEl);
|
|
7
|
+
|
|
8
|
+
const bylines = document.querySelectorAll(".ds-byline");
|
|
9
|
+
bylines.forEach(byline => {
|
|
10
|
+
byline.addEventListener("click", (e) => {
|
|
11
|
+
openModal(modalEl);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -1,39 +1,112 @@
|
|
|
1
1
|
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
-
{% from '@bonniernews/dn-design-system-web/components/list-item/list-item.njk' import
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/byline-list-item/byline-list-item.njk' import BylineListItem %}
|
|
3
|
+
{% from '@bonniernews/dn-design-system-web/components/modal/modal.njk' import Modal %}
|
|
3
4
|
|
|
4
5
|
{% macro Byline(params) %}
|
|
5
|
-
{% set
|
|
6
|
-
{% set
|
|
7
|
-
{% set
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
{% set componentClassName = "ds-byline" %}
|
|
7
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
8
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
9
|
+
{% set showBylineImages = params.hideBylineImages != true %}
|
|
10
|
+
|
|
11
|
+
{%- set largeByline = params.largeByline == true and params.bylines.length === 1 %}
|
|
12
|
+
{%- set classes = [
|
|
13
|
+
componentClassName,
|
|
14
|
+
componentClassName + "--large" if largeByline,
|
|
15
|
+
componentClassName + "--show-images" if showBylineImages,
|
|
16
|
+
params.classNames if params.classNames
|
|
17
|
+
] | join(" ") %}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<div class="{{ classes }}" {{- attributes | safe }}>
|
|
21
|
+
{% if params.bylines.length === 1%}
|
|
22
|
+
{% set byline = params.bylines[0] %}
|
|
23
|
+
<div class="{{ componentClassName + '__inner'}}">
|
|
24
|
+
<div class="{{ componentClassName + ('__portrait--large' if largeByline else '__portrait') }}">{{ params.authorImages[0] | safe }}</div>
|
|
25
|
+
<div class="{{ componentClassName + '__info'}}">
|
|
26
|
+
<span class="{{ componentClassName + '__role'}}">{{ params.bylineTitle }}</span>
|
|
27
|
+
<a href={{ byline.authorPageUrl }} class="{{ componentClassName + '__name'}}"
|
|
28
|
+
data-link-category="article author"
|
|
29
|
+
data-id="{{ byline.authorId }}"
|
|
30
|
+
data-index="1"
|
|
31
|
+
data-label="{{ byline.name }}">
|
|
32
|
+
{{ byline.name }}
|
|
33
|
+
</a>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
{% else %}
|
|
38
|
+
<div class="{{ componentClassName + '__inner'}} {{ componentClassName + '__inner--multiple'}}">
|
|
39
|
+
{% if showBylineImages %}
|
|
40
|
+
{% for image in params.authorImages %}
|
|
41
|
+
<div class="{{ componentClassName + '__portrait'}}">{{ image | safe }}</div>
|
|
42
|
+
{% endfor %}
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
<div class="{{ componentClassName + '__info'}}">
|
|
46
|
+
<span class="{{ componentClassName + '__role'}}">
|
|
47
|
+
{{ params.bylineTitle }}
|
|
48
|
+
</span>
|
|
49
|
+
{% for byline in params.bylines %}
|
|
50
|
+
{% set isSecondToLast = loop.index == loop.length - 1 %}
|
|
51
|
+
{% set showComma = true if not isSecondToLast and not loop.last%}
|
|
52
|
+
{% if loop.last %}
|
|
53
|
+
<span class="{{ componentClassName + '__and'}}"> och </span>
|
|
54
|
+
{% endif %}
|
|
55
|
+
{% call AuthorName((params.showNameAsLink == true), byline, componentClassName, loop.index, showComma) %}
|
|
56
|
+
{{- byline.name -}}
|
|
57
|
+
{%- if showComma -%}, {%- endif -%}
|
|
58
|
+
{% endcall %}
|
|
59
|
+
{% endfor %}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
{% endif %}
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
{% if params.bylines.length > 1 and params.renderBylineModal and params.showNameAsLink != true %}
|
|
66
|
+
{% call Modal({modalType: "sheet", classNames: "ds-modal--byline"}) %}
|
|
67
|
+
<ul class="ds-byline__list">
|
|
68
|
+
{% for byline in params.bylines %}
|
|
69
|
+
{{ BylineListItem({
|
|
70
|
+
variant: 'follow',
|
|
71
|
+
authorName: byline.name,
|
|
72
|
+
role: byline.role,
|
|
73
|
+
email: byline.email,
|
|
74
|
+
authorPageUrl: byline.authorPageUrl,
|
|
75
|
+
bylineImage: params.authorImages[loop.index0] | safe,
|
|
76
|
+
followable: byline.followable,
|
|
77
|
+
border: false if loop.last else true,
|
|
78
|
+
linkAttributes: {
|
|
79
|
+
"data-link-category": "article author",
|
|
80
|
+
"data-id": byline.authorId,
|
|
81
|
+
"data-index": loop.index,
|
|
82
|
+
"data-label": byline.name
|
|
83
|
+
},
|
|
84
|
+
elementClassNames: "watch--follow",
|
|
85
|
+
elementAttributes: {
|
|
86
|
+
"data-entity-id": byline.authorId,
|
|
87
|
+
"data-author": byline.name,
|
|
88
|
+
"aria-label": "Följ " + byline.name,
|
|
89
|
+
"data-interaction-category": "author"
|
|
90
|
+
}
|
|
91
|
+
}) }}
|
|
92
|
+
{% endfor %}
|
|
93
|
+
</ul>
|
|
94
|
+
{% endcall %}
|
|
15
95
|
{% endif %}
|
|
96
|
+
{% endmacro %}
|
|
16
97
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
border: params.variant !== 'direkt',
|
|
32
|
-
fontWeight: 'semibold',
|
|
33
|
-
elementAttributes: params.elementAttributes,
|
|
34
|
-
elementClassNames: params.elementClassNames,
|
|
35
|
-
forcePx: params.forcePx,
|
|
36
|
-
classNames: classNames,
|
|
37
|
-
attributes: params.attributes
|
|
38
|
-
}) }}
|
|
98
|
+
{% macro AuthorName(renderLink, byline, componentClassName, index, showComma) %}
|
|
99
|
+
{% if renderLink %}
|
|
100
|
+
<a href={{ byline.authorPageUrl }} class="{{ componentClassName + '__name'}}"
|
|
101
|
+
data-link-category="article author"
|
|
102
|
+
data-id="{{byline.authorId}}"
|
|
103
|
+
data-index="{{index}}"
|
|
104
|
+
data-label="{{byline.name}}">
|
|
105
|
+
{{- caller() -}}
|
|
106
|
+
</a>
|
|
107
|
+
{% else %}
|
|
108
|
+
<span class="{{ componentClassName + '__name'}}">
|
|
109
|
+
{{- caller() -}}
|
|
110
|
+
</span>
|
|
111
|
+
{% endif %}
|
|
39
112
|
{% endmacro %}
|
|
@@ -1 +1,120 @@
|
|
|
1
|
-
@use "../../
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../components/byline-list-item/byline-list-item.scss";
|
|
3
|
+
@use "../../components/modal/modal.scss";
|
|
4
|
+
|
|
5
|
+
$ds-list-item__portrait-size: 44px;
|
|
6
|
+
$ds-list-item__portrait-size--small: 36px;
|
|
7
|
+
$ds-list-item__portrait-size--large: 104px;
|
|
8
|
+
|
|
9
|
+
.ds-byline {
|
|
10
|
+
padding: 0 0 ds-spacing($ds-s-100) 0;
|
|
11
|
+
border-bottom: ds-border-width(xxs) solid $ds-color-border-primary;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
max-width: 520px;
|
|
14
|
+
margin-top: ds-spacing($ds-s-100);
|
|
15
|
+
|
|
16
|
+
.ds-byline__inner {
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ds-byline__portraits {
|
|
21
|
+
display: flex;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-byline__portrait {
|
|
25
|
+
border-radius: 50%;
|
|
26
|
+
background-color: $ds-color-surface-primary-raised-soft;
|
|
27
|
+
height: 100%;
|
|
28
|
+
|
|
29
|
+
.picture,
|
|
30
|
+
img {
|
|
31
|
+
border-radius: 50%;
|
|
32
|
+
width: $ds-list-item__portrait-size;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:not(:first-of-type) {
|
|
36
|
+
position: relative;
|
|
37
|
+
|
|
38
|
+
:before {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
position: absolute;
|
|
41
|
+
content: "";
|
|
42
|
+
border: ds-spacing($ds-s-025) solid $ds-color-border-primaryinvert-strongest;
|
|
43
|
+
border-radius: 100%;
|
|
44
|
+
width: calc(100% + 8px);
|
|
45
|
+
height: calc(100% + 8px);
|
|
46
|
+
top: -4px;
|
|
47
|
+
left: -4px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ds-byline__info {
|
|
53
|
+
align-self: flex-end;
|
|
54
|
+
margin-left: ds-spacing($ds-s-100);
|
|
55
|
+
|
|
56
|
+
.ds-byline__role,
|
|
57
|
+
.ds-byline__name {
|
|
58
|
+
color: $ds-color-text-primary;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ds-byline__role {
|
|
62
|
+
display: block;
|
|
63
|
+
@include ds-typography($ds-typography-functional-body-md);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ds-byline__name,
|
|
67
|
+
.ds-byline__and {
|
|
68
|
+
@include ds-typography($ds-typography-functional-body-md, $fontWeight: $ds-fontweight-medium);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ds-byline__name {
|
|
72
|
+
text-decoration-line: underline;
|
|
73
|
+
&:hover {
|
|
74
|
+
text-decoration-line: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ds-byline__inner--multiple {
|
|
80
|
+
flex-wrap: wrap;
|
|
81
|
+
|
|
82
|
+
.ds-byline__info {
|
|
83
|
+
margin-left: 0;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&.ds-byline--show-images {
|
|
89
|
+
.ds-byline__inner--multiple {
|
|
90
|
+
.ds-byline__info {
|
|
91
|
+
margin-top: ds-spacing($ds-s-100);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&--large {
|
|
97
|
+
position: relative;
|
|
98
|
+
display: flex;
|
|
99
|
+
padding-top: ds-spacing($ds-s-200);
|
|
100
|
+
|
|
101
|
+
.ds-byline__portrait--large {
|
|
102
|
+
position: absolute;
|
|
103
|
+
right: ds-spacing($ds-s-100);
|
|
104
|
+
top: 0;
|
|
105
|
+
background-color: transparent;
|
|
106
|
+
border-radius: 0;
|
|
107
|
+
width: $ds-list-item__portrait-size--large;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.ds-byline__info {
|
|
111
|
+
margin-left: 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ds-byline__list {
|
|
117
|
+
list-style: none;
|
|
118
|
+
margin: 0;
|
|
119
|
+
padding: 0;
|
|
120
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/byline-list-item](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/byline-list-item)
|
|
2
|
+
- Storybook: [Byline](https://designsystem.dn.se/?path=/docs/article-byline-list-item--docs)
|
|
3
|
+
- Storybook (Latest): [Byline](https://designsystem-latest.dn.se/?path=/docs/article-byline-list-item--docs)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# Byline List Item
|
|
8
|
+
|
|
9
|
+
The byline is a list item and should be wrapped in a list.
|
|
10
|
+
|
|
11
|
+
* variant:'follow' can render both a button and a link
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
|parameter | type | required | options | default | description |
|
|
16
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
17
|
+
|variant | String | yes | follow, link, direkt | | |
|
|
18
|
+
|authorName | String | yes | | | |
|
|
19
|
+
|bylineImage | HTML | no | | | Html image from bang. The component only makes the image round. Scaling is up to the user. Should be 44px for non retina screens. |
|
|
20
|
+
|role | String | no | | | Used in variant:link |
|
|
21
|
+
|authorPageUrl | String | no | | | For variant:button an inner link can be used in combination with a button, for other variants an outer link is used |
|
|
22
|
+
|followable | Boolean | no | true, false | true | If true the toggle button to follow will be shown when using variant:follow. |
|
|
23
|
+
|followed | Boolean | no | true, false | false | If true the toggle button will be in "selected" state. Depends on followable parameter. |
|
|
24
|
+
|border | Boolean | no | true, false | true | If false the border will not be shown. Used to remove border from the last item or direkt bylines |
|
|
25
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
26
|
+
|elementAttributes | Object | no | | | Sets attributes on actual toggle element and not byline list item. Same structure as attributes above, for accessability reasons it's important to send in "aria-label": "Följ " + byline.name |
|
|
27
|
+
|linkAttributes | Object | no | | | Sets attributes on the link element. |
|
|
28
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
29
|
+
|elementClassNames | String | no | | | Sets classes on actual toggle element and not byline list item. Same structure as classNames above |
|
|
30
|
+
|forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
|
|
31
|
+
|
|
32
|
+
## Minimum requirement example
|
|
33
|
+
|
|
34
|
+
### Nunjucks
|
|
35
|
+
|
|
36
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
{% from '@bonniernews/dn-design-system-web/components/byline-list-item/byline-list-item.njk' import BylineListItem %}
|
|
40
|
+
|
|
41
|
+
{{ BylineListItem({
|
|
42
|
+
variant: variant,
|
|
43
|
+
bylineImage: imageHtml(),
|
|
44
|
+
authorName: authorName,
|
|
45
|
+
role: role,
|
|
46
|
+
authorPageUrl: authorPageUrl,
|
|
47
|
+
followable: followable,
|
|
48
|
+
border: border,
|
|
49
|
+
attributes: attributes,
|
|
50
|
+
elementAttributes: elementAttributes,
|
|
51
|
+
elementClassNames: elementClassNames,
|
|
52
|
+
classNames: "",
|
|
53
|
+
forcePx: false
|
|
54
|
+
})}}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### SCSS
|
|
58
|
+
```scss
|
|
59
|
+
@use "@bonniernews/dn-design-system-web/components/byline-list-item/byline-list-item";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Javascript
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button-interactions.js'
|
|
66
|
+
const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
|
|
67
|
+
dsButtonToggle(toggleElements);
|
|
68
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/components/list-item/list-item.njk' import ListItem %}
|
|
2
|
+
|
|
3
|
+
{% macro BylineListItem(params) %}
|
|
4
|
+
{% set useOuterAnchorElement = params.authorPageUrl and not params.followable %}
|
|
5
|
+
{% set useArrowIcon = true if (useOuterAnchorElement and params.variant !== 'direkt') %}
|
|
6
|
+
{% set useFollowButton = true if (params.variant == 'follow' and params.followable) %}
|
|
7
|
+
|
|
8
|
+
{% if params.variant == 'direkt' %}
|
|
9
|
+
{% set subtitle = false %}
|
|
10
|
+
{% else %}
|
|
11
|
+
{% set subtitle = params.role %}
|
|
12
|
+
{% endif %}
|
|
13
|
+
|
|
14
|
+
{% set classNames = (params.classNames or '') + ' ds-byline-list-item--' + params.variant %}
|
|
15
|
+
|
|
16
|
+
{{ ListItem({
|
|
17
|
+
listItemType: 'byline',
|
|
18
|
+
title: params.authorName,
|
|
19
|
+
subtitle: subtitle,
|
|
20
|
+
mediaHtml: params.bylineImage,
|
|
21
|
+
trailingIcon: 'arrow_forward' if useArrowIcon,
|
|
22
|
+
toggleText: 'Följ' if useFollowButton,
|
|
23
|
+
toggleSelectedText: 'Följer' if useFollowButton,
|
|
24
|
+
selected: params.followed if useFollowButton,
|
|
25
|
+
href: params.authorPageUrl if useOuterAnchorElement,
|
|
26
|
+
titleHref: params.authorPageUrl if not useOuterAnchorElement,
|
|
27
|
+
linkAttributes: params.linkAttributes,
|
|
28
|
+
border: params.variant !== 'direkt' and params.border !== false,
|
|
29
|
+
fontWeight: 'semibold',
|
|
30
|
+
elementAttributes: params.elementAttributes,
|
|
31
|
+
elementClassNames: params.elementClassNames,
|
|
32
|
+
forcePx: params.forcePx,
|
|
33
|
+
classNames: classNames,
|
|
34
|
+
attributes: params.attributes
|
|
35
|
+
}) }}
|
|
36
|
+
{% endmacro %}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use "../../components/list-item/list-item.scss";
|
|
@@ -280,7 +280,11 @@ $ds-list-item__portrait-size--small: 36px;
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
.ds-list-item--byline {
|
|
283
|
-
|
|
283
|
+
.ds-list-item__subtitle {
|
|
284
|
+
text-transform: capitalize;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&.ds-byline-list-item--direkt {
|
|
284
288
|
padding: ds-spacing($ds-s-075 0);
|
|
285
289
|
|
|
286
290
|
.ds-list-item__portrait {
|
|
@@ -133,9 +133,11 @@ body.no-scroll {
|
|
|
133
133
|
height: 100%;
|
|
134
134
|
max-width: 100%;
|
|
135
135
|
width: 100%;
|
|
136
|
+
background-color: transparent;
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
.ds-modal__content {
|
|
140
|
+
box-sizing: border-box;
|
|
139
141
|
position: absolute;
|
|
140
142
|
bottom: 0;
|
|
141
143
|
padding: ds-spacing($ds-s-100);
|
package/package.json
CHANGED