@bonniernews/dn-design-system-web 2.1.0-alpha.2 → 2.1.0-alpha.21

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 (45) hide show
  1. package/CHANGELOG.md +167 -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/button/README.md +1 -0
  8. package/components/button/button.njk +4 -0
  9. package/components/button/button.scss +24 -19
  10. package/components/button-toggle/button-toggle.njk +2 -5
  11. package/components/button-toggle/button-toggle.scss +6 -10
  12. package/components/byline/README.md +64 -0
  13. package/components/byline/byline.njk +97 -0
  14. package/components/byline/byline.scss +160 -0
  15. package/components/checkbox/checkbox.njk +2 -5
  16. package/components/disclaimer/README.md +3 -1
  17. package/components/disclaimer/disclaimer.njk +7 -6
  18. package/components/disclaimer/disclaimer.scss +10 -0
  19. package/components/factbox/README.md +53 -0
  20. package/components/factbox/factbox.js +42 -0
  21. package/components/factbox/factbox.njk +78 -0
  22. package/components/factbox/factbox.scss +155 -0
  23. package/components/footer/footer.njk +5 -10
  24. package/components/list-item/README-checkbox.md +1 -0
  25. package/components/list-item/README-radio.md +1 -0
  26. package/components/list-item/README-switch.md +1 -0
  27. package/components/list-item/README-toggle.md +2 -1
  28. package/components/list-item/list-item.njk +10 -10
  29. package/components/list-item/list-item.scss +5 -7
  30. package/components/quote/README.md +36 -0
  31. package/components/quote/quote.njk +29 -0
  32. package/components/quote/quote.scss +36 -0
  33. package/components/switch/switch.scss +22 -15
  34. package/components/thematic-break/README.md +30 -0
  35. package/components/thematic-break/thematic-break.njk +14 -0
  36. package/components/thematic-break/thematic-break.scss +22 -0
  37. package/foundations/a11y/informative-svg.njk +23 -0
  38. package/foundations/helpers/typography.scss +4 -4
  39. package/foundations/icons/grade-icon.njk +22 -0
  40. package/foundations/variables/colorsCssVariables.scss +2 -0
  41. package/foundations/variables/colorsDnDarkTokens.scss +4 -2
  42. package/foundations/variables/colorsDnLightTokens.scss +3 -1
  43. package/njk-helpers/attributes.njk +5 -0
  44. package/package.json +1 -1
  45. package/tokens/colors-css-variables.json +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,173 @@
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
+ ## 2.1.0-alpha.21 (2023-03-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **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))
12
+
13
+
14
+
15
+ ## [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)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **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))
21
+
22
+
23
+
24
+ ## 2.1.0-alpha.19 (2023-03-01)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * **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))
30
+
31
+
32
+
33
+ ## [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)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **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))
39
+
40
+
41
+
42
+ ## 2.1.0-alpha.17 (2023-02-27)
43
+
44
+
45
+ ### Features
46
+
47
+ * **web:** blocked content component ([#691](https://github.com/BonnierNews/dn-design-system/issues/691)) ([15ac04e](https://github.com/BonnierNews/dn-design-system/commit/15ac04e5af5785ad99a34a11281e39dfd330dbae))
48
+
49
+
50
+
51
+ ## [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)
52
+
53
+
54
+ ### Features
55
+
56
+ * **web:** web byline component ([#693](https://github.com/BonnierNews/dn-design-system/issues/693)) ([7ba1b30](https://github.com/BonnierNews/dn-design-system/commit/7ba1b30fda13c54ada24631e47bb8b3be580f274))
57
+
58
+
59
+
60
+ ## [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)
61
+
62
+
63
+ ### Features
64
+
65
+ * **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))
66
+
67
+
68
+
69
+ ## [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)
70
+
71
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
72
+
73
+
74
+
75
+
76
+
77
+ ## [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)
78
+
79
+
80
+ ### Bug Fixes
81
+
82
+ * **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))
83
+
84
+
85
+
86
+ ## [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)
87
+
88
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
89
+
90
+
91
+
92
+
93
+
94
+ ## 2.1.0-alpha.11 (2023-02-22)
95
+
96
+
97
+ ### Bug Fixes
98
+
99
+ * **web:** grade accessibility ([#689](https://github.com/BonnierNews/dn-design-system/issues/689)) ([16cb2ea](https://github.com/BonnierNews/dn-design-system/commit/16cb2eaf3b32d62c6968e6846b1a7b13c05c82eb))
100
+
101
+
102
+
103
+ ## [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)
104
+
105
+
106
+ ### Bug Fixes
107
+
108
+ * **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))
109
+
110
+
111
+
112
+ ## [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)
113
+
114
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
115
+
116
+
117
+
118
+
119
+
120
+ ## [2.1.0-alpha.8](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.7...@bonniernews/dn-design-system-web@2.1.0-alpha.8) (2023-02-20)
121
+
122
+
123
+ ### Bug Fixes
124
+
125
+ * **web:** remove borders from review icons ([#683](https://github.com/BonnierNews/dn-design-system/issues/683)) ([f47ef42](https://github.com/BonnierNews/dn-design-system/commit/f47ef424be3d537af47c841c225d35f3a3d56535))
126
+
127
+
128
+
129
+ ## [2.1.0-alpha.7](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.6...@bonniernews/dn-design-system-web@2.1.0-alpha.7) (2023-02-20)
130
+
131
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
132
+
133
+
134
+
135
+
136
+
137
+ ## [2.1.0-alpha.6](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.5...@bonniernews/dn-design-system-web@2.1.0-alpha.6) (2023-02-20)
138
+
139
+
140
+ ### Features
141
+
142
+ * **web:** quote component for web ([#675](https://github.com/BonnierNews/dn-design-system/issues/675)) ([599c7d9](https://github.com/BonnierNews/dn-design-system/commit/599c7d9012b7a9677c31b42196189c6b8bba04e3))
143
+
144
+
145
+
146
+ ## [2.1.0-alpha.5](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.4...@bonniernews/dn-design-system-web@2.1.0-alpha.5) (2023-02-20)
147
+
148
+
149
+ ### Features
150
+
151
+ * **web:** thematic break ([#673](https://github.com/BonnierNews/dn-design-system/issues/673)) ([6a48aac](https://github.com/BonnierNews/dn-design-system/commit/6a48aac61f29243afcc5980f6e4ba70e3ee7b1c1))
152
+
153
+
154
+
155
+ ## [2.1.0-alpha.4](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.3...@bonniernews/dn-design-system-web@2.1.0-alpha.4) (2023-02-20)
156
+
157
+
158
+ ### Bug Fixes
159
+
160
+ * **web:** add element attributes to list items ([#676](https://github.com/BonnierNews/dn-design-system/issues/676)) ([5858f74](https://github.com/BonnierNews/dn-design-system/commit/5858f74d99d24bec38b4d404b4b4dcbfacfab9d1))
161
+
162
+
163
+
164
+ ## [2.1.0-alpha.3](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@2.1.0-alpha.2...@bonniernews/dn-design-system-web@2.1.0-alpha.3) (2023-02-17)
165
+
166
+
167
+ ### Features
168
+
169
+ * **web:** factbox component ([#672](https://github.com/BonnierNews/dn-design-system/issues/672)) ([310447e](https://github.com/BonnierNews/dn-design-system/commit/310447e35638aa7a289db613ee9e754098ed9718))
170
+
171
+
172
+
6
173
  ## 2.1.0-alpha.2 (2023-02-17)
7
174
 
8
175
 
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
+ padding: 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
+ }
@@ -15,6 +15,7 @@
15
15
  |size| String | no | default, small | default | |
16
16
  |fullWidth | bool | no | true, false | false | Button will be full width on both desktop and mobile |
17
17
  |mobile.fullWidth | bool | no | true, false | false | Ex mobile: { fullWidth: true } |
18
+ |condensed | bool | no | true, false | false | Condensed reduces spacing to a bare minimum, use with care since this might make touch target area smaller than recommended size |
18
19
  |iconPosition | String | no | none, left, right | none | |
19
20
  |iconName | String | no | add, arrow_back, arrow_forward etc | | For all available icons see: https://designsystem.dn.se/?path=/story/foundations-icon-web--all |
20
21
  |loading | bool | no | true, false | false | |
@@ -30,6 +30,10 @@
30
30
  {% set variant = (variant.push("ds-force-px"), variant) %}
31
31
  {% endif %}
32
32
 
33
+ {% if params.condensed %}
34
+ {% set variant = (variant.push(classNamePrefix + "condensed"), variant) %}
35
+ {% endif %}
36
+
33
37
  {% if params.size and params.size != "default" %}
34
38
  {% set variant = (variant.push(classNamePrefix + params.size), variant) %}
35
39
  {% endif %}
@@ -1,11 +1,5 @@
1
1
  @use "sass:math";
2
- @use "../../foundations/helpers/spacing.scss" as *;
3
- @use "../../foundations/helpers/typography.scss" as *;
4
- @use "../../foundations/helpers/mediaQueries.scss" as *;
5
- @use "../../foundations/helpers/metrics.scss" as *;
6
- @use "../../foundations/helpers/utilities.scss" as *;
7
- @use "../../foundations/helpers/colors.scss" as *;
8
- @use "../../foundations/helpers/loading.scss" as *;
2
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
9
3
  @use "../../foundations/icons/icon.scss" as *;
10
4
  @use "../spinner/spinner.scss" as *;
11
5
 
@@ -17,14 +11,17 @@ $ds-btn__icon-size: 24px;
17
11
  cursor: pointer;
18
12
  background-color: transparent;
19
13
  border: none;
20
- min-width: $ds-btn__min-clickable-area;
21
- min-height: $ds-btn__min-clickable-area;
22
14
  display: inline-flex;
23
15
  align-items: center;
24
16
  justify-content: center;
25
17
  padding: 0;
26
18
  position: relative;
27
19
 
20
+ &:not(.ds-btn--condensed) {
21
+ min-width: $ds-btn__min-clickable-area;
22
+ min-height: $ds-btn__min-clickable-area;
23
+ }
24
+
28
25
  &:focus-visible {
29
26
  outline: none;
30
27
  .ds-btn__inner {
@@ -62,8 +59,10 @@ $ds-btn__icon-size: 24px;
62
59
  }
63
60
  }
64
61
 
65
- &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
66
- background-color: $ds-color-component-primary-overlay;
62
+ @include ds-hover() {
63
+ &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
64
+ background-color: $ds-color-component-primary-overlay;
65
+ }
67
66
  }
68
67
  &:active:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
69
68
  background-color: $ds-color-component-primary-overlay-02;
@@ -172,8 +171,10 @@ $ds-btn__icon-size: 24px;
172
171
  &:focus-visible .ds-btn__inner {
173
172
  outline-color: $ds-color-border-focus-02;
174
173
  }
175
- &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
176
- background-color: $ds-color-component-secondary-overlay;
174
+ @include ds-hover() {
175
+ &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
176
+ background-color: $ds-color-component-secondary-overlay;
177
+ }
177
178
  }
178
179
  &:active:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
179
180
  background-color: $ds-color-component-secondary-overlay-02;
@@ -225,8 +226,10 @@ $ds-btn__icon-size: 24px;
225
226
  &:focus-visible .ds-btn__inner {
226
227
  outline-color: $ds-color-border-focus-02;
227
228
  }
228
- &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
229
- background-color: #0808081a; // static version of lightmode component-secondary-overlay
229
+ @include ds-hover() {
230
+ &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
231
+ background-color: #0808081a; // static version of lightmode component-secondary-overlay
232
+ }
230
233
  }
231
234
  &:active:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
232
235
  background-color: #08080833; // static version of lightmode component-secondary-overlay-2
@@ -245,9 +248,11 @@ $ds-btn__icon-size: 24px;
245
248
  &:focus-visible .ds-btn__inner {
246
249
  outline-color: $ds-color-static-white;
247
250
  }
248
- &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
249
- background-color: rgba(255, 255, 255, 0.101960784);
250
- // static version of darkmode component-secondary-overlay
251
+ @include ds-hover() {
252
+ &:hover:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
253
+ background-color: rgba(255, 255, 255, 0.101960784);
254
+ // static version of darkmode component-secondary-overlay
255
+ }
251
256
  }
252
257
  &:active:not(:disabled):not(.ds-loading) .ds-btn__inner::before {
253
258
  background-color: rgba(255, 255, 255, 0.2);
@@ -275,7 +280,7 @@ $ds-btn__icon-size: 24px;
275
280
  .ds-btn--primary,
276
281
  .ds-btn--staticWhiteFilled {
277
282
  &:not(.ds-loading):disabled {
278
- opacity: 0.6; // @todo replace with opacity token if/when available
283
+ opacity: $ds-opacity-component-disabled;
279
284
  .ds-btn__inner {
280
285
  cursor: not-allowed;
281
286
  }
@@ -1,15 +1,12 @@
1
1
  {% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
2
2
  {% from '@bonniernews/dn-design-system-web/components/spinner/spinner.njk' import Spinner %}
3
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
3
4
 
4
5
  {% macro ButtonToggle(params) %}
5
6
  {% set componentClassName = "ds-btn-toggle" %}
6
7
  {% set classNamePrefix = componentClassName + "--" %}
7
8
  {% set variant = [] %}
8
- {% set attributes %}
9
- {% for attribute, value in params.attributes %}
10
- {{attribute}}="{{value}}"
11
- {% endfor %}
12
- {% endset %}
9
+ {% set attributes = getAttributes(params.attributes) %}
13
10
 
14
11
  {% if params.selected %}
15
12
  {% set variant = (variant.push(classNamePrefix + "selected"), variant) %}
@@ -1,11 +1,5 @@
1
1
  @use "sass:math";
2
- @use "../../foundations/helpers/spacing.scss" as *;
3
- @use "../../foundations/helpers/typography.scss" as *;
4
- @use "../../foundations/helpers/mediaQueries.scss" as *;
5
- @use "../../foundations/helpers/metrics.scss" as *;
6
- @use "../../foundations/helpers/utilities.scss" as *;
7
- @use "../../foundations/helpers/colors.scss" as *;
8
- @use "../../foundations/helpers/loading.scss" as *;
2
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
9
3
  @use "../../foundations/icons/icon.scss" as *;
10
4
  @use "../spinner/spinner.scss" as *;
11
5
 
@@ -71,8 +65,10 @@ $ds-btn-toggle__icon-size-xsmall: 20px;
71
65
  }
72
66
  }
73
67
 
74
- &:hover:not(:disabled):not(.ds-loading) .ds-btn-toggle__inner::before {
75
- background-color: $ds-color-component-primary-overlay;
68
+ @include ds-hover() {
69
+ &:hover:not(:disabled):not(.ds-loading) .ds-btn-toggle__inner::before {
70
+ background-color: $ds-color-component-primary-overlay;
71
+ }
76
72
  }
77
73
  &:active:not(:disabled):not(.ds-loading) .ds-btn-toggle__inner::before {
78
74
  background-color: $ds-color-component-primary-overlay-02;
@@ -127,7 +123,7 @@ $ds-btn-toggle__icon-size-xsmall: 20px;
127
123
  }
128
124
  &:not(.ds-btn-toggle--selected) {
129
125
  &:not(.ds-loading):disabled {
130
- opacity: 0.6; // @todo replace with opacity token if/when available
126
+ opacity: $ds-opacity-component-disabled;
131
127
  .ds-btn-toggle__inner {
132
128
  cursor: not-allowed;
133
129
  }
@@ -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
+ ```