@bonniernews/dn-design-system-web 29.1.0 → 29.1.1-beta.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.
@@ -10,11 +10,11 @@
10
10
 
11
11
  |parameter | type | required | options | default | description |
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
- |vignetteHtml | HTML String | no | | | |
14
- |titleHtml | HTML String | yes | | | |
15
- |bodyHtml | HTML String | yes | | | |
13
+ |titleHighlight | String | no | | | |
14
+ |titleImageHtml | HTML String | no | | | Image |
15
+ |title | String | no | | | |
16
+ |bodyParts| Object | yes | | | Ex. [{ type: "gradeMeter", grade: "two" }, { type: "paragraph", bodyHtml: "<p>Html markup</p>" }, { type: "image", mediaHtml: "<div class='picture'>..</div>", author: "", caption: "", imageType: "bild" }]|
16
17
  |theme | String | no | default, kultur, nyheter | | Design theme |
17
- |grade | String | no | | | zero, one, two, three, four, five, none |
18
18
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
19
19
  |classNames | String | no | | | Ex. "my-special-class" |
20
20
  |forceExpanded | bool | no | true, false | false | Full factbox is shown regardless of height and no control buttons are shown|
@@ -30,11 +30,19 @@ These are copy paste friendly examples to quickliy get started using a component
30
30
  {% from '@bonniernews/dn-design-system-web/components/factbox/factbox.njk' import Factbox %}
31
31
 
32
32
  {{ Factbox({
33
- vignetteHtml: "",
34
- titleHtml: "Drama",
35
- bodyHtml: "<p>”Irrational man”<br />Regi och manus: Woody Allen<br />I rollerna: Joaquin Phoenix, Emma Stone, Parker Posey m fl.<br />Längd: 1 tim 35 min (från 11 år.)</p>",
33
+ titleHighlight: "",
34
+ title: "Drama",
35
+ bodyParts: [
36
+ {
37
+ "type": "gradeMeter",
38
+ "grade": "2",
39
+ },
40
+ {
41
+ "type": "paragraph",
42
+ "bodyHtml": "<p>”Irrational man”<br />Regi och manus: Woody Allen<br />I rollerna: Joaquin Phoenix, Emma Stone, Parker Posey m fl.<br />Längd: 1 tim 35 min (från 11 år.)</p>"
43
+ },
44
+ ],
36
45
  theme: "kultur",
37
- grade: "two",
38
46
  forcePx: true
39
47
  })}}
40
48
  ```
@@ -1,11 +1,11 @@
1
1
  {% from '@bonniernews/dn-design-system-web/foundations/icons/grade-icon.njk' import GetGrade %}
2
+ {% from '@bonniernews/dn-design-system-web/components/article-body-image/article-body-image.njk' import ArticleBodyImage %}
2
3
  {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
3
4
  {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
4
5
 
5
6
  {% macro Factbox(params) %}
6
7
  {% set componentClassName = "ds-factbox" %}
7
8
  {% set classNamePrefix = componentClassName + "--" %}
8
- {% set grade = params.grade | default("") | string %}
9
9
  {% set attributes = getAttributes(params.attributes) %}
10
10
 
11
11
  {%- set classes = [
@@ -19,20 +19,43 @@
19
19
  <div class="{{ classes }}" {{- attributes | safe }}>
20
20
  <div class="{{ componentClassName + '__inner'}}">
21
21
  <div class="{{ componentClassName + '__content'}}">
22
- <h2 class="{{ componentClassName + '__title'}}">
23
- {%- if params.vignetteHtml %}<span class="{{ componentClassName + '__vignette'}}">{{ params.vignetteHtml | safe }}</span>{%- endif %}
24
- {{- params.titleHtml | safe -}}
25
- </h2>
26
- {{ GetGrade({ grade: grade, type: "scale" }) if grade }}
27
- <div class="{{ componentClassName + '__body'}}">{{ params.bodyHtml | safe }}</div>
22
+ {% if params.titleImageHtml %}
23
+ <div class="{{ componentClassName + '__title-image'}}">
24
+ {{ params.titleImageHtml | safe }}
25
+ </div>
26
+ {% endif %}
27
+ {% if params.title or params.titleHighlight %}
28
+ <h2 class="{{ componentClassName + '__title'}}">
29
+ {%- if params.titleHighlight %}<span class="{{ componentClassName + '__title-highlight'}}">{{ params.titleHighlight }}</span>{%- endif %}
30
+ {{- params.title -}}
31
+ </h2>
32
+ {% endif %}
33
+ {% if params.bodyParts.length %}
34
+ <div class="{{ componentClassName + '__body'}}">
35
+ {% for part in params.bodyParts %}
36
+ {% if part.type == "paragraph" %}
37
+ {{ part.bodyHtml | safe }}
38
+ {% elif part.type == "gradeMeter" %}
39
+ {{ GetGrade({ grade: part.grade, type: "scale" }) | safe }}
40
+ {% elif part.type == "image" %}
41
+ {{ ArticleBodyImage({
42
+ imageHtml: part.mediaHtml | safe,
43
+ fullWidth: false,
44
+ imageType: part.imageType,
45
+ caption: part.caption if part.caption else "",
46
+ author: part.author if part.author else ""
47
+ }) }}
48
+ {% endif %}
49
+ {% endfor %}
50
+ </div>
51
+ {% endif %}
28
52
  </div>
29
53
  <div class="{{ componentClassName + '__show-more'}}">
30
54
  {{ Button({
31
55
  text: 'Visa mer',
32
- variant: 'secondaryFilled',
33
- size: 'md',
34
- iconPosition: 'right',
35
- iconName: 'expand_more',
56
+ variant: 'secondaryOutline',
57
+ size: 'sm',
58
+ fullWidth: true,
36
59
  classNames: 'ds-factbox__expand-more',
37
60
  attributes: { "aria-hidden": "true" },
38
61
  mobile: { fullWidth: true },
@@ -40,10 +63,9 @@
40
63
  })}}
41
64
  {{ Button({
42
65
  text: 'Visa mindre',
43
- variant: 'secondaryFilled',
44
- size: 'md',
45
- iconPosition: 'right',
46
- iconName: 'expand_less',
66
+ variant: 'secondaryOutline',
67
+ size: 'sm',
68
+ fullWidth: true,
47
69
  classNames: 'ds-factbox__expand-less',
48
70
  attributes: { "aria-hidden": "true" },
49
71
  mobile: { fullWidth: true },
@@ -4,8 +4,6 @@
4
4
  $ds-factbox__grade-size: 40px;
5
5
  $ds-factbox__show-more-fade-height: 48px;
6
6
  $ds-factbox__padding: ds-spacing($ds-s-100);
7
- $ds-factbox-border-width: 4px;
8
- $ds-factbox__padding-left: $ds-factbox__padding - $ds-factbox-border-width;
9
7
  $ds-factbox__max-height: 500px; // includes top/bottom spacing
10
8
 
11
9
  .ds-factbox {
@@ -15,14 +13,12 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
15
13
  padding: ds-spacing($ds-s-100 0 $ds-s-200);
16
14
 
17
15
  .ds-factbox__inner {
18
- border-top: ds-border-width(xxs) solid $ds-color-border-primary;
19
- border-left: $ds-factbox-border-width solid $ds-theme-color;
16
+ border: ds-border-width(xxs) solid $ds-color-border-primary;
17
+ border-radius: ds-border-radius(050);
20
18
  max-height: ds-px-to-rem($ds-factbox__max-height);
21
19
  overflow: hidden;
22
20
  position: relative;
23
21
  padding: $ds-factbox__padding;
24
- padding-left: $ds-factbox__padding-left;
25
- padding-top: $ds-factbox__padding - ds-border-width(xxs);
26
22
 
27
23
  @at-root .ds-force-px#{&} {
28
24
  max-height: $ds-factbox__max-height;
@@ -34,6 +30,17 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
34
30
  max-height: none;
35
31
  }
36
32
 
33
+ .ds-factbox__title-image {
34
+ margin: ds-spacing(0 0 $ds-s-100);
35
+ }
36
+ .ds-factbox__title-image,
37
+ .ds-article-image {
38
+ border-radius: ds-border-radius(012);
39
+ overflow: hidden;
40
+ }
41
+ img {
42
+ max-width: 100%;
43
+ }
37
44
  .ds-factbox__body {
38
45
  overflow: hidden;
39
46
  @include ds-typography($ds-typography-functional-body-md) {
@@ -42,11 +49,14 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
42
49
  @at-root .ds-force-px#{&} {
43
50
  @include ds-typography($ds-typography-functional-body-md, true);
44
51
  }
45
- p {
46
- margin: ds-spacing(0 0 $ds-s-100);
47
- }
48
- p:last-child {
49
- margin-bottom: 0;
52
+ p,
53
+ .ds-article-image,
54
+ .ds-icon--grade {
55
+ margin: ds-spacing(0 0 $ds-s-075);
56
+ padding: 0;
57
+ &:last-child {
58
+ margin-bottom: 0;
59
+ }
50
60
  }
51
61
  a {
52
62
  @include ds-link($ds-link-article-body);
@@ -61,12 +71,9 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
61
71
  @include ds-typography($ds-typography-functional-body-md, $forcePx: true, $fontWeight: $ds-fontweight-semibold);
62
72
  }
63
73
  }
64
- img {
65
- max-width: 100%;
66
- }
67
74
  }
68
75
  .ds-factbox__title {
69
- margin: ds-spacing(0 0 $ds-s-100);
76
+ margin: ds-spacing(0 0 $ds-s-075);
70
77
  @include ds-typography($ds-typography-functional-heading-xxs, $lineHeight: $ds-lineheight-md) {
71
78
  color: $ds-color-text-primary;
72
79
  }
@@ -74,13 +81,12 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
74
81
  @include ds-typography($ds-typography-functional-heading-xxs, $forcePx: true, $lineHeight: $ds-lineheight-md);
75
82
  }
76
83
  }
77
- .ds-factbox__vignette {
84
+ .ds-factbox__title-highlight {
78
85
  color: $ds-theme-color;
79
86
  margin-right: ds-spacing($ds-s-025);
80
87
  }
81
88
  .ds-icon--grade {
82
89
  color: $ds-color-text-primary;
83
- margin: ds-spacing(0 0 $ds-s-100);
84
90
  display: block;
85
91
  height: ds-px-to-rem($ds-factbox__grade-size);
86
92
  svg {
@@ -128,7 +134,7 @@ $ds-factbox__max-height: 500px; // includes top/bottom spacing
128
134
  &:not([data-factbox-expanded]) {
129
135
  position: absolute;
130
136
  bottom: $ds-factbox__padding;
131
- width: calc(100% - ($ds-factbox__padding-left + $ds-factbox__padding));
137
+ width: calc(100% - ($ds-factbox__padding * 2));
132
138
 
133
139
  &::after {
134
140
  content: "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "29.1.0",
3
+ "version": "29.1.1-beta.0",
4
4
  "description": "DN design system for web.",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",