@bonniernews/dn-design-system-web 32.6.1 → 32.6.2

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
+ ## [32.6.2](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.6.1...@bonniernews/dn-design-system-web@32.6.2) (2025-06-10)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **web:** byline as tsx ([#1771](https://github.com/BonnierNews/dn-design-system/issues/1771)) ([f52f4e3](https://github.com/BonnierNews/dn-design-system/commit/f52f4e38506a2211b9a4d8dfb7333b5a52bf96cb))
13
+
7
14
  ## [32.6.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@32.6.0...@bonniernews/dn-design-system-web@32.6.1) (2025-06-10)
8
15
 
9
16
 
@@ -0,0 +1,55 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/byline](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/byline)
2
+ - Storybook: [Byline](https://designsystem.dn.se/?path=/docs/article-byline--docs)
3
+
4
+ ----
5
+
6
+ # Byline
7
+
8
+ ## Parameters
9
+
10
+ |parameter | type | required | options | default | description |
11
+ |:--- | :--- | :--- | :--- | :--- | :--- |
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 |
19
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
20
+ |classNames | String | no | | | Ex. "my-special-class" |
21
+
22
+ ## Minimum requirement example
23
+
24
+ ### Nunjucks
25
+
26
+ These are copy paste friendly examples to quickliy get started using a component.
27
+
28
+ ```html
29
+ {% from '@bonniernews/dn-design-system-web/components/byline/byline.njk' import Byline %}
30
+
31
+ {{ Byline({
32
+ largeByline: largeByline,
33
+ bylineTitle: bylineTitle,
34
+ bylines: bylines,
35
+ authorImages: [imageHtml(), imageHtml(), imageHtml()],
36
+ hideBylineImages: hideBylineImages,
37
+ renderBylineModal: renderBylineModal,
38
+ attributes: attributes,
39
+ classNames: classNames
40
+ variant: variant,
41
+ })}}
42
+ ```
43
+
44
+ ### SCSS
45
+ ```scss
46
+ @use "@bonniernews/dn-design-system-web/components/byline/byline";
47
+ ```
48
+
49
+ ### Javascript
50
+
51
+ ```javascript
52
+ import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button-interactions.js'
53
+ const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
54
+ dsButtonToggle(toggleElements);
55
+ ```
@@ -1,55 +1,33 @@
1
- - GitHub: [BonnierNews/dn-design-system/../web/src/components/byline](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/byline)
2
- - Storybook: [Byline](https://designsystem.dn.se/?path=/docs/article-byline--docs)
1
+ Byline
2
+ ======
3
3
 
4
- ----
4
+ * GitHub: [BonnierNews/dn-design-system/../web/src/components/byline](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/byline)
5
+ * Storybook: [Byline](https://designsystem.dn.se/?path=/docs/article-byline--docs)
5
6
 
6
- # Byline
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/byline/byline.scss'`
7
8
 
8
- ## Parameters
9
-
10
- |parameter | type | required | options | default | description |
11
- |:--- | :--- | :--- | :--- | :--- | :--- |
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 |
19
- |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
20
- |classNames | String | no | | | Ex. "my-special-class" |
21
-
22
- ## Minimum requirement example
23
-
24
- ### Nunjucks
25
-
26
- These are copy paste friendly examples to quickliy get started using a component.
27
-
28
- ```html
29
- {% from '@bonniernews/dn-design-system-web/components/byline/byline.njk' import Byline %}
30
-
31
- {{ Byline({
32
- largeByline: largeByline,
33
- bylineTitle: bylineTitle,
34
- bylines: bylines,
35
- authorImages: [imageHtml(), imageHtml(), imageHtml()],
36
- hideBylineImages: hideBylineImages,
37
- renderBylineModal: renderBylineModal,
38
- attributes: attributes,
39
- classNames: classNames
40
- variant: variant,
41
- })}}
42
- ```
43
-
44
- ### SCSS
45
- ```scss
46
- @use "@bonniernews/dn-design-system-web/components/byline/byline";
47
- ```
48
-
49
- ### Javascript
9
+ ### [](#javascript)Javascript
50
10
 
51
11
  ```javascript
52
- import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button/button-interactions.js'
53
- const toggleElements = Array.from(document.getElementsByClassName("ds-btn--toggle"));
54
- dsButtonToggle(toggleElements);
12
+ import { initModalByline } from '@bonniernews/dn-design-system-web/components/byline/byline-interaction.js'
13
+ const articleElement = document.querySelector('.some-article-class');
14
+ initModalByline(articleElement);
55
15
  ```
16
+
17
+ | Name | Description | Default |
18
+ |:--- | :--- | :--- |
19
+ | largeByline | boolean | false |
20
+ | bylineTitle\* | string | \- |
21
+ | bylines\* | BylineData\[\] | \- |
22
+ | hideBylineImages | boolean | false |
23
+ | renderBylineModal | boolean | false |
24
+ | showNameAsLink | boolean | false |
25
+ | classNames | string | \- |
26
+ | attributes | object | \- |
27
+
28
+ ```jsx
29
+ <RunComponentJs
30
+ component={<><div className="ds-byline ds-byline--show-images"><div className="ds-byline__inner"><div className="ds-byline__portrait" dangerouslySetInnerHTML={{__html: '<div class="picture lazy-image" style="aspect-ratio: 1 / 1"><img class="picture__img picture__img--fullheight" src="https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=44:44&amp;output-quality=80" srcset="https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=44:44&amp;output-quality=80 44w, https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=88:88&amp;output-quality=60 88w" sizes="44px" alt="" aria-hidden="true"></div>'}}/><div className="ds-byline__info"><span className="ds-byline__role">Text</span><a className="ds-byline__name" data-id="https://www.dn.se/av/peter-wolodarski" data-index="1" data-label="Peter Wolodarski" data-link-category="article author" href="https://www.dn.se/av/peter-wolodarski">Peter Wolodarski</a></div></div></div></>}
31
+ jsFunction={() => {}}
32
+ />
33
+ ```
@@ -1,4 +1,5 @@
1
1
  @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../components/byline-list/byline-list.scss";
2
3
  @use "../../components/byline-list-item/byline-list-item.scss";
3
4
  @use "../../components/modal/modal.scss";
4
5
 
@@ -46,7 +47,7 @@ $ds-list-item__portrait-size--large: 104px;
46
47
  }
47
48
 
48
49
  &--show-images .ds-byline__info {
49
- margin-left: ds-spacing($ds-s-100);
50
+ margin-left: ds-spacing($ds-s-075);
50
51
  }
51
52
 
52
53
  .ds-byline__info {
@@ -59,7 +60,7 @@ $ds-list-item__portrait-size--large: 104px;
59
60
 
60
61
  .ds-byline__role {
61
62
  display: block;
62
- @include ds-typography($ds-typography-functional-body-md);
63
+ @include ds-typography($ds-typography-functional-heading-xxs, $fontWeight: $ds-fontweight-regular);
63
64
  }
64
65
 
65
66
  .ds-byline__name,
@@ -87,7 +88,7 @@ $ds-list-item__portrait-size--large: 104px;
87
88
  &.ds-byline--show-images {
88
89
  .ds-byline__inner--multiple {
89
90
  .ds-byline__info {
90
- margin-top: ds-spacing($ds-s-100);
91
+ margin-top: ds-spacing($ds-s-075);
91
92
  }
92
93
  }
93
94
  }
@@ -12,8 +12,9 @@ The component will not include styling by itself. Make sure to include the right
12
12
 
13
13
  | Name | Description | Default |
14
14
  |:--- | :--- | :--- |
15
- | bylines\* | { authorName?: string; bylineImage?: string; authorPageUrl?: string; role?: string; border?: boolean; followable?: boolean; followed?: boolean; listItemClassNames?: string; attributes?: { \[key: string\]: string; }; linkAttributes?: { ...; }; buttonAttributes?: { ...; }; buttonClassNames?: string; }\[\] | \- |
15
+ | bylines\* | BylineData\[\] | \- |
16
16
  | attributes | { \[key: string\]: string; } | \- |
17
+ | showBorderOnLastItem | boolean | false |
17
18
  | forcePx | boolean | \- |
18
19
  | classNames | string | \- |
19
20
 
@@ -21,10 +22,20 @@ The component will not include styling by itself. Make sure to include the right
21
22
  <BylineList
22
23
  bylines={[
23
24
  {
24
- authorName: 'Byline link',
25
+ authorId: '1',
25
26
  authorPageUrl: 'https://www.dn.se/av/peter-wolodarski',
26
27
  bylineImage: '<div class="picture lazy-image" style="aspect-ratio: 1 / 1"><img class="picture__img picture__img--fullheight" src="https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=44:44&amp;output-quality=80" srcset="https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=44:44&amp;output-quality=80 44w, https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=88:88&amp;output-quality=60 88w" sizes="44px" alt="" aria-hidden="true"></div>',
28
+ followable: false,
29
+ name: 'Byline link',
27
30
  role: 'Grafik'
31
+ },
32
+ {
33
+ authorId: '123',
34
+ authorPageUrl: 'https://www.dn.se/av/peter-wolodarski',
35
+ bylineImage: '<div class="picture lazy-image" style="aspect-ratio: 1 / 1"><img class="picture__img picture__img--fullheight" src="https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=44:44&amp;output-quality=80" srcset="https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=44:44&amp;output-quality=80 44w, https://cached-images.bonnier.news/gcs/bilder/dn-author/i3v3p74rhqjfaaz5bh55j7plztzslpgpr3go52zr4q4dzdtyit3q-450x1020.png?interpolation=lanczos-none&amp;crop=261:261;81,2&amp;resize=88:88&amp;output-quality=60 88w" sizes="44px" alt="" aria-hidden="true"></div>',
36
+ followable: true,
37
+ name: 'Test Testsson',
38
+ role: 'Text'
28
39
  }
29
40
  ]}
30
41
  />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "32.6.1",
3
+ "version": "32.6.2",
4
4
  "description": "DN design system for web.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",
@@ -0,0 +1,37 @@
1
+ export interface BylineData {
2
+ name: string;
3
+ authorId: string;
4
+ bylineImage?: string;
5
+ authorPageUrl?: string;
6
+ followable: boolean;
7
+ followed?: boolean;
8
+ border?: boolean;
9
+ role: string;
10
+ }
11
+ interface BylineProps {
12
+ largeByline?: boolean;
13
+ bylineTitle: string;
14
+ bylines: BylineData[];
15
+ hideBylineImages?: boolean;
16
+ renderBylineModal?: boolean;
17
+ showNameAsLink?: boolean;
18
+ classNames?: string;
19
+ attributes?: object;
20
+ }
21
+ /**
22
+ * - GitHub: [BonnierNews/dn-design-system/../web/src/components/byline](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/byline)
23
+ * - Storybook: [Byline](https://designsystem.dn.se/?path=/docs/article-byline--docs)
24
+ *
25
+ * The component will not include styling by itself. Make sure to include the right styles for the component. See example below:
26
+ * `@use '@bonniernews/dn-design-system-web/components/byline/byline.scss'`
27
+ *
28
+ * ### Javascript
29
+ *
30
+ * ```javascript
31
+ * import { initModalByline } from '@bonniernews/dn-design-system-web/components/byline/byline-interaction.js'
32
+ * const articleElement = document.querySelector('.some-article-class');
33
+ * initModalByline(articleElement);
34
+ * ```
35
+ */
36
+ export declare const Byline: ({ bylines, bylineTitle, largeByline, hideBylineImages, renderBylineModal, showNameAsLink, classNames, attributes, }: BylineProps) => import("preact").JSX.Element;
37
+ export {};