@bonniernews/dn-design-system-web 1.0.0-alpha.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +205 -0
  2. package/assets/form-field/form-field.njk +6 -4
  3. package/assets/form-field/form-field.scss +3 -2
  4. package/components/badge/badge.scss +3 -3
  5. package/components/buddy-menu/README.md +63 -0
  6. package/components/buddy-menu/buddy-menu.njk +77 -0
  7. package/components/buddy-menu/buddy-menu.scss +115 -0
  8. package/components/button/README.md +2 -2
  9. package/components/button/button.njk +27 -8
  10. package/components/button/button.scss +79 -33
  11. package/components/button-toggle/README.md +54 -0
  12. package/components/button-toggle/button-toggle.js +9 -0
  13. package/components/button-toggle/button-toggle.njk +63 -0
  14. package/components/button-toggle/button-toggle.scss +219 -0
  15. package/components/checkbox/README.md +1 -0
  16. package/components/checkbox/checkbox.njk +13 -18
  17. package/components/checkbox/checkbox.scss +32 -40
  18. package/components/divider/divider.scss +3 -3
  19. package/components/footer/README.md +73 -0
  20. package/components/footer/footer.njk +61 -0
  21. package/components/footer/footer.scss +170 -0
  22. package/components/footer/logo-with-payoff.njk +3 -0
  23. package/components/icon-button/README.md +1 -1
  24. package/components/icon-button/icon-button.njk +11 -0
  25. package/components/icon-button/icon-button.scss +21 -16
  26. package/components/list-item/README-accordion.md +0 -1
  27. package/components/list-item/README-checkbox.md +0 -1
  28. package/components/list-item/README-radio.md +0 -1
  29. package/components/list-item/README-switch.md +0 -1
  30. package/components/list-item/README.md +0 -1
  31. package/components/list-item/list-item.njk +3 -8
  32. package/components/list-item/list-item.scss +14 -22
  33. package/components/radio-button/README.md +12 -8
  34. package/components/radio-button/radio-button.njk +34 -32
  35. package/components/radio-button/radio-button.scss +38 -17
  36. package/components/spinner/README.md +1 -1
  37. package/components/spinner/spinner.scss +24 -10
  38. package/components/switch/switch.scss +11 -11
  39. package/components/text-button/README.md +1 -1
  40. package/components/text-button/text-button.njk +21 -2
  41. package/components/text-button/text-button.scss +15 -10
  42. package/components/text-button-toggle/README.md +50 -0
  43. package/components/text-button-toggle/text-button-toggle.js +9 -0
  44. package/components/text-button-toggle/text-button-toggle.njk +51 -0
  45. package/components/text-button-toggle/text-button-toggle.scss +131 -0
  46. package/components/text-input/README.md +2 -2
  47. package/components/text-input/text-input.scss +10 -10
  48. package/foundations/colors.scss +6 -3
  49. package/foundations/helpers/README-links.md +23 -0
  50. package/foundations/helpers/colors.scss +1 -1
  51. package/foundations/helpers/fontDefinitionsHelper.scss +32 -0
  52. package/foundations/helpers/links.scss +27 -0
  53. package/foundations/helpers/loading.scss +21 -0
  54. package/foundations/helpers/typography.scss +8 -6
  55. package/foundations/shadows.scss +6 -3
  56. package/foundations/typography/fontDefinitions.scss +287 -0
  57. package/foundations/variables/colorsCssVariables.scss +56 -0
  58. package/foundations/variables/colorsDnDarkTokens.scss +9 -6
  59. package/foundations/variables/colorsDnLightTokens.scss +4 -1
  60. package/foundations/variables/shadowsDnDarkTokens.scss +3 -3
  61. package/foundations/variables/spacingLayout.scss +8 -0
  62. package/foundations/variables/typographyTokensScreenLarge.scss +40 -39
  63. package/foundations/variables/typographyTokensScreenSmall.scss +42 -40
  64. package/package.json +1 -1
  65. package/tokens/colors-css-variables.json +58 -0
  66. package/foundations/variables/colorsTokensList.scss +0 -53
package/CHANGELOG.md CHANGED
@@ -3,6 +3,211 @@
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
+ ## [1.0.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.30...@bonniernews/dn-design-system-web@1.0.0) (2023-01-20)
7
+
8
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.0.0-alpha.30](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.29...@bonniernews/dn-design-system-web@1.0.0-alpha.30) (2023-01-20)
15
+
16
+
17
+ ### ⚠ BREAKING CHANGES
18
+
19
+ * **web:** include var in color tokens (#579)
20
+
21
+ ### Code Refactoring
22
+
23
+ * **web:** include var in color tokens ([#579](https://github.com/BonnierNews/dn-design-system/issues/579)) ([07403d4](https://github.com/BonnierNews/dn-design-system/commit/07403d478b9f685604da1a0308affa0c511dfba5))
24
+
25
+
26
+
27
+ ## [1.0.0-alpha.29](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.28...@bonniernews/dn-design-system-web@1.0.0-alpha.29) (2023-01-20)
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * **web:** specify icon button styling in input fields ([#580](https://github.com/BonnierNews/dn-design-system/issues/580)) ([382f4d6](https://github.com/BonnierNews/dn-design-system/commit/382f4d62f29501e776cb1499e436314097e4de68))
33
+
34
+
35
+
36
+ ## [1.0.0-alpha.28](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.27...@bonniernews/dn-design-system-web@1.0.0-alpha.28) (2023-01-19)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **web:** inner wrapper and tiny redesign for footer ([#578](https://github.com/BonnierNews/dn-design-system/issues/578)) ([1ca4def](https://github.com/BonnierNews/dn-design-system/commit/1ca4def2453ea26403b16f68e60d866e2048c447))
42
+
43
+
44
+
45
+ ## [1.0.0-alpha.27](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.26...@bonniernews/dn-design-system-web@1.0.0-alpha.27) (2023-01-18)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * **web:** attributes parameter for link groups in footer ([#577](https://github.com/BonnierNews/dn-design-system/issues/577)) ([79d5e61](https://github.com/BonnierNews/dn-design-system/commit/79d5e6116dfa9772cda1fe1c4dc2751a75d26086))
51
+
52
+
53
+
54
+ ## [1.0.0-alpha.26](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.25...@bonniernews/dn-design-system-web@1.0.0-alpha.26) (2023-01-18)
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * **web:** add class to footer links ([#575](https://github.com/BonnierNews/dn-design-system/issues/575)) ([52be5a4](https://github.com/BonnierNews/dn-design-system/commit/52be5a4b6698bd53080a7b797beaef72902bdd3d))
60
+
61
+
62
+
63
+ ## [1.0.0-alpha.25](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.24...@bonniernews/dn-design-system-web@1.0.0-alpha.25) (2023-01-18)
64
+
65
+
66
+ ### Features
67
+
68
+ * **web:** footer component ([#572](https://github.com/BonnierNews/dn-design-system/issues/572)) ([164ef30](https://github.com/BonnierNews/dn-design-system/commit/164ef30b70bed3400371c84e346a6cf6f35dcf7c))
69
+
70
+
71
+
72
+ ## [1.0.0-alpha.24](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.23...@bonniernews/dn-design-system-web@1.0.0-alpha.24) (2023-01-18)
73
+
74
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
75
+
76
+
77
+
78
+
79
+
80
+ ## [1.0.0-alpha.23](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.22...@bonniernews/dn-design-system-web@1.0.0-alpha.23) (2023-01-17)
81
+
82
+
83
+ ### Bug Fixes
84
+
85
+ * **web:** add ds-dark and ds-light for color switching ([#571](https://github.com/BonnierNews/dn-design-system/issues/571)) ([3828761](https://github.com/BonnierNews/dn-design-system/commit/3828761c2835f189e431da0bb9017f811fa1d7cf))
86
+
87
+
88
+
89
+ ## [1.0.0-alpha.22](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.21...@bonniernews/dn-design-system-web@1.0.0-alpha.22) (2023-01-16)
90
+
91
+
92
+ ### Features
93
+
94
+ * **web:** buddy menu ([#549](https://github.com/BonnierNews/dn-design-system/issues/549)) ([d0230ee](https://github.com/BonnierNews/dn-design-system/commit/d0230eec5b97fd04247035230471293ff72a3619))
95
+
96
+
97
+
98
+ ## [1.0.0-alpha.21](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.20...@bonniernews/dn-design-system-web@1.0.0-alpha.21) (2023-01-13)
99
+
100
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
101
+
102
+
103
+
104
+
105
+
106
+ ## 1.0.0-alpha.20 (2023-01-13)
107
+
108
+
109
+ ### Features
110
+
111
+ * **web:** helper for link styling ([#563](https://github.com/BonnierNews/dn-design-system/issues/563)) ([0895152](https://github.com/BonnierNews/dn-design-system/commit/0895152a9f9aa1e23b6ff9fbbea2a87f1f62f1eb))
112
+
113
+
114
+
115
+ ## 1.0.0-alpha.19 (2023-01-12)
116
+
117
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
118
+
119
+
120
+
121
+
122
+
123
+ ## [1.0.0-alpha.18](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.17...@bonniernews/dn-design-system-web@1.0.0-alpha.18) (2023-01-12)
124
+
125
+
126
+ ### Bug Fixes
127
+
128
+ * **web:** adjust font weight for variable font ([#551](https://github.com/BonnierNews/dn-design-system/issues/551)) ([019e691](https://github.com/BonnierNews/dn-design-system/commit/019e6917d9826644d7f8112272a81093e348ed1a))
129
+
130
+
131
+
132
+ ## [1.0.0-alpha.17](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.16...@bonniernews/dn-design-system-web@1.0.0-alpha.17) (2023-01-11)
133
+
134
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
135
+
136
+
137
+
138
+
139
+
140
+ ## [1.0.0-alpha.16](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.15...@bonniernews/dn-design-system-web@1.0.0-alpha.16) (2023-01-05)
141
+
142
+
143
+ ### Bug Fixes
144
+
145
+ * **web:** remove large container variants of list items ([#548](https://github.com/BonnierNews/dn-design-system/issues/548)) ([bf699c9](https://github.com/BonnierNews/dn-design-system/commit/bf699c92a9cca51dc1f662b95047c58954d0f058))
146
+
147
+
148
+
149
+ ## 1.0.0-alpha.15 (2023-01-05)
150
+
151
+
152
+ ### Bug Fixes
153
+
154
+ * **web:** update tests to include checkbox radio ([#546](https://github.com/BonnierNews/dn-design-system/issues/546)) ([bed3718](https://github.com/BonnierNews/dn-design-system/commit/bed3718fa6d9074294e5665af80e204d9ca5dee2))
155
+
156
+
157
+
158
+ ## [1.0.0-alpha.14](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.13...@bonniernews/dn-design-system-web@1.0.0-alpha.14) (2023-01-04)
159
+
160
+
161
+ ### Bug Fixes
162
+
163
+ * **web:** update radiobuttons can have attribues on each radiobutton ([#543](https://github.com/BonnierNews/dn-design-system/issues/543)) ([be47d7f](https://github.com/BonnierNews/dn-design-system/commit/be47d7fbe2fca6d70935cff1640a8627b45ff99d))
164
+
165
+
166
+
167
+ ## [1.0.0-alpha.13](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.12...@bonniernews/dn-design-system-web@1.0.0-alpha.13) (2023-01-04)
168
+
169
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
170
+
171
+
172
+
173
+
174
+
175
+ ## 1.0.0-alpha.12 (2023-01-04)
176
+
177
+
178
+ ### Features
179
+
180
+ * **web:** toggle buttons for standard and text buttons ([#535](https://github.com/BonnierNews/dn-design-system/issues/535)) ([216e51e](https://github.com/BonnierNews/dn-design-system/commit/216e51edc0aa1cef80d8b25b00da7f0c1139a428))
181
+
182
+
183
+
184
+ ## 1.0.0-alpha.11 (2023-01-02)
185
+
186
+
187
+ ### Bug Fixes
188
+
189
+ * **web:** wrap checkbox and radiobutton in form-field ([#458](https://github.com/BonnierNews/dn-design-system/issues/458)) ([18169ed](https://github.com/BonnierNews/dn-design-system/commit/18169edc295dc9ec7c92b690e98d306b0903bdbb))
190
+
191
+
192
+
193
+ ## [1.0.0-alpha.10](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.9...@bonniernews/dn-design-system-web@1.0.0-alpha.10) (2022-12-23)
194
+
195
+
196
+ ### Features
197
+
198
+ * **web:** add static white filled and outline button ([#534](https://github.com/BonnierNews/dn-design-system/issues/534)) ([d50c4f3](https://github.com/BonnierNews/dn-design-system/commit/d50c4f37a5ca429168a28416d05b38dd7cf4847f))
199
+
200
+
201
+
202
+ ## [1.0.0-alpha.9](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.8...@bonniernews/dn-design-system-web@1.0.0-alpha.9) (2022-12-22)
203
+
204
+
205
+ ### Bug Fixes
206
+
207
+ * **web:** add spinner to buttons ([#530](https://github.com/BonnierNews/dn-design-system/issues/530)) ([945a08d](https://github.com/BonnierNews/dn-design-system/commit/945a08d957ae794dc29dc15806849de807b979c3))
208
+
209
+
210
+
6
211
  ## [1.0.0-alpha.8](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@1.0.0-alpha.7...@bonniernews/dn-design-system-web@1.0.0-alpha.8) (2022-12-21)
7
212
 
8
213
 
@@ -8,10 +8,12 @@
8
8
 
9
9
  <div class="ds-form-field {{ wrapperClasses | join(" ") }} {{ classes | join(" ") }} {{"hidden" if params.type == "hidden" }}">
10
10
  {{ caller() if caller }}
11
- <div class="ds-form-field__error-message js-field-error">
12
- {{ Icon({ icon: "info-filled" }) }}
13
- <span>{{ params.errorMessage | safe }}</span>
14
- </div>
11
+ {% if params.errorMessage %}
12
+ <div class="ds-form-field__error-message js-field-error">
13
+ {{ Icon({ icon: "info-filled" }) }}
14
+ <span>{{ params.errorMessage | safe }}</span>
15
+ </div>
16
+ {% endif %}
15
17
  {% if params.helpText or params.helpHtml %}
16
18
  <p class="ds-form-field__help-text">{{ params.helpHtml | safe if params.helpHtml else params.helpText }}</p>
17
19
  {% endif %}
@@ -9,7 +9,7 @@ $ds-form-field__error-icon-size: 20px;
9
9
  .ds-form-field__help-text {
10
10
  margin-top: ds-spacing-component(x2);
11
11
  margin-bottom: 0;
12
- color: var($ds-color-text-primary-02);
12
+ color: $ds-color-text-primary-02;
13
13
  @include ds-typography($ds-typography-functional-body01regular);
14
14
  }
15
15
 
@@ -27,8 +27,9 @@ $ds-form-field__error-icon-size: 20px;
27
27
  height: ds-px-to-rem($ds-form-field__error-icon-size);
28
28
  width: ds-px-to-rem($ds-form-field__error-icon-size);
29
29
  line-height: 0;
30
+ flex-shrink: 0;
30
31
  svg {
31
- fill: var($ds-color-icon-critical);
32
+ fill: $ds-color-icon-critical;
32
33
  }
33
34
  }
34
35
  span {
@@ -12,9 +12,9 @@ $ds-badge__min-size: 8px;
12
12
 
13
13
  .ds-badge__inner {
14
14
  @include ds-typography($ds-typography-functional-meta02medium);
15
- color: var($ds-color-static-white);
16
- background-color: var($ds-color-component-brand);
17
- border: var($ds-color-border-secondary) ds-metrics-border-width(x2) solid;
15
+ color: $ds-color-static-white;
16
+ background-color: $ds-color-component-brand;
17
+ border: $ds-color-border-secondary ds-metrics-border-width(x2) solid;
18
18
  border-radius: 100px;
19
19
  display: inline-flex;
20
20
  align-items: center;
@@ -0,0 +1,63 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/buddy-menu](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/buddy-menu)
2
+ - Storybook: [BuddyMenu > Web](https://designsystem.dn.se/?path=/story/components-web-buddymenu-web--buddy-menu)
3
+
4
+ ----
5
+
6
+ # BuddyMenu
7
+
8
+ ## Parameters
9
+
10
+ |parameter | type | required | options | default | description |
11
+ |:--- | :--- | :--- | :--- | :--- | :--- |
12
+ |name | String | no | | none | Should be populated with product specific js|
13
+ |links | HTML String | no | | | Should be list item components|
14
+ |accountLevel | String | no | | none | Should be populated with product specific js|
15
+ |myAccountUrl | String | yes | | | Url for "Mitt konto" button |
16
+ |addons | Array > Object | no | | | Ex. [{ title: 'Annonsfri', href: "https://kund.dn.se/faq/Annonsfritt/" }] |
17
+ |attributes | Object | no | | | Ex. { "data-test": "lorem ipsum" } |
18
+ |classNames | String | no | | | Ex. "my-special-class" |
19
+ |forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size
20
+
21
+ ## Minimum requirement example
22
+
23
+ ### Nunjucks
24
+
25
+ These are copy paste friendly examples to quickliy get started using a component.
26
+
27
+ ```html
28
+ {% from '@bonniernews/dn-design-system-web/components/buddy-menu/buddy-menu.njk' import BuddyMenu %}
29
+
30
+ {% macro BuddyMenuSample() %}
31
+ {{ ListItem({
32
+ title: 'Följer (ämnen och skribenter)',
33
+ leadingIcon: 'favorite',
34
+ border: true,
35
+ listItemType: "standard",
36
+ forcePx: true,
37
+ href: "https://www.dn.se/foljer/"
38
+ })}}
39
+ {{ ListItem({
40
+ title: 'Logga ut',
41
+ leadingIcon: 'logout',
42
+ border: false,
43
+ listItemType: "standard",
44
+ forcePx: true,
45
+ href: params.urls.logOut | default('#'),
46
+ classNames: "js-buddy-menu__logout"
47
+ })}}
48
+ {% endmacro %}
49
+
50
+ {{ BuddyMenu({
51
+ name: "",
52
+ accountLevel: "",
53
+ myAccountUrl: "https://kund.dn.se/mitt-konto",
54
+ links: BuddyMenuSample(),
55
+ addons: [{ title: 'Annonsfri', href: "https://kund.dn.se/faq/Annonsfritt/" }],
56
+ forcePx: true
57
+ })}}
58
+ ```
59
+
60
+ ### SCSS
61
+ ```scss
62
+ @use "@bonniernews/dn-design-system-web/components/buddy-menu/buddy-menu" as *;
63
+ ```
@@ -0,0 +1,77 @@
1
+ {% from '@bonniernews/dn-design-system-web/components/list-item/list-item.njk' import ListItem %}
2
+ {% from '@bonniernews/dn-design-system-web/components/icon-button/icon-button.njk' import IconButton %}
3
+ {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
4
+
5
+ {% macro BuddyMenu(params) %}
6
+ {% set componentClassName = "ds-buddy-menu" %}
7
+ {% set classNamePrefix = componentClassName + "--" %}
8
+ {% set variant = [] %}
9
+ {% set attributes %}
10
+ {% for attribute, value in params.attributes %}
11
+ {{attribute}}="{{value}}"
12
+ {% endfor %}
13
+ {% endset %}
14
+
15
+ {% if params.forcePx %}
16
+ {% set variant = (variant.push("ds-force-px"), variant) %}
17
+ {% endif %}
18
+
19
+ {% if params.classNames %}
20
+ {% set variant = (variant.push(params.classNames), variant) %}
21
+ {% endif%}
22
+
23
+ {% set classes = componentClassName + " " + variant | join(" ") %}
24
+
25
+ <div class="{{ classes }} {{ 'ds-buddy-menu--skola' if params.isDnSkola }}" {{- attributes | safe}}>
26
+ <div class="ds-buddy-menu__scrollable-container">
27
+ <div class="ds-buddy-menu__content">
28
+ {{ IconButton({
29
+ variant: "transparent",
30
+ size: "small",
31
+ iconName: "close",
32
+ classNames: "ds-buddy-menu__close",
33
+ forcePx: params.forcePx
34
+ })}}
35
+
36
+ {%- if params.isDnSkola %}
37
+ {# @todo add support for skola users #}
38
+ {%- else %}
39
+ <div class="ds-buddy-menu__header">
40
+ <span class="ds-buddy-menu__greeting">Hej <span class="ds-buddy-menu__name js-buddy-menu-name" data-name-type="given">{{ params.name }}</span>!</span>
41
+ <div class="ds-buddy-menu__account">
42
+ <h2 class="ds-buddy-menu__account-title">Min prenumeration</h2>
43
+ <span class="ds-buddy-menu__account-level js-buddy-menu__account-level">{{ params.accountLevel }}</span>
44
+
45
+ {% if params.addons %}
46
+ <h2 class="ds-buddy-menu__addons-title">Mina tillägg</h2>
47
+ <ul class="ds-buddy-menu__addons-list">
48
+ {% for addon in params.addons %}
49
+ <li><a href="{{ addon.href }}">{{ addon.title }}</a></li>
50
+ {% endfor %}
51
+ </ul>
52
+ {% endif %}
53
+
54
+ {{ Button({
55
+ text: "Mitt konto",
56
+ variant: "secondaryOutlined",
57
+ fullWidth: true,
58
+ href: params.myAccountUrl | default("#"),
59
+ attributes: { "data-hide-promo" : "" },
60
+ forcePx: params.forcePx
61
+ })}}
62
+ </div>
63
+ </div>
64
+
65
+ {# @todo add support for preniverse container and subscription cta #}
66
+
67
+ <div class="ds-buddy-menu__links">
68
+ <h2 class="ds-buddy-menu__links-title">Mitt innehåll</h2>
69
+ <ul class="ds-buddy-menu__links-list">
70
+ {{ params.links | safe }}
71
+ </ul>
72
+ </div>
73
+ {% endif %}
74
+ </div>
75
+ </div>
76
+ </div>
77
+ {% endmacro %}
@@ -0,0 +1,115 @@
1
+ @use "../../foundations/helpers/spacing.scss" as *;
2
+ @use "../../foundations/helpers/typography.scss" as *;
3
+ @use "../../foundations/helpers/mediaQueries.scss" as *;
4
+ @use "../../foundations/helpers/metrics.scss" as *;
5
+ @use "../../foundations/helpers/utilities.scss" as *;
6
+ @use "../../foundations/helpers/colors.scss" as *;
7
+ @use "../../foundations/helpers/links.scss" as *;
8
+ @use "../button/button.scss" as *;
9
+ @use "../icon-button/icon-button.scss" as *;
10
+ @use "../list-item/list-item.scss" as *;
11
+
12
+ .ds-buddy-menu {
13
+ width: 360px;
14
+ background-color: $ds-color-surface-elevated;
15
+ border-radius: ds-metrics-border-radius(x2);
16
+ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
17
+ position: absolute;
18
+ top: 0;
19
+ right: 0;
20
+ z-index: 1;
21
+
22
+ @include ds-mq-largest-breakpoint(mobile) {
23
+ width: 100vw;
24
+ }
25
+
26
+ &__scrollable-container {
27
+ max-height: calc(100vh - 100px);
28
+ overflow-y: auto;
29
+ /* @todo - should we style scrollbar?
30
+ // Scrollbar styling based on existing styling in arkivet/bang
31
+ &::-webkit-scrollbar {
32
+ width: 8px;
33
+ }
34
+ &::-webkit-scrollbar-thumb {
35
+ border: 1px solid $ds-color-component-primary-overlay;
36
+ background-color: $ds-color-border-primary-02;
37
+ border-radius: ds-metrics-border-radius(x2);
38
+ }
39
+ &::-webkit-scrollbar-track {
40
+ border: 0;
41
+ background-color: $ds-color-component-primary-overlay;
42
+ border-radius: ds-metrics-border-radius(x2);
43
+ }
44
+ */
45
+ }
46
+ &__content {
47
+ position: relative;
48
+ }
49
+ &__header {
50
+ padding: ds-spacing-component(x8 x4 x4);
51
+ margin: ds-spacing-component(0 0 x4);
52
+ }
53
+ &__close {
54
+ position: absolute;
55
+ right: ds-spacing-component(x1);
56
+ top: ds-spacing-component(x1);
57
+ }
58
+ &__greeting {
59
+ @include ds-typography($ds-typography-functional-heading03bold);
60
+ color: $ds-color-text-primary;
61
+ margin: ds-spacing-component(0 0 x4);
62
+ display: block;
63
+ }
64
+ &__account-title,
65
+ &__addons-title,
66
+ &__links-title {
67
+ @include ds-typography($ds-typography-functional-body02medium);
68
+ color: $ds-color-text-primary;
69
+ margin: ds-spacing-component(0 0 x1);
70
+ }
71
+ &__links-title {
72
+ padding: ds-spacing-component(0 x4);
73
+ }
74
+ &__addons-list {
75
+ padding: 0;
76
+ margin: ds-spacing-component(0 0 x4);
77
+ list-style: none;
78
+ a {
79
+ @include ds-typography($ds-typography-functional-body02regular);
80
+ color: $ds-color-text-primary-02;
81
+ margin: ds-spacing-component(0 0 x4);
82
+ @include ds-link($ds-link-list);
83
+ }
84
+ }
85
+ &__account-level {
86
+ @include ds-typography($ds-typography-functional-body02regular);
87
+ color: $ds-color-text-primary-02;
88
+ margin: ds-spacing-component(0 0 x4);
89
+ display: block;
90
+ }
91
+ &__links-list {
92
+ border-bottom-left-radius: ds-metrics-border-radius(x2);
93
+ border-bottom-right-radius: ds-metrics-border-radius(x2);
94
+ overflow: hidden;
95
+ margin: 0;
96
+ padding: 0;
97
+ }
98
+
99
+ &.ds-force-px {
100
+ .ds-buddy-menu__greeting {
101
+ @include ds-typography($ds-typography-functional-heading03bold, true);
102
+ }
103
+ .ds-buddy-menu__account-title,
104
+ .ds-buddy-menu__addons-title,
105
+ .ds-buddy-menu__links-title {
106
+ @include ds-typography($ds-typography-functional-body02medium, true);
107
+ }
108
+ .ds-buddy-menu__addons-list a {
109
+ @include ds-typography($ds-typography-functional-body02regular, true);
110
+ }
111
+ .ds-buddy-menu__account-level {
112
+ @include ds-typography($ds-typography-functional-body02regular, true);
113
+ }
114
+ }
115
+ }
@@ -11,13 +11,13 @@
11
11
  |:--- | :--- | :--- | :--- | :--- | :--- |
12
12
  |text | String | yes | | | |
13
13
  |disabled | bool | no | true, false | false | Note: only works on button-tag, not on a-tag |
14
- |variant | String | no | brand, business, primary, criticalOutlined, secondaryOutlined, SecondaryFilled | primary | Design variant |
14
+ |variant | String | no | brand, business, criticalOutlined, primary, secondaryFilled, secondaryOutlined, staticWhiteFilled, staticWhiteOutlined | primary | Design variant |
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
18
  |iconPosition | String | no | none, left, right | none | |
19
19
  |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
- |~loading~ | bool | no | true, false | false | Not implemented |
20
+ |loading | bool | no | true, false | false | |
21
21
  |type | String | no | button, submit | button | |
22
22
  |href | String | no | | | If href is set the button will be rendered as an a-tag |
23
23
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
@@ -1,4 +1,5 @@
1
1
  {% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
2
+ {% from '@bonniernews/dn-design-system-web/components/spinner/spinner.njk' import Spinner %}
2
3
 
3
4
  {% macro Button(params) %}
4
5
  {% set componentClassName = "ds-btn" %}
@@ -11,14 +12,22 @@
11
12
  {% endfor %}
12
13
  {% endset %}
13
14
 
14
- {% if params.forcePx %}
15
- {% set variant = (variant.push("ds-force-px"), variant) %}
15
+ {% set buttonVariant = params.variant | default("primary") %}
16
+ {% set variant = (variant.push(classNamePrefix + buttonVariant), variant) %}
17
+
18
+ {% set spinnerMap = { primary: "secondary", brand: "onBrand", business: "onBusiness", staticWhiteFilled: "staticBlack", staticWhiteOutlined: "staticWhite" } %}
19
+ {% set spinnerVariant = spinnerMap[buttonVariant] | default("primary") %}
20
+
21
+ {% set loadingHtml %}
22
+ {{ Spinner({ size: 'small', variant: spinnerVariant, forcePx: params.forcePx }) }}
23
+ {% endset %}
24
+
25
+ {% if params.loading %}
26
+ {% set variant = (variant.push("ds-loading"), variant) %}
16
27
  {% endif %}
17
28
 
18
- {% if params.variant %}
19
- {% set variant = (variant.push(classNamePrefix + params.variant), variant) %}
20
- {% else %}
21
- {% set variant = (variant.push(classNamePrefix + "primary"), variant) %}
29
+ {% if params.forcePx %}
30
+ {% set variant = (variant.push("ds-force-px"), variant) %}
22
31
  {% endif %}
23
32
 
24
33
  {% if params.size and params.size != "default" %}
@@ -45,8 +54,18 @@
45
54
  {% set classes = componentClassName + " " + variant | join(" ") %}
46
55
 
47
56
  {% if params.href %}
48
- <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{- attributes | safe}}><div class="{{ componentClassName + '__inner'}}"><span>{{ text }}</span>{{- iconSvg | safe if iconSvg -}}</div></a>
57
+ <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{- attributes | safe}}>
58
+ <div class="{{ componentClassName + '__inner'}}">
59
+ <span>{{ text }}</span>
60
+ {{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
61
+ </div>
62
+ </a>
49
63
  {% else %}
50
- <button type="{{ params.type | default('button') }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe}}><div class="{{ componentClassName + '__inner'}}"><span>{{ text }}</span>{{- iconSvg | safe if iconSvg -}}</div></button>
64
+ <button type="{{ params.type | default('button') }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe}}>
65
+ <div class="{{ componentClassName + '__inner'}}">
66
+ <span>{{ text }}</span>
67
+ {{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
68
+ </div>
69
+ </button>
51
70
  {% endif %}
52
71
  {% endmacro %}