@bonniernews/dn-design-system-web 4.6.1 → 4.7.1

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
@@ -3,6 +3,24 @@
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
+ ## 4.7.1 (2023-09-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **foundations:** update readme to trigger package release ([#1006](https://github.com/BonnierNews/dn-design-system/issues/1006)) ([fa8a99e](https://github.com/BonnierNews/dn-design-system/commit/fa8a99e3dd054a0e0e5263d9cc1ee42faf23795e))
12
+
13
+
14
+
15
+ ## 4.7.0 (2023-09-13)
16
+
17
+
18
+ ### Features
19
+
20
+ * **web:** byline direkt tweaks ([#997](https://github.com/BonnierNews/dn-design-system/issues/997)) ([3302077](https://github.com/BonnierNews/dn-design-system/commit/3302077c8b51ca072b6b93c104fcf8536729ea29))
21
+
22
+
23
+
6
24
  ## 4.6.1 (2023-09-13)
7
25
 
8
26
 
package/README.md CHANGED
@@ -10,4 +10,6 @@ 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
+ Changelog: [https://github.com/BonnierNews/dn-design-system/blob/main/web/src/CHANGELOG.md](https://github.com/BonnierNews/dn-design-system/blob/main/web/src/CHANGELOG.md)
14
+
13
15
  For specific instructions see each component or helper readme
@@ -8,20 +8,19 @@
8
8
 
9
9
  The byline is a list item and should be wrapped in a list.
10
10
 
11
- * If variant:'follow', followable:true AND authorPageUrl are set at the same time, the element will render as a div with an inner `<a>` and a button.
12
- * If variant:'link' and authorpageUrl are set, the outer elment will render as an `<a>`.
11
+ * variant:'follow' can render both a button and a link
13
12
 
14
13
  ## Parameters
15
14
 
16
15
  |parameter | type | required | options | default | description |
17
16
  |:--- | :--- | :--- | :--- | :--- | :--- |
18
- |variant | String | yes | follow, link, compact | | |
17
+ |variant | String | yes | follow, link, direkt | | |
19
18
  |authorName | String | yes | | | |
20
19
  |bylineImage | HTML | no | | | Html image from bang. The component only makes the image round. Scaling is up to the user. Should be 44px for non retina screens. |
21
- |role | String | no | | | Used in variant link and compact |
22
- |email | String | no | | | email will be displayed instead of role for variant follow |
23
- |authorPageUrl | String | no | | | The whole item (varant link and compact), or the title and subtitle (variant follow) will link to this url |
24
- |followable | Boolean | no | true, false | true | If true the toggle button to follow will be shown when using variant follow. |
20
+ |role | String | no | | | Used in variant:link |
21
+ |email | String | no | | | email will be displayed instead of role for variant:follow |
22
+ |authorPageUrl | String | no | | | For variant:button an inner link can be used in combination with a button, for other variants an outer link is used |
23
+ |followable | Boolean | no | true, false | true | If true the toggle button to follow will be shown when using variant:follow. |
25
24
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
26
25
  |elementAttributes | Object | no | | | Sets attributes on actual toggle element and not byline list item. Same structure as attributes above, for accessability reasons it's important to send in "aria-label": "Följ " + byline.name |
27
26
  |classNames | String | no | | | Ex. "my-special-class" |
@@ -8,7 +8,7 @@
8
8
  {% call BylineInner(params, componentClassName) %}
9
9
  <div class="{{ componentClassName + '__inner'}}">
10
10
  {% set componentClassName = componentClassName %}
11
- {% call BylineContent(params, visualVariant, componentClassName ) %}
11
+ {% call BylineContent(params, componentClassName ) %}
12
12
  {% if params.bylineImage %}
13
13
  <span class="{{ componentClassName + '__image'}}">{{- params.bylineImage | safe -}}</span>
14
14
  {% endif %}
@@ -21,10 +21,9 @@
21
21
  {% endif %}
22
22
  </div>
23
23
  {% endcall %}
24
- {% if visualVariant == 'icon' %}
24
+ {% if useArrowIcon %}
25
25
  <span class="{{ componentClassName + '__icon-right'}}">{{- IconUse({ icon: 'arrow_forward' }) | safe -}}</span>
26
- {% endif %}
27
- {% if visualVariant == 'button' and params.followable %}
26
+ {% elif useFollowButton %}
28
27
  {{ ButtonToggle({
29
28
  text: "Följ",
30
29
  selectedText: "Följer",
@@ -42,9 +41,17 @@
42
41
  {% endmacro %}
43
42
 
44
43
  {# 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 %}
44
+ {% macro BylineContent(params, componentClassName) %}
45
+ {% if params.variant == 'link' %}
46
+ {% set subtitle = params.role %}
47
+ {% elif params.variant == 'follow' %}
48
+ {% set subtitle = params.email %}
49
+ {% elif params.variant == 'direkt' %}
50
+ {% set subtitle = false %}
51
+ {% endif %}
52
+
53
+ {# This inner link can exist in combination with a button. It's been decided that it should only be used for authorPageUrls, not for email #}
54
+ {% if useOuterAnchorElement and params.authorPageUrl %}
48
55
  <a href="{{params.authorPageUrl}}" aria-label="Läs mer från: {{ params.authorName }}" class="{{ componentClassName + '__content-wrapper'}}">
49
56
  {{ caller() if caller }}
50
57
  </a>
@@ -60,7 +67,10 @@
60
67
  {% set classNamePrefix = componentClassName + "--" %}
61
68
  {% set variant = [] %}
62
69
  {% set attributes = getAttributes(params.attributes) %}
63
- {% set visualVariant = "icon" if (params.variant == 'link' or params.variant == 'compact' or params.followable != true) and params.authorPageUrl else "button" %}
70
+
71
+ {% set useOuterAnchorElement = true if (params.authorPageUrl and not params.followable) %}
72
+ {% set useArrowIcon = true if (useOuterAnchorElement and params.variant !== 'direkt') %}
73
+ {% set useFollowButton = true if (params.variant == 'follow' and params.followable) %}
64
74
 
65
75
  {% if params.forcePx %}
66
76
  {% set variant = (variant.push("ds-force-px"), variant) %}
@@ -85,7 +95,7 @@
85
95
  {% set elementClassNames = (elementClassNames.push(params.elementClassNames), elementClassNames) %}
86
96
  {% endif %}
87
97
 
88
- {% if visualVariant == 'icon' %}
98
+ {% if useOuterAnchorElement %}
89
99
  <a href="{{ params.authorPageUrl }}" aria-label="Läs mer från: {{ params.authorName }}" class="{{ classes }}" {{- attributes | safe }}>
90
100
  {{ caller() if caller }}
91
101
  </a>
@@ -4,7 +4,7 @@
4
4
 
5
5
  $ds-byline__icon-size: 24px;
6
6
  $ds-byline__image-size: 44px;
7
- $ds-byline__image-size--compact: 36px;
7
+ $ds-byline__image-size--direkt: 36px;
8
8
 
9
9
  .ds-byline__outer {
10
10
  list-style: none;
@@ -143,19 +143,24 @@ $ds-byline__image-size--compact: 36px;
143
143
  }
144
144
  }
145
145
 
146
- &.ds-byline--compact {
146
+ &.ds-byline--direkt {
147
147
  .ds-byline__titles {
148
148
  .ds-byline__subtitle {
149
149
  line-height: ds-spacing-component($ds-sc-x4);
150
150
  }
151
151
  }
152
152
  .ds-byline__image {
153
- height: $ds-byline__image-size--compact;
154
- width: $ds-byline__image-size--compact;
153
+ height: $ds-byline__image-size--direkt;
154
+ width: $ds-byline__image-size--direkt;
155
155
  }
156
156
 
157
157
  .ds-byline__btn-toggle {
158
- min-height: $ds-byline__image-size--compact;
158
+ min-height: $ds-byline__image-size--direkt;
159
+ }
160
+
161
+ .ds-byline__inner {
162
+ padding-top: ds-spacing-component($ds-sc-x3);
163
+ padding-bottom: ds-spacing-component($ds-sc-x3);
159
164
  }
160
165
  }
161
166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "4.6.1",
3
+ "version": "4.7.1",
4
4
  "description": "DN design system for web.",
5
5
  "main": "index.js",
6
6
  "homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",