@bonniernews/dn-design-system-web 16.0.7 → 16.1.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
4
4
 
5
5
 
6
6
 
7
+ ## [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)
8
+
9
+
10
+ ### Features
11
+
12
+ * **web:** profile header component ([#1327](https://github.com/BonnierNews/dn-design-system/issues/1327)) ([630c197](https://github.com/BonnierNews/dn-design-system/commit/630c197032cfd14a558b29788b419733fc5c5fc4))
13
+
7
14
  ## [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
15
 
9
16
 
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-metrics-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
+ }
@@ -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
  }
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.0",
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",