@bonniernews/dn-design-system-web 2.1.0-alpha.9 → 3.0.0-alpha.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.md +1 -1
  3. package/components/blocked-content/README.md +60 -0
  4. package/components/blocked-content/blocked-content.js +83 -0
  5. package/components/blocked-content/blocked-content.njk +38 -0
  6. package/components/blocked-content/blocked-content.scss +34 -0
  7. package/components/byline/README.md +64 -0
  8. package/components/byline/byline.njk +97 -0
  9. package/components/byline/byline.scss +160 -0
  10. package/components/checkbox/checkbox.njk +2 -5
  11. package/components/disclaimer/README.md +3 -1
  12. package/components/disclaimer/disclaimer.njk +7 -6
  13. package/components/disclaimer/disclaimer.scss +11 -0
  14. package/components/divider/README.md +2 -1
  15. package/components/divider/divider.njk +4 -1
  16. package/components/divider/divider.scss +14 -10
  17. package/components/factbox/README.md +2 -1
  18. package/components/factbox/factbox.js +1 -1
  19. package/components/factbox/factbox.njk +11 -16
  20. package/components/factbox/factbox.scss +53 -34
  21. package/components/list-item/list-item.scss +4 -5
  22. package/components/quote/quote.scss +5 -1
  23. package/components/thematic-break/thematic-break.njk +1 -1
  24. package/components/thematic-break/thematic-break.scss +12 -6
  25. package/foundations/a11y/informative-svg.njk +23 -0
  26. package/foundations/helpers/README-spacing.md +71 -0
  27. package/foundations/helpers/spacing.scss +31 -7
  28. package/foundations/helpers/typography.scss +4 -4
  29. package/foundations/icons/grade-icon.njk +10 -6
  30. package/foundations/variables/colorsCssVariables.scss +2 -0
  31. package/foundations/variables/colorsDnDarkTokens.scss +3 -1
  32. package/foundations/variables/colorsDnLightTokens.scss +2 -0
  33. package/foundations/variables/spacingLayoutLargeScreen.scss +17 -0
  34. package/package.json +1 -1
  35. package/tokens/colors-css-variables.json +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,134 @@
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
+ ## [3.0.0-alpha.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.22...@bonniernews/dn-design-system-web@3.0.0-alpha.0) (2023-03-03)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **web:** Layout spacing is changed to a mixin. Will need to be include on all places.
12
+
13
+ ### Bug Fixes
14
+
15
+ * **web:** refactor spacing layout as padding ([#699](https://github.com/BonnierNews/dn-design-system/issues/699)) ([60e126f](https://github.com/BonnierNews/dn-design-system/commit/60e126fa57142effdd4e8eb8331be475074a40a3))
16
+
17
+
18
+
19
+ ## [2.1.0-alpha.22](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.21...@bonniernews/dn-design-system-web@2.1.0-alpha.22) (2023-03-02)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **web:** set box-sizing on disclaimer ([#715](https://github.com/BonnierNews/dn-design-system/issues/715)) ([4933e7f](https://github.com/BonnierNews/dn-design-system/commit/4933e7f8ab27f20ac745b2b0d1706fb535d2335d))
25
+
26
+
27
+
28
+ ## 2.1.0-alpha.21 (2023-03-02)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * **web:** change breakpoint for large screen from desktop to tablet ([#708](https://github.com/BonnierNews/dn-design-system/issues/708)) ([fc3ae78](https://github.com/BonnierNews/dn-design-system/commit/fc3ae78eaae866bcab14b39a638df94349193dcd))
34
+
35
+
36
+
37
+ ## [2.1.0-alpha.20](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.19...@bonniernews/dn-design-system-web@2.1.0-alpha.20) (2023-03-01)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **web:** update readme and js param for blocked content ([#707](https://github.com/BonnierNews/dn-design-system/issues/707)) ([e043945](https://github.com/BonnierNews/dn-design-system/commit/e043945592be4ea031fd029b9b9eb04fd4f799aa))
43
+
44
+
45
+
46
+ ## 2.1.0-alpha.19 (2023-03-01)
47
+
48
+
49
+ ### Bug Fixes
50
+
51
+ * **web:** byline and listitem outer spacing ([#705](https://github.com/BonnierNews/dn-design-system/issues/705)) ([35b1b1b](https://github.com/BonnierNews/dn-design-system/commit/35b1b1bd2e77e0ae8955ce11e4ab86420126a1ab))
52
+
53
+
54
+
55
+ ## [2.1.0-alpha.18](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.17...@bonniernews/dn-design-system-web@2.1.0-alpha.18) (2023-02-27)
56
+
57
+
58
+ ### Bug Fixes
59
+
60
+ * **web:** removed top border and update tests threshold ([#701](https://github.com/BonnierNews/dn-design-system/issues/701)) ([058b8d6](https://github.com/BonnierNews/dn-design-system/commit/058b8d68e5521ecc82f5ee879e317384042ec81b))
61
+
62
+
63
+
64
+ ## 2.1.0-alpha.17 (2023-02-27)
65
+
66
+
67
+ ### Features
68
+
69
+ * **web:** blocked content component ([#691](https://github.com/BonnierNews/dn-design-system/issues/691)) ([15ac04e](https://github.com/BonnierNews/dn-design-system/commit/15ac04e5af5785ad99a34a11281e39dfd330dbae))
70
+
71
+
72
+
73
+ ## [2.1.0-alpha.16](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.15...@bonniernews/dn-design-system-web@2.1.0-alpha.16) (2023-02-24)
74
+
75
+
76
+ ### Features
77
+
78
+ * **web:** web byline component ([#693](https://github.com/BonnierNews/dn-design-system/issues/693)) ([7ba1b30](https://github.com/BonnierNews/dn-design-system/commit/7ba1b30fda13c54ada24631e47bb8b3be580f274))
79
+
80
+
81
+
82
+ ## [2.1.0-alpha.15](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.14...@bonniernews/dn-design-system-web@2.1.0-alpha.15) (2023-02-23)
83
+
84
+
85
+ ### Features
86
+
87
+ * **web:** native variant of disclaimer ([#696](https://github.com/BonnierNews/dn-design-system/issues/696)) ([1294432](https://github.com/BonnierNews/dn-design-system/commit/1294432532d92ec7cb1c1db21e489da0a36ec43c))
88
+
89
+
90
+
91
+ ## [2.1.0-alpha.14](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.13...@bonniernews/dn-design-system-web@2.1.0-alpha.14) (2023-02-23)
92
+
93
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
94
+
95
+
96
+
97
+
98
+
99
+ ## [2.1.0-alpha.13](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.12...@bonniernews/dn-design-system-web@2.1.0-alpha.13) (2023-02-23)
100
+
101
+
102
+ ### Bug Fixes
103
+
104
+ * **web:** sthlm variants for quote/factbox and refactor thematic break ([#694](https://github.com/BonnierNews/dn-design-system/issues/694)) ([3122e04](https://github.com/BonnierNews/dn-design-system/commit/3122e0474e5c40176234e6efbf17447d4c85aa6f))
105
+
106
+
107
+
108
+ ## [2.1.0-alpha.12](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.11...@bonniernews/dn-design-system-web@2.1.0-alpha.12) (2023-02-22)
109
+
110
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
111
+
112
+
113
+
114
+
115
+
116
+ ## 2.1.0-alpha.11 (2023-02-22)
117
+
118
+
119
+ ### Bug Fixes
120
+
121
+ * **web:** grade accessibility ([#689](https://github.com/BonnierNews/dn-design-system/issues/689)) ([16cb2ea](https://github.com/BonnierNews/dn-design-system/commit/16cb2eaf3b32d62c6968e6846b1a7b13c05c82eb))
122
+
123
+
124
+
125
+ ## [2.1.0-alpha.10](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.9...@bonniernews/dn-design-system-web@2.1.0-alpha.10) (2023-02-21)
126
+
127
+
128
+ ### Bug Fixes
129
+
130
+ * **web:** redo review grades to match new design ([#685](https://github.com/BonnierNews/dn-design-system/issues/685)) ([f617440](https://github.com/BonnierNews/dn-design-system/commit/f617440501709d4a6114f41c4a08d3761f5951e6))
131
+
132
+
133
+
6
134
  ## [2.1.0-alpha.9](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.8...@bonniernews/dn-design-system-web@2.1.0-alpha.9) (2023-02-20)
7
135
 
8
136
  **Note:** Version bump only for package @bonniernews/dn-design-system-web
package/README.md CHANGED
@@ -10,4 +10,4 @@ Storybook latest: [https://designsystem-latest.dn.se/](https://designsystem-late
10
10
 
11
11
  Github: [https://github.com/BonnierNews/dn-design-system/tree/main/web/src](https://github.com/BonnierNews/dn-design-system/tree/main/web/src)
12
12
 
13
- For specific instructions see each component readme.
13
+ For specific instructions see each component or helper readme.
@@ -0,0 +1,60 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/blocked-content](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/blocked-content)
2
+ - Storybook (PROD): [BlockedContent > Web](https://designsystem.dn.se/?path=/story/components-app-web-article-components-blocked-content-web--standard)
3
+ - Storybook (LATEST): [BlockedContent > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-article-components-blocked-content-web--standard)
4
+
5
+ ----
6
+
7
+ # Blocked Content
8
+
9
+ This component is available as either a Nunjuck component or a JavaScript component. In Bang we only use the JavaScript variant. The Nunjuck implementation is mostly used to generate the html markup used in the JavaScript component.
10
+
11
+ ## Parameters
12
+
13
+ |parameter | type | required | options | default | description |
14
+ |:--- | :--- | :--- | :--- | :--- | :--- |
15
+ |title | String | yes | | | |
16
+ |body | HTML String | yes | | | |
17
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
18
+ |elementAttributes | Object | no | | | Sets attributes on button element. Same structure as attributes above |
19
+ |classNames | String | no | | | Ex. "my-special-class" |
20
+ |forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size |
21
+ |vendor | String | yes (only in JavaScript) | | | JavaScript attribute, not available as njk-parameter |
22
+
23
+ ## Minimum requirement example
24
+
25
+ ### Nunjucks
26
+
27
+ These are copy paste friendly examples to quickliy get started using a component.
28
+
29
+ ```html
30
+ {% from '@bonniernews/dn-design-system-web/components/blocked-content/blocked-content.njk' import BlockedContent %}
31
+
32
+ {{ BlockedContent({
33
+ title: 'Hoppsan, här saknas något',
34
+ body: 'Innehållet från Twitter kunde inte visas på grund av dina val i cookie-inställningarna.'
35
+ })}}
36
+ ```
37
+
38
+ ### SCSS
39
+ ```scss
40
+ @use "@bonniernews/dn-design-system-web/components/blocked-content/blocked-content" as *;
41
+ ```
42
+
43
+ ### Javascript
44
+
45
+ ```javascript
46
+ import { dsBlockedContent } from '@bonniernews/dn-design-system-web/components/blocked-content/blocked-content.js'
47
+
48
+ // avalaible javascript parameters, matches njk paramaters + vendor:
49
+ const parameters = {
50
+ vendor: "YouTube",
51
+ title: "Videon kunde ej visas",
52
+ body: "För att spela videon behöver du gå till “Inställningar per partner” och godkänna Screen9 AB", // overrides vendor
53
+ classNames: "test-class",
54
+ forcePx: false,
55
+ attributes: { "data-test" : "test-value" },
56
+ elementAttributes: { "onclick": "javascript:Didomi.notice.show()" }
57
+ }
58
+
59
+ const blockedContentHtml = dsBlockedContent(parameters);
60
+ ```
@@ -0,0 +1,83 @@
1
+ export {
2
+ dsBlockedContent,
3
+ dsBlockedContentStory
4
+ };
5
+
6
+ function dsBlockedContent(params) {
7
+ params = params || {};
8
+
9
+ const blockedContentTmpl = document.createElement("div");
10
+ // NOTE: this should match output of blocked-content.njk
11
+ blockedContentTmpl.innerHTML = `
12
+ <div class="ds-blocked-content">
13
+ <div class="ds-blocked-content__inner">
14
+ <div class="ds-blocked-content__content">
15
+ <h2 class="ds-blocked-content__title">Hoppsan, här saknas något</h2>
16
+ <div class="ds-blocked-content__body">Innehållet från <span class='ds-blocked-content__vendor'></span> kunde inte visas på grund av dina val i cookie-inställningarna.</div>
17
+ </div>
18
+ <button type="button" class="ds-btn ds-btn--secondaryFilled ds-btn--condensed ds-btn--small ds-btn--full-width">
19
+ <div class="ds-btn__inner">
20
+ <span>Integritetsinställningar</span>
21
+ <div class="ds-spinner ds-spinner--small ds-spinner--primary">
22
+ <div class="ds-spinner__inner"></div>
23
+ </div>
24
+ </div>
25
+ </button>
26
+ </div>
27
+ </div>
28
+ `;
29
+
30
+ const newBlockedContent = blockedContentTmpl.getElementsByClassName("ds-blocked-content")[0];
31
+ const btnEl = newBlockedContent.getElementsByClassName("ds-btn")[0];
32
+
33
+ if (params.vendor) {
34
+ const vendorEl = newBlockedContent.getElementsByClassName("ds-blocked-content__vendor")[0];
35
+ vendorEl.textContent = params.vendor;
36
+ }
37
+
38
+ if (params.title) {
39
+ const titleEl = newBlockedContent.getElementsByClassName("ds-blocked-content__title")[0];
40
+ titleEl.textContent = params.title;
41
+ }
42
+
43
+ if (params.body) {
44
+ const titleEl = newBlockedContent.getElementsByClassName("ds-blocked-content__body")[0];
45
+ titleEl.textContent = params.body;
46
+ }
47
+
48
+ if (params.classNames) {
49
+ newBlockedContent.classList.add(params.classNames);
50
+ }
51
+
52
+ if (params.forcePx) {
53
+ newBlockedContent.classList.add("ds-force-px");
54
+ btnEl.classList.add("ds-force-px");
55
+ }
56
+
57
+ if (params.attributes) {
58
+ for (const [key, value] of Object.entries(params.attributes)) {
59
+ newBlockedContent.setAttribute(key, value);
60
+ }
61
+ }
62
+
63
+ if (params.elementAttributes) {
64
+ for (const [key, value] of Object.entries(params.elementAttributes)) {
65
+ btnEl.setAttribute(key, value);
66
+ }
67
+ }
68
+
69
+ return newBlockedContent;
70
+ }
71
+
72
+ /** only use in storybook */
73
+ function dsBlockedContentStory() {
74
+ const blockedContentElements = Array.from(document.getElementsByClassName("js-ds-blocked-content-story"));
75
+ if (!blockedContentElements.length) return;
76
+
77
+ blockedContentElements.forEach((blockedContentEl) => {
78
+ const params = JSON.parse(blockedContentEl.getAttribute("data-params"));
79
+
80
+ const newBlockedContent = dsBlockedContent(params);
81
+ blockedContentEl.replaceWith(newBlockedContent);
82
+ });
83
+ }
@@ -0,0 +1,38 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
3
+
4
+ {% macro BlockedContent(params) %}
5
+ {% set componentClassName = "ds-blocked-content" %}
6
+ {% set classNamePrefix = componentClassName + "--" %}
7
+ {% set variant = [] %}
8
+ {% set attributes = getAttributes(params.attributes) %}
9
+
10
+ {% if params.forcePx %}
11
+ {% set variant = (variant.push("ds-force-px"), variant) %}
12
+ {% endif %}
13
+
14
+ {% if params.classNames %}
15
+ {% set variant = (variant.push(params.classNames), variant) %}
16
+ {% endif%}
17
+
18
+ {% set classes = componentClassName + " " + variant | join(" ") %}
19
+
20
+ <div class="{{ classes }}" {{- attributes | safe }}>
21
+ <div class="{{ componentClassName + '__inner'}}">
22
+ <div class="{{ componentClassName + '__content'}}">
23
+ <h2 class="{{ componentClassName + '__title'}}">{{ params.title }}</h2>
24
+ <div class="{{ componentClassName + '__body'}}">{{ params.body }}</div>
25
+ </div>
26
+ {{ Button({
27
+ text: 'Integritetsinställningar',
28
+ variant: 'secondaryFilled',
29
+ size: 'small',
30
+ classNames: '',
31
+ fullWidth: true,
32
+ forcePx: params.forcePx,
33
+ condensed: true,
34
+ attributes: params.elementAttributes
35
+ })}}
36
+ </div>
37
+ </div>
38
+ {% endmacro %}
@@ -0,0 +1,34 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../button/button.scss" as *;
3
+
4
+ .ds-blocked-content {
5
+ background-color: $ds-color-surface-background;
6
+ margin: 0;
7
+ @include ds-spacing-layout(
8
+ gap-vertical-static-medium 0 gap-vertical-static-large
9
+ );
10
+
11
+ .ds-blocked-content__inner {
12
+ text-align: center;
13
+ border: ds-metrics-border-width(x1) solid $ds-color-border-primary;
14
+ border-radius: ds-metrics-border-radius(x1);
15
+ padding: ds-spacing-component(x8 x4 x4);
16
+ }
17
+
18
+ .ds-blocked-content__body {
19
+ margin: ds-spacing-component(0 0 x8);
20
+ @include ds-typography($ds-typography-functional-body02regular);
21
+ color: $ds-color-text-primary;
22
+ @at-root .ds-force-px#{&} {
23
+ @include ds-typography($ds-typography-functional-body02regular, true);
24
+ }
25
+ }
26
+ .ds-blocked-content__title {
27
+ @include ds-typography($ds-typography-functional-heading01medium);
28
+ color: $ds-color-text-primary;
29
+ margin: 0 0 ds-spacing-component(x2);
30
+ @at-root .ds-force-px#{&} {
31
+ @include ds-typography($ds-typography-functional-heading01medium, true);
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,64 @@
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 > Web > Link](https://designsystem.dn.se/?path=/story/components-app-web-article-components-byline-web--link)
3
+ - Storybook: [Byline > Web > Follow ](https://designsystem.dn.se/?path=/story/components-app-web-article-components-byline-web--follow)
4
+
5
+ ----
6
+
7
+ # Byline
8
+
9
+ The byline is a list item and should be wrapped in a list.
10
+
11
+ ## Parameters
12
+
13
+ |parameter | type | required | options | default | description |
14
+ |:--- | :--- | :--- | :--- | :--- | :--- |
15
+ |variant | String | yes | follow, link | | |
16
+ |authorName | String | yes | | | |
17
+ |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. |
18
+ |role | String | no | | | Only used in variant link |
19
+ |email | String | no | | | email will be displayed instead of role for variant follow |
20
+ |authorPageUrl | String | no | | | The whole item (varant link), or the title and subtitle (variant follow) will link to this url |
21
+ |followable | Boolean | no | true, false | true | If true the toggle button to follow will be shown when using variant follow. |
22
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
23
+ |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 |
24
+ |classNames | String | no | | | Ex. "my-special-class" |
25
+ |elementClassNames | String | no | | | Sets classes on actual toggle element and not byline list item. Same structure as classNames above |
26
+ |forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
27
+
28
+ ## Minimum requirement example
29
+
30
+ ### Nunjucks
31
+
32
+ These are copy paste friendly examples to quickliy get started using a component.
33
+
34
+ ```html
35
+ {% from '@bonniernews/dn-design-system-web/components/byline/byline.njk' import Byline %}
36
+
37
+ {{ Byline({
38
+ variant: variant,
39
+ bylineImage: imageHtml(),
40
+ authorName: authorName,
41
+ role: role,
42
+ email: email,
43
+ authorPageUrl: authorPageUrl,
44
+ followable: followable,
45
+ attributes: attributes,
46
+ elementAttributes: elementAttributes,
47
+ elementClassNames: elementClassNames,
48
+ classNames: "",
49
+ forcePx: false
50
+ })}}
51
+ ```
52
+
53
+ ### SCSS
54
+ ```scss
55
+ @use "@bonniernews/dn-design-system-web/components/byline/byline";
56
+ ```
57
+
58
+ ### Javascript
59
+
60
+ ```javascript
61
+ import dsButtonToggle from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.js'
62
+ const toggleElements = Array.from(document.getElementsByClassName("ds-btn-toggle"));
63
+ dsButtonToggle(toggleElements);
64
+ ```
@@ -0,0 +1,97 @@
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
+ {% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
4
+
5
+ {% macro Byline(params) %}
6
+ {% set componentClassName = "ds-byline" %}
7
+ <li class="{{ componentClassName + '__outer'}}">
8
+ {% call BylineInner(params, componentClassName) %}
9
+ <div class="{{ componentClassName + '__inner'}}">
10
+ {% set componentClassName = componentClassName %}
11
+ {% call BylineContent(params, visualVariant, componentClassName ) %}
12
+ {% if params.bylineImage %}
13
+ <span class="{{ componentClassName + '__image'}}">{{- params.bylineImage | safe -}}</span>
14
+ {% endif %}
15
+ <div class="{{ componentClassName + '__titles'}}">
16
+ {% if params.authorName %}
17
+ <span class="{{ componentClassName + '__title'}}">{{ params.authorName }}</span>
18
+ {% endif %}
19
+ {%- if subtitle %}
20
+ <span class="{{ componentClassName + '__subtitle'}}">{{ subtitle }}</span>
21
+ {% endif %}
22
+ </div>
23
+ {% endcall %}
24
+ {% if visualVariant == 'icon' %}
25
+ <span class="{{ componentClassName + '__icon-right'}}">{{- Icon({ icon: 'arrow_forward' }) | safe -}}</span>
26
+ {% endif %}
27
+ {% if visualVariant == 'button' and params.followable %}
28
+ {{ ButtonToggle({
29
+ text: "Följ",
30
+ selectedText: "Följer",
31
+ variant: "secondaryFilled",
32
+ size: "xsmall",
33
+ attributes: params.elementAttributes,
34
+ classNames: elementClassNames | join(" "),
35
+ forcePx: params.forcePx,
36
+ condensed: true
37
+ })}}
38
+ {% endif %}
39
+ </div>
40
+ {% endcall %}
41
+ </li>
42
+ {% endmacro %}
43
+
44
+ {# Internal helper macro - not intended for use outside of this file #}
45
+ {% macro BylineContent(params, visualVariant, componentClassName) %}
46
+ {% set subtitle = params.role if params.variant == 'link' else params.email %}
47
+ {% if visualVariant == 'button' and params.authorPageUrl %}
48
+ <a href="{{params.authorPageUrl}}" aria-label="Läs mer från: {{ params.authorName }}" class="{{ componentClassName + '__content-wrapper'}}">
49
+ {{ caller() if caller }}
50
+ </a>
51
+ {% else %}
52
+ <div class="{{ componentClassName + '__content-wrapper'}}">
53
+ {{ caller() if caller }}
54
+ </div>
55
+ {% endif %}
56
+ {% endmacro %}
57
+
58
+ {# Internal helper macro - not intended for use outside of this file #}
59
+ {% macro BylineInner(params, componentClassName) %}
60
+ {% set classNamePrefix = componentClassName + "--" %}
61
+ {% set variant = [] %}
62
+ {% set attributes = getAttributes(params.attributes) %}
63
+ {% set visualVariant = "icon" if (params.variant == 'link' or params.followable != true) and params.authorPageUrl else "button" %}
64
+
65
+ {% if params.forcePx %}
66
+ {% set variant = (variant.push("ds-force-px"), variant) %}
67
+ {% endif %}
68
+
69
+ {% if params.classNames %}
70
+ {% set variant = (variant.push(params.classNames), variant) %}
71
+ {% endif %}
72
+
73
+ {% if not params.authorPageUrl %}
74
+ {% set variant = (variant.push(componentClassName + '--noninteractive'), variant) %}
75
+ {% endif %}
76
+
77
+ {% if params.bylineImage %}
78
+ {% set bylineImage = params.bylineImage %}
79
+ {% endif %}
80
+ {% set variant = (variant.push(classNamePrefix + params.variant), variant) %}
81
+ {% set classes = componentClassName + " " + variant | join(" ") %}
82
+
83
+ {% set elementClassNames = [ componentClassName + "__btn-toggle" ]%}
84
+ {% if params.elementClassNames %}
85
+ {% set elementClassNames = (elementClassNames.push(params.elementClassNames), elementClassNames) %}
86
+ {% endif %}
87
+
88
+ {% if visualVariant == 'icon' %}
89
+ <a href="{{ params.authorPageUrl }}" aria-label="Läs mer från: {{ params.authorName }}" class="{{ classes }}" {{- attributes | safe }}>
90
+ {{ caller() if caller }}
91
+ </a>
92
+ {% else %}
93
+ <div class="{{ classes }}" {{- attributes | safe }}>
94
+ {{ caller() if caller }}
95
+ </div>
96
+ {% endif %}
97
+ {% endmacro %}
@@ -0,0 +1,160 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../foundations/icons/icon.scss" as *;
3
+ @use "../../components/button-toggle/button-toggle.scss" as *;
4
+
5
+ $ds-byline__icon-size: 24px;
6
+ $ds-byline__image-size: 44px;
7
+
8
+ .ds-byline__outer {
9
+ list-style: none;
10
+ line-height: 0;
11
+ }
12
+
13
+ .ds-byline {
14
+ background-color: transparent;
15
+ border: 0;
16
+ display: inline-flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ padding: 0;
20
+ width: 100%;
21
+ position: relative;
22
+
23
+ &::after {
24
+ content: "";
25
+ height: ds-metrics-border-width(x1);
26
+ width: calc(100% - (ds-spacing-component(outer) * 2));
27
+ background-color: $ds-color-border-primary;
28
+ position: absolute;
29
+ left: ds-spacing-component(x4);
30
+ bottom: 0;
31
+ }
32
+
33
+ .ds-byline__inner {
34
+ box-sizing: border-box;
35
+ border-radius: 0;
36
+ transition: background-color 50ms ease-out;
37
+ margin: 0;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: space-between;
41
+ position: relative;
42
+ padding: ds-spacing-component(x4 outer);
43
+ width: 100%;
44
+
45
+ &::before {
46
+ content: "";
47
+ border-radius: inherit;
48
+ pointer-events: none;
49
+ position: absolute;
50
+ top: 0;
51
+ left: 0;
52
+ bottom: 0;
53
+ right: 0;
54
+ transition: background-color 500ms ease;
55
+ }
56
+
57
+ .ds-icon {
58
+ position: relative;
59
+ display: flex;
60
+ height: ds-px-to-rem($ds-byline__icon-size);
61
+ width: ds-px-to-rem($ds-byline__icon-size);
62
+ margin: 0;
63
+ @at-root .ds-force-px#{&} {
64
+ height: $ds-byline__icon-size;
65
+ width: $ds-byline__icon-size;
66
+ }
67
+ svg {
68
+ fill: currentColor;
69
+ }
70
+ }
71
+ }
72
+
73
+ .ds-byline__content-wrapper {
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: space-between;
77
+ flex-grow: 1;
78
+ text-decoration: none;
79
+
80
+ &:focus-visible {
81
+ outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
82
+ outline-offset: 2px;
83
+ }
84
+ }
85
+
86
+ .ds-byline__image {
87
+ height: $ds-byline__image-size;
88
+ width: $ds-byline__image-size;
89
+ border-radius: 50%;
90
+ overflow: hidden;
91
+ margin-right: ds-spacing-component(x4);
92
+ background-color: $ds-color-component-primary-overlay;
93
+ flex-shrink: 0;
94
+ }
95
+
96
+ .ds-byline__titles {
97
+ display: flex;
98
+ flex-grow: 1;
99
+ flex-direction: column;
100
+ align-items: flex-start;
101
+ word-break: break-all;
102
+
103
+ .ds-byline__title {
104
+ @include ds-typography($ds-typography-functional-heading01medium);
105
+ @at-root .ds-force-px#{&} {
106
+ @include ds-typography($ds-typography-functional-heading01medium, true);
107
+ }
108
+ color: $ds-color-text-primary;
109
+ text-align: left;
110
+ }
111
+
112
+ .ds-byline__subtitle {
113
+ @include ds-typography($ds-typography-functional-body02regular);
114
+ @at-root .ds-force-px#{&} {
115
+ @include ds-typography($ds-typography-functional-body02regular, true);
116
+ }
117
+ color: $ds-color-text-primary-02;
118
+ text-align: left;
119
+ }
120
+ }
121
+
122
+ .ds-byline__icon-right {
123
+ color: $ds-color-icon-primary;
124
+ display: inline-flex;
125
+ margin-left: ds-spacing-component(x4);
126
+ }
127
+
128
+ .ds-byline__btn-toggle {
129
+ min-height: 44px;
130
+ min-width: 48px;
131
+ margin-left: ds-spacing-component(x4);
132
+ }
133
+
134
+ @include ds-hover() {
135
+ &:hover:not(.ds-byline--noninteractive) {
136
+ cursor: pointer;
137
+
138
+ .ds-byline__inner::before {
139
+ background-color: $ds-color-component-primary-overlay;
140
+ }
141
+ }
142
+ }
143
+
144
+ &:active:not(.ds-byline--noninteractive) .ds-byline__inner::before {
145
+ background-color: $ds-color-component-primary-overlay-02;
146
+ }
147
+ &:focus-visible {
148
+ outline: none;
149
+ .ds-byline__inner {
150
+ outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
151
+ outline-offset: -2px;
152
+ }
153
+ }
154
+
155
+ @at-root a#{&} {
156
+ box-sizing: border-box;
157
+ text-align: center;
158
+ text-decoration: none;
159
+ }
160
+ }