@bonniernews/dn-design-system-web 16.0.7 → 16.1.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
@@ -4,6 +4,20 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
4
4
 
5
5
 
6
6
 
7
+ ## [16.1.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@16.1.0...@bonniernews/dn-design-system-web@16.1.1) (2024-07-16)
8
+
9
+
10
+ ### Maintenance
11
+
12
+ * **web:** use correct metric helpers ([#1338](https://github.com/BonnierNews/dn-design-system/issues/1338)) ([ca0bec0](https://github.com/BonnierNews/dn-design-system/commit/ca0bec05a2c2b272b45600ec5a8a94e35c22ff05))
13
+
14
+ ## [16.1.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@16.0.7...@bonniernews/dn-design-system-web@16.1.0) (2024-07-15)
15
+
16
+
17
+ ### Features
18
+
19
+ * **web:** profile header component ([#1327](https://github.com/BonnierNews/dn-design-system/issues/1327)) ([630c197](https://github.com/BonnierNews/dn-design-system/commit/630c197032cfd14a558b29788b419733fc5c5fc4))
20
+
7
21
  ## [16.0.7](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@16.0.6...@bonniernews/dn-design-system-web@16.0.7) (2024-07-15)
8
22
 
9
23
 
@@ -10,7 +10,7 @@ $ds-badge__min-size: 8px;
10
10
  @include ds-typography($ds-typography-functionalmeta02, $lineHeight: 0, $fontWeight: $ds-fontweight-semibold);
11
11
  color: $ds-color-static-white;
12
12
  background-color: $ds-color-component-brand;
13
- border: $ds-color-border-secondary ds-metrics-border-width(x2) solid;
13
+ border: $ds-color-border-secondary ds-border-width(x2) solid;
14
14
  border-radius: 100px;
15
15
  display: inline-flex;
16
16
  align-items: center;
@@ -23,7 +23,7 @@ $ds-byline__image-size--direkt: 36px;
23
23
 
24
24
  &::after {
25
25
  content: "";
26
- height: ds-metrics-border-width(x1);
26
+ height: ds-border-width(x1);
27
27
  width: calc(100% - ds-spacing($ds-s-200));
28
28
  background-color: $ds-color-border-primary;
29
29
  position: absolute;
@@ -62,7 +62,7 @@ $ds-byline__image-size--direkt: 36px;
62
62
  text-decoration: none;
63
63
 
64
64
  &:focus-visible {
65
- outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
65
+ outline: ds-border-width(x2) solid $ds-color-border-focus-02;
66
66
  outline-offset: 2px;
67
67
  }
68
68
  }
@@ -174,7 +174,7 @@ $ds-byline__image-size--direkt: 36px;
174
174
  &:focus-visible {
175
175
  outline: none;
176
176
  .ds-byline__inner {
177
- outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
177
+ outline: ds-border-width(x2) solid $ds-color-border-focus-02;
178
178
  outline-offset: -2px;
179
179
  }
180
180
  }
@@ -2,7 +2,7 @@
2
2
  @use "../icon-sprite/icon-sprite.scss";
3
3
 
4
4
  $ds-disclaimer__icon-size: 20px;
5
- $ds-btn-outlined__border-width: ds-metrics-border-width(x1);
5
+ $ds-btn-outlined__border-width: ds-border-width(x1);
6
6
 
7
7
  .ds-disclaimer {
8
8
  padding-bottom: ds-spacing($ds-s-100);
@@ -8,7 +8,7 @@
8
8
  margin: 0 auto;
9
9
  border: none;
10
10
  background-color: $ds-color-border-primary;
11
- height: ds-metrics-border-width(x1);
11
+ height: ds-border-width(x1);
12
12
  width: 100%;
13
13
  }
14
14
  }
@@ -15,14 +15,14 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
15
15
  padding: ds-spacing($ds-s-100 0 $ds-s-200);
16
16
 
17
17
  .ds-factbox__inner {
18
- border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
18
+ border-top: ds-border-width(x1) solid $ds-color-border-primary;
19
19
  border-left: $ds-factbox-border-width solid $ds-theme-color;
20
20
  max-height: ds-px-to-rem($ds-factbox__max-height);
21
21
  overflow: hidden;
22
22
  position: relative;
23
23
  padding: $ds-factbox__padding;
24
24
  padding-left: $ds-factbox__padding-left;
25
- padding-top: $ds-factbox__padding - ds-metrics-border-width(x1);
25
+ padding-top: $ds-factbox__padding - ds-border-width(x1);
26
26
 
27
27
  @at-root .ds-force-px#{&} {
28
28
  max-height: $ds-factbox__max-height;
@@ -37,7 +37,7 @@ $ds-footer-column-gap: ds-spacing($ds-s-400);
37
37
  &__rudolf,
38
38
  &__editors,
39
39
  &__channels {
40
- border-top-width: ds-metrics-border-width(x1);
40
+ border-top-width: ds-border-width(x1);
41
41
  border-top-style: solid;
42
42
  border-color: $ds-color-static-transparent-white-10;
43
43
  }
@@ -50,7 +50,7 @@ $ds-footer-column-gap: ds-spacing($ds-s-400);
50
50
 
51
51
  &__link-grid {
52
52
  border-bottom-style: solid;
53
- border-bottom-width: ds-metrics-border-width(x1);
53
+ border-bottom-width: ds-border-width(x1);
54
54
  border-color: $ds-color-static-transparent-white-10;
55
55
  }
56
56
  }
@@ -16,7 +16,7 @@ $ds-group-header__icon-size: 24px;
16
16
  @include ds-typography($ds-typography-functionalbody02);
17
17
 
18
18
  &--bottom-border {
19
- border-bottom: ds-metrics-border-width(x1) solid $ds-color-border-primary;
19
+ border-bottom: ds-border-width(x1) solid $ds-color-border-primary;
20
20
  }
21
21
 
22
22
  &--bauta {
@@ -110,7 +110,7 @@ $ds-group-header__icon-size: 24px;
110
110
  }
111
111
 
112
112
  &--bottom-border .ds-group-header__title {
113
- padding-bottom: ds-spacing($ds-s-075) - ds-metrics-border-width(x1);
113
+ padding-bottom: ds-spacing($ds-s-075) - ds-border-width(x1);
114
114
  }
115
115
 
116
116
  &--bautaxl .ds-group-header__title {
@@ -153,7 +153,7 @@ $ds-list-item__icon-size: 24px;
153
153
  &:focus-visible {
154
154
  outline: none;
155
155
  .ds-list-item__inner {
156
- outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
156
+ outline: ds-border-width(x2) solid $ds-color-border-focus-02;
157
157
  outline-offset: -2px;
158
158
  }
159
159
  }
@@ -171,7 +171,7 @@ $ds-list-item__icon-size: 24px;
171
171
  &::after,
172
172
  &.ds-list-item--accordion-active + .ds-list-item__accordion-inner::after {
173
173
  content: "";
174
- height: ds-metrics-border-width(x1);
174
+ height: ds-border-width(x1);
175
175
  width: calc(100% - (ds-spacing($ds-s-100) * 2));
176
176
  background-color: $ds-color-border-primary;
177
177
  position: absolute;
File without changes
@@ -0,0 +1,47 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/profile-header](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/profile-header)
2
+ - Storybook: [ProfileHeader](https://designsystem.dn.se/?path=/docs/section-Profileheader--docs)
3
+ - Storybook (Latest): [ProfileHeader](https://designsystem-latest.dn.se/?path=/docs/section-Profileheader--docs)
4
+
5
+ ----
6
+
7
+ # Profile header
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |title | String | yes | | | H1 Title |
14
+ |mediaHtml | String | no | | | Main image |
15
+ |descriptionHtml | String | no | | | Intended use is text, links |
16
+ |toggle | Bool | no | true, false | false | Show/hide toggle button |
17
+ |toggleText | text | no | | | `text` parameter to ToggleButton (only if `toggle` is enabled) |
18
+ |toggleSelectedText | text | no | | | `selectedText` parameter to ToggleButton (only if `toggle` is enabled) |
19
+ |toggleSelected | boolean | no | | | `selected` parameter to ToggleButton (only if `toggle` is enabled) |
20
+ |toggleLoading | boolean | no | | | `loading` parameter to ToggleButton (only if `toggle` is enabled) |
21
+ |toggleClassNames | text | no | | | `classNames` parameter to ToggleButton (only if `toggle` is enabled) |
22
+ |toggleAttributes | text | no | | | `attributes` parameter to ToggleButton (only if `toggle` is enabled) |
23
+ |classNames | String | no | | | Ex. "my-special-class" |
24
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
25
+ |~forcePx~ | | | | | Not supported |
26
+
27
+ ## Minimum requirement example
28
+
29
+ ### Nunjucks
30
+
31
+ These are copy paste friendly examples to quickliy get started using a component.
32
+
33
+ ```html
34
+ {% from '@bonniernews/dn-design-system-web/components/profile-header/profile-header.njk' import ProfileHeader %}
35
+
36
+ {{ ProfileHeader(
37
+ {
38
+ title: "Johan Croneman",
39
+ descriptionHtml: "<p>Johan Croneman är journalist på Dagens Nyheter.</p>"
40
+ }
41
+ )}}
42
+ ```
43
+
44
+ ### SCSS
45
+ ```scss
46
+ @use "@bonniernews/dn-design-system-web/components/profile-header/profile-header" as *;
47
+ ```
@@ -0,0 +1,44 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/button-toggle/button-toggle.njk' import ButtonToggle %}
3
+
4
+ {% macro ProfileHeader(params) %}
5
+ {%- set componentClassName = "ds-profile-header" %}
6
+ {% set attributes = getAttributes(params.attributes) %}
7
+
8
+ {%- set classes = [
9
+ componentClassName,
10
+ params.classNames if params.classNames
11
+ ] | join(" ") %}
12
+
13
+ <div class="{{ classes }}" {{- attributes | safe }}>
14
+ <div class="{{ componentClassName }}__content">
15
+ <div class="{{ componentClassName }}__bar">
16
+ <div class="{{ componentClassName }}__heading">
17
+ <h1 class="{{ componentClassName }}__title">{{ params.title}}</h1>
18
+ {% if params.toggle %}
19
+ {{ ButtonToggle({
20
+ variant: 'brand',
21
+ size: 'medium',
22
+ text: params.toggleText,
23
+ selectedText: params.toggleSelectedText,
24
+ selected: params.toggleSelected,
25
+ loading: params.toggleLoading,
26
+ classNames: params.toggleClassNames,
27
+ attributes: params.toggleAttributes
28
+ }) }}
29
+ {% endif %}
30
+ </div>
31
+ {% if params.mediaHtml %}
32
+ <div class="{{ componentClassName + '__media'}}">
33
+ {{ params.mediaHtml | safe }}
34
+ </div>
35
+ {% endif %}
36
+ </div>
37
+ {% if params.descriptionHtml %}
38
+ <div class="{{ componentClassName }}__description">
39
+ {{ params.descriptionHtml | safe }}
40
+ </div>
41
+ {% endif %}
42
+ </div>
43
+ </div>
44
+ {% endmacro %}
@@ -0,0 +1,74 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../button-toggle/button-toggle.scss";
3
+
4
+ .ds-profile-header {
5
+ width: 100%;
6
+ background-color: $ds-color-surface-background;
7
+ padding: 0;
8
+ display: flex;
9
+
10
+ .ds-profile-header__content {
11
+ width: 100%;
12
+ }
13
+
14
+ .ds-profile-header__bar {
15
+ display: flex;
16
+ align-items: flex-start;
17
+ justify-content: space-between;
18
+ flex-direction: row;
19
+ margin: ds-spacing($ds-s-100 $ds-s-100 0);
20
+
21
+ .ds-btn--toggle {
22
+ flex-shrink: 0;
23
+ margin: ds-spacing($ds-s-100 0 0);
24
+ }
25
+ }
26
+
27
+ .ds-profile-header__heading {
28
+ margin: ds-spacing(0 $ds-s-100 $ds-s-100 0);
29
+ }
30
+
31
+ .ds-profile-header__title {
32
+ @include ds-typography($ds-typography-functionalheading03, $fontWeight: $ds-fontweight-bold);
33
+ color: $ds-color-text-primary;
34
+ margin: 0;
35
+ word-break: break-word;
36
+ }
37
+
38
+ .ds-profile-header__media {
39
+ width: 120px;
40
+ height: 102px;
41
+ overflow: hidden;
42
+ flex-shrink: 0;
43
+ margin: 0;
44
+ }
45
+
46
+ .ds-profile-header__description {
47
+ @include ds-typography($ds-typography-functionalbody02);
48
+ color: $ds-color-text-primary;
49
+ margin: ds-spacing(0 $ds-s-100 0);
50
+ border-top: ds-border-width(x1) solid $ds-color-border-primary;
51
+ padding: ds-spacing($ds-s-100 0);
52
+
53
+ a {
54
+ @include ds-link($ds-link-article-body);
55
+ }
56
+
57
+ b,
58
+ strong {
59
+ @include ds-typography($ds-typography-functionalbody02, $fontWeight: $ds-fontweight-semibold);
60
+ }
61
+
62
+ p {
63
+ margin: ds-spacing($ds-s-100 0);
64
+ }
65
+
66
+ p:first-child {
67
+ margin-top: 0;
68
+ }
69
+
70
+ p:last-child {
71
+ margin-bottom: 0;
72
+ }
73
+ }
74
+ }
@@ -101,7 +101,7 @@ $ds-switch__container-width: 44px;
101
101
  }
102
102
 
103
103
  &:focus-visible + .ds-switch__inner .ds-switch__box {
104
- outline: ds-metrics-border-width(x2) solid $ds-color-border-focus-02;
104
+ outline: ds-border-width(x2) solid $ds-color-border-focus-02;
105
105
  outline-offset: 2px;
106
106
  }
107
107
 
@@ -12,11 +12,6 @@
12
12
  ] | join(" ") %}
13
13
 
14
14
  <div class="{{ classes }}" {{- attributes | safe }}>
15
- {% if params.mediaHtml %}
16
- <div class="{{ componentClassName + '__media'}}">
17
- {{ params.mediaHtml | safe }}
18
- </div>
19
- {% endif %}
20
15
  <div class="{{ componentClassName }}__content">
21
16
  <div class="{{ componentClassName }}__bar">
22
17
  <div class="{{ componentClassName }}__heading">
@@ -28,18 +23,23 @@
28
23
  {% endif %}
29
24
  {% endif %}
30
25
  <h1 class="{{ componentClassName }}__title">{{ params.title}}</h1>
26
+ {% if params.toggle %}
27
+ {{ ButtonToggle({
28
+ variant: 'brand',
29
+ size: 'medium',
30
+ text: params.toggleText,
31
+ selectedText: params.toggleSelectedText,
32
+ selected: params.toggleSelected,
33
+ loading: params.toggleLoading,
34
+ classNames: params.toggleClassNames,
35
+ attributes: params.toggleAttributes
36
+ }) }}
37
+ {% endif %}
31
38
  </div>
32
- {% if params.toggle %}
33
- {{ ButtonToggle({
34
- variant: 'brand',
35
- size: 'medium',
36
- text: params.toggleText,
37
- selectedText: params.toggleSelectedText,
38
- selected: params.toggleSelected,
39
- loading: params.toggleLoading,
40
- classNames: params.toggleClassNames,
41
- attributes: params.toggleAttributes
42
- }) }}
39
+ {% if params.mediaHtml %}
40
+ <div class="{{ componentClassName + '__media'}}">
41
+ {{ params.mediaHtml | safe }}
42
+ </div>
43
43
  {% endif %}
44
44
  </div>
45
45
  {% if params.descriptionHtml %}
@@ -18,18 +18,24 @@
18
18
 
19
19
  .ds-tag-header__bar {
20
20
  display: flex;
21
- align-items: center;
21
+ align-items: flex-start;
22
22
  justify-content: space-between;
23
- margin: ds-spacing($ds-s-100 $ds-s-100 0);
23
+ flex-direction: column-reverse;
24
+ margin: ds-spacing(0 $ds-s-100 0);
25
+
26
+ @include ds-mq-smallest-breakpoint(tablet) {
27
+ flex-direction: row;
28
+ }
24
29
 
25
- .ds-btn-toggle {
30
+ .ds-btn--toggle {
26
31
  flex-shrink: 0;
27
- margin-left: ds-spacing($ds-s-100);
32
+ margin: ds-spacing($ds-s-100 0 0);
28
33
  }
29
34
  }
30
35
 
31
36
  .ds-tag-header__heading {
32
37
  margin: 0;
38
+ margin-top: ds-spacing($ds-s-100);
33
39
  }
34
40
 
35
41
  .ds-tag-header__vignette {
@@ -51,9 +57,14 @@
51
57
  }
52
58
 
53
59
  .ds-tag-header__media {
60
+ @include ds-mq-only-breakpoint(mobile) {
61
+ flex-shrink: 0;
62
+ width: calc(100% + #{ds-spacing($ds-s-100)} * 2);
63
+ margin: 0 -#{ds-spacing($ds-s-100)};
64
+ }
54
65
  @include ds-mq-smallest-breakpoint(tablet) {
55
66
  flex-shrink: 0;
56
- width: 256px;
67
+ width: 196px;
57
68
  max-width: 40%;
58
69
  margin: ds-spacing($ds-s-100 0 0 $ds-s-100);
59
70
  }
@@ -63,7 +74,7 @@
63
74
  @include ds-typography($ds-typography-functionalbody02);
64
75
  color: $ds-color-text-primary;
65
76
  margin: ds-spacing($ds-s-100 $ds-s-100 0);
66
- border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
77
+ border-top: ds-border-width(x1) solid $ds-color-border-primary;
67
78
  padding-top: ds-spacing($ds-s-100);
68
79
 
69
80
  a {
@@ -35,7 +35,7 @@ $ds-teaser-list-vertical-media-icon-size: 20px;
35
35
  top: 0;
36
36
  left: 0;
37
37
  right: 0;
38
- height: ds-metrics-border-width(x1);
38
+ height: ds-border-width(x1);
39
39
  background-color: $ds-color-border-primary;
40
40
  }
41
41
  }
@@ -51,7 +51,7 @@ $ds-teaser-list-vertical-media-icon-size: 20px;
51
51
  content: "";
52
52
  position: absolute;
53
53
  bottom: 0;
54
- height: ds-metrics-border-width(x1);
54
+ height: ds-border-width(x1);
55
55
  width: calc(100% - ds-spacing($ds-s-200));
56
56
  background-color: $ds-color-border-primary;
57
57
  }
@@ -13,7 +13,7 @@
13
13
  > .ds-teaser::after,
14
14
  > .ds-split-container::after {
15
15
  content: "";
16
- height: ds-metrics-border-width(x1);
16
+ height: ds-border-width(x1);
17
17
  background-color: $ds-color-border-primary;
18
18
  position: absolute;
19
19
  display: block;
@@ -12,7 +12,7 @@
12
12
  @at-root .ds-teaser-package > & + & {
13
13
  &:before {
14
14
  content: "";
15
- height: ds-metrics-border-width(x1);
15
+ height: ds-border-width(x1);
16
16
  background-color: $ds-color-border-primary;
17
17
  left: 0;
18
18
  right: 0;
@@ -52,7 +52,7 @@
52
52
  content: "";
53
53
  margin-top: ds-spacing($ds-s-100);
54
54
  padding-top: ds-spacing($ds-s-075);
55
- border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
55
+ border-top: ds-border-width(x1) solid $ds-color-border-primary;
56
56
 
57
57
  @include ds-mq-smallest-breakpoint(tablet) {
58
58
  margin-top: 0;
@@ -24,7 +24,7 @@
24
24
  @mixin ds-focus(
25
25
  $offset: false,
26
26
  $includeSelector: true,
27
- $width: ds-metrics-border-width(x2),
27
+ $width: ds-border-width(x2),
28
28
  $color: $ds-color-border-focus-02
29
29
  ) {
30
30
  @if not $includeSelector {
@@ -41,13 +41,3 @@ $dsBorderWidth: map.get($metrics, "border-width");
41
41
 
42
42
  @return $values;
43
43
  }
44
-
45
- // deprecated
46
- @function ds-metrics-border-radius($units: null) {
47
- @return ds-border-radius($units);
48
- }
49
-
50
- // deprecated
51
- @function ds-metrics-border-width($units: null) {
52
- @return ds-border-width($units);
53
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "16.0.7",
3
+ "version": "16.1.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",