@bonniernews/dn-design-system-web 8.8.8 → 8.9.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
+ ## [8.9.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@8.9.0...@bonniernews/dn-design-system-web@8.9.1) (2023-12-01)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **web:** set width on quiz link box item ([#1130](https://github.com/BonnierNews/dn-design-system/issues/1130)) ([d8893bd](https://github.com/BonnierNews/dn-design-system/commit/d8893bd872db0ca473f4f51cadbb893da8389a48))
13
+
14
+ ## [8.9.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@8.8.8...@bonniernews/dn-design-system-web@8.9.0) (2023-12-01)
15
+
16
+
17
+ ### Features
18
+
19
+ * **web:** tag header component ([#1124](https://github.com/BonnierNews/dn-design-system/issues/1124)) ([8d34353](https://github.com/BonnierNews/dn-design-system/commit/8d3435337daa2713aca2e745da627bc476457705))
20
+
7
21
  ## [8.8.8](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@8.8.7...@bonniernews/dn-design-system-web@8.8.8) (2023-12-01)
8
22
 
9
23
 
@@ -9,7 +9,7 @@
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  align-items: center;
12
- justify-content: center;
12
+ justify-content: flex-start;
13
13
 
14
14
  &:focus-visible {
15
15
  outline: none;
@@ -39,6 +39,12 @@
39
39
  font-size: 0;
40
40
  }
41
41
 
42
+ &.ds-link-box-item--quiz {
43
+ .ds-link-box-item__media {
44
+ width: 48px;
45
+ }
46
+ }
47
+
42
48
  // Just sample css, replace with actual when design is available
43
49
  &.ds-link-box-item--pod {
44
50
  .ds-link-box-item__media {
@@ -17,11 +17,7 @@ $ds-link-box-grid-gap: ds-spacing($ds-s-050);
17
17
  grid-template-columns: 1fr 1fr;
18
18
  }
19
19
 
20
- @include ds-mq-only-breakpoint(tablet) {
21
- grid-template-columns: 1fr 1fr 1fr;
22
- }
23
-
24
- @include ds-mq-only-breakpoint(desktop) {
20
+ @include ds-mq-smallest-breakpoint(tablet) {
25
21
  grid-template-columns: 1fr 1fr 1fr 1fr;
26
22
  }
27
23
  }
@@ -0,0 +1,49 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/tag-header](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/tag-header)
2
+ - Storybook: [TagHeader](https://designsystem.dn.se/?path=/docs/section-Tagheader--docs)
3
+ - Storybook (Latest): [TagHeader](https://designsystem-latest.dn.se/?path=/docs/section-Tagheader--docs)
4
+
5
+ ----
6
+
7
+ # Tag header
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |title | String | yes | | | H1 Title |
14
+ |vignette | String | no | | | Vignette related to title |
15
+ |mediaHtml | String | no | | | Main image |
16
+ |descriptionHtml | String | no | | | Intended use is text, links |
17
+ |toggle | Bool | no | true, false | false | Show/hide toggle button |
18
+ |toggleText | text | no | | | `text` parameter to ToggleButton (only if `toggle` is enabled) |
19
+ |toggleSelectedText | text | no | | | `selectedText` parameter to ToggleButton (only if `toggle` is enabled) |
20
+ |toggleSelected | boolean | no | | | `selected` parameter to ToggleButton (only if `toggle` is enabled) |
21
+ |toggleLoading | boolean | no | | | `loading` parameter to ToggleButton (only if `toggle` is enabled) |
22
+ |toggleClassNames | text | no | | | `classNames` parameter to ToggleButton (only if `toggle` is enabled) |
23
+ |toggleAttributes | text | no | | | `attributes` parameter to ToggleButton (only if `toggle` is enabled) |
24
+ |classNames | String | no | | | Ex. "my-special-class" |
25
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
26
+ |~forcePx~ | | | | | Not supported |
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/tag-header/tag-header.njk' import TagHeader %}
36
+
37
+ {{ TagHeader(
38
+ {
39
+ vignette: "SPEL",
40
+ title: "Quiz",
41
+ descriptionHtml: "<p>Utmana dig själv med smarta quiz av DN:s medarbetare. Välj mellan olika kategorier och svårighetsgrad.</p>"
42
+ }
43
+ )}}
44
+ ```
45
+
46
+ ### SCSS
47
+ ```scss
48
+ @use "@bonniernews/dn-design-system-web/components/tag-header/tag-header" as *;
49
+ ```
@@ -0,0 +1,47 @@
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 TagHeader(params) %}
5
+ {%- set componentClassName = "ds-tag-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
+ {% if params.mediaHtml %}
15
+ <div class="{{ componentClassName + '__media'}}">
16
+ {{ params.mediaHtml | safe }}
17
+ </div>
18
+ {% endif %}
19
+ <div class="{{ componentClassName }}__content">
20
+ <div class="{{ componentClassName }}__bar">
21
+ <div class="{{ componentClassName }}__heading">
22
+ {% if params.vignette %}
23
+ <span class="{{ componentClassName }}__vignette">{{ params.vignette }}</span>
24
+ {% endif %}
25
+ <h1 class="{{ componentClassName }}__title">{{ params.title}}</h1>
26
+ </div>
27
+ {% if params.toggle %}
28
+ {{ ButtonToggle({
29
+ variant: 'brand',
30
+ size: 'small',
31
+ text: params.toggleText,
32
+ selectedText: params.toggleSelectedText,
33
+ selected: params.toggleSelected,
34
+ loading: params.toggleLoading,
35
+ classNames: params.toggleClassNames,
36
+ attributes: params.toggleAttributes
37
+ }) }}
38
+ {% endif %}
39
+ </div>
40
+ {% if params.descriptionHtml %}
41
+ <div class="{{ componentClassName }}__description">
42
+ {{ params.descriptionHtml | safe }}
43
+ </div>
44
+ {% endif %}
45
+ </div>
46
+ </div>
47
+ {% endmacro %}
@@ -0,0 +1,85 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../button-toggle/button-toggle.scss";
3
+ @use "../../components/teaser-image/teaser-image.scss";
4
+
5
+ .ds-tag-header {
6
+ width: 100%;
7
+ background-color: $ds-color-surface-background;
8
+ padding-bottom: ds-spacing($ds-s-100);
9
+ display: flex;
10
+
11
+ @include ds-mq-only-breakpoint(mobile) {
12
+ flex-direction: column;
13
+ }
14
+
15
+ .ds-tag-header__content {
16
+ width: 100%;
17
+ }
18
+
19
+ .ds-tag-header__bar {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ border-bottom: ds-metrics-border-width(x1) solid $ds-color-border-primary;
24
+ padding-bottom: ds-spacing($ds-s-100);
25
+ margin: ds-spacing($ds-s-100 $ds-s-100 0);
26
+
27
+ .ds-btn-toggle {
28
+ flex-shrink: 0;
29
+ margin-left: ds-spacing($ds-s-100);
30
+ }
31
+ }
32
+
33
+ .ds-tag-header__heading {
34
+ margin: 0;
35
+ }
36
+
37
+ .ds-tag-header__vignette {
38
+ @include ds-typography($ds-typography-functional-meta02bold);
39
+ color: $ds-color-text-brand;
40
+ margin-bottom: ds-spacing($ds-s-025);
41
+ }
42
+
43
+ .ds-tag-header__title {
44
+ @include ds-typography($ds-typography-functional-heading03bold);
45
+ color: $ds-color-text-primary;
46
+ margin: 0;
47
+ word-break: break-word;
48
+ }
49
+
50
+ .ds-tag-header__media {
51
+ @include ds-mq-smallest-breakpoint(tablet) {
52
+ flex-shrink: 0;
53
+ width: 256px;
54
+ max-width: 40%;
55
+ margin: ds-spacing($ds-s-100 0 0 $ds-s-100);
56
+ }
57
+ }
58
+
59
+ .ds-tag-header__description {
60
+ @include ds-typography($ds-typography-functional-body02regular);
61
+ color: $ds-color-text-primary;
62
+ margin: ds-spacing($ds-s-100 $ds-s-100 0);
63
+
64
+ a {
65
+ @include ds-link($ds-link-article-body);
66
+ }
67
+
68
+ b,
69
+ strong {
70
+ @include ds-typography($ds-typography-functional-body02semibold);
71
+ }
72
+
73
+ p {
74
+ margin: ds-spacing($ds-s-100 0);
75
+ }
76
+
77
+ p:first-child {
78
+ margin-top: 0;
79
+ }
80
+
81
+ p:last-child {
82
+ margin-bottom: 0;
83
+ }
84
+ }
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "8.8.8",
3
+ "version": "8.9.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",