@bonniernews/dn-design-system-web 29.0.1 → 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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ All changes to @bonniernews/dn-design-system-web will be documented in this file
4
4
 
5
5
 
6
6
 
7
+ ## [29.1.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@29.0.1...@bonniernews/dn-design-system-web@29.1.0) (2025-02-20)
8
+
9
+
10
+ ### Features
11
+
12
+ * **app:** pill design updates ([#1625](https://github.com/BonnierNews/dn-design-system/issues/1625)) ([b8b9bbf](https://github.com/BonnierNews/dn-design-system/commit/b8b9bbfd4c88502b6b8a09a1e8f2c56b5af91cc4))
13
+ * **web:** remove vip badge ([#1624](https://github.com/BonnierNews/dn-design-system/issues/1624)) ([aac7e6d](https://github.com/BonnierNews/dn-design-system/commit/aac7e6d5dbffb764bb04a013de68f96114e43457))
14
+
15
+
16
+ ### Maintenance
17
+
18
+ * **deps:** bump @storybook/addon-react-native-web from 0.0.26 to 0.0.27 ([#1610](https://github.com/BonnierNews/dn-design-system/issues/1610)) ([48d5745](https://github.com/BonnierNews/dn-design-system/commit/48d5745614d69e8033e5700ac14981eed3eaf358))
19
+ * prerelease packages ([9944780](https://github.com/BonnierNews/dn-design-system/commit/9944780246dedc02db91c00fd4ed8f8d98f7e9c8))
20
+ * prerelease packages ([81cddbc](https://github.com/BonnierNews/dn-design-system/commit/81cddbca67a0298c7b912499852d50b51ae284f7))
21
+
7
22
  ## [29.0.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@29.0.0...@bonniernews/dn-design-system-web@29.0.1) (2025-02-17)
8
23
 
9
24
 
@@ -1,6 +1,5 @@
1
1
  @use "../../foundations/helpers/forward.helpers.scss" as *;
2
2
  @use "../../components/icon-sprite/icon-sprite.scss";
3
- @use "../../components/vip-badge/vip-badge.scss";
4
3
  @use "../../components/teaser-image/teaser-image.scss";
5
4
  @use "../../components/teaser-dot/teaser-dot.scss";
6
5
  @use "../../components/teaser-footer/teaser-footer.scss";
@@ -82,19 +81,6 @@ $ds-teaser-standard-image-width-desktop: 196px;
82
81
  }
83
82
  }
84
83
 
85
- .ds-vip-badge {
86
- position: absolute;
87
- top: 0;
88
- right: 0;
89
- z-index: 5;
90
- }
91
-
92
- &.ds-teaser--quote-badge {
93
- .ds-teaser__title {
94
- padding-right: ds-spacing($ds-s-075);
95
- }
96
- }
97
-
98
84
  &--podcast {
99
85
  .ds-teaser__vignette {
100
86
  display: flex;
@@ -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: "";
@@ -6,8 +6,6 @@
6
6
 
7
7
  # teaser-centered
8
8
 
9
- This teaser never has a lock-symbol/vip-badge
10
-
11
9
  ## Parameters
12
10
 
13
11
  |parameter | type | required | options | default | description |
@@ -24,7 +24,6 @@
24
24
  |isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
25
25
  |isLargeHeadline | bool | no | true, false | false | If the headline should be large. Only has an effect if `isItalicHeadline` is true. |
26
26
  |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
27
- |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
28
27
  |publicationTime | string | no | | null | Publication time text. |
29
28
  |duration | string | no | | null | Duration of podcast. |
30
29
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
@@ -1,5 +1,4 @@
1
1
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
2
- {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
2
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
3
  {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
5
4
  {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
@@ -8,7 +7,6 @@
8
7
  {% set componentClassName = "ds-teaser" %}
9
8
  {% set classNamePrefix = componentClassName + "--" %}
10
9
 
11
- {% set isQuoteBadge = params.isLocked and not params.mediaHtml and not params.bylineHtml and params.isItalicHeadline %}
12
10
  {% if params.isItalicHeadline %}
13
11
  {% set italicsClass = "ds-teaser--large-big-italic" if params.isLargeHeadline and params.areaType !== "right" else "ds-teaser--large-italic" %}
14
12
  {% endif %}
@@ -16,7 +14,6 @@
16
14
  {% set extraClasses = [
17
15
  "ds-teaser--large",
18
16
  classNamePrefix + params.variant if params.variant,
19
- classNamePrefix + "quote-badge" if isQuoteBadge,
20
17
  classNamePrefix + 'hide-top-border' if params.mediaHtml,
21
18
  italicsClass if italicsClass,
22
19
  params.classNames if params.classNames
@@ -35,16 +32,7 @@
35
32
  ] | join(" ") %}
36
33
  <div class="{{ mediaClass }}">
37
34
  {{ params.mediaHtml }}
38
- {% if params.isLocked %}
39
- {{ VipBadge({
40
- showText: true
41
- }) }}
42
- {% endif %}
43
35
  </div>
44
- {% elif params.isItalicHeadline and params.isLocked %}
45
- {{ VipBadge({
46
- showText: false
47
- }) }}
48
36
  {% endif %}
49
37
 
50
38
  <div class="{{ componentClassName + '__content'}}">
@@ -14,7 +14,6 @@
14
14
  |targetLink | String | yes | | | Target URL for the teaser |
15
15
  |vignette | String | no | | | Top text in the teaser |
16
16
  |mediaHtml | HTML String | no | | | Main image or other media |
17
- |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
18
17
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
19
18
  |classNames | String | no | | | Ex. "my-special-class" |
20
19
  |~forcePx~ | | | | | Not supported |
@@ -1,5 +1,4 @@
1
1
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
2
- {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
2
 
4
3
  {% macro TeaserLonglife(params) %}
5
4
  {%- set extraClasses = [
@@ -16,11 +15,6 @@
16
15
 
17
16
  {% if params.mediaHtml %}
18
17
  {{ params.mediaHtml }}
19
- {% if params.isLocked %}
20
- {{ VipBadge({
21
- showText: false
22
- }) }}
23
- {% endif %}
24
18
  {% endif %}
25
19
 
26
20
  <div class="ds-teaser__content">
@@ -21,7 +21,6 @@
21
21
  |sticker | String | no | | | Red text before the text |
22
22
  |mediaHtml | HTML String | no | | | Main image or other media |
23
23
  |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
24
- |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
25
24
  |publicationTime | string | no | | null | Publication time text. |
26
25
  |duration | string | no | | null | Duration of podcast. |
27
26
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
@@ -1,6 +1,5 @@
1
1
  {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
2
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
3
- {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
4
3
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
5
4
  {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
6
5
  {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
@@ -29,11 +28,6 @@
29
28
  ] | join(" ") %}
30
29
  <div class="{{ mediaClass }}">
31
30
  {{ params.mediaHtml }}
32
- {% if params.isLocked %}
33
- {{ VipBadge({
34
- showText: false
35
- }) }}
36
- {% endif %}
37
31
  </div>
38
32
  {% endif %}
39
33
 
@@ -23,7 +23,6 @@
23
23
  |isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
24
24
  |isCompact | bool | no | true, false | false | If the headline should be compact |
25
25
  |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
26
- |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
27
26
  |publicationTime | string | no | | null | Publication time text. |
28
27
  |duration | string | no | | null | Duration of podcast. |
29
28
  |isSquareImage | boolean | no | | false | Flag so we can handle square teaser images |
@@ -1,5 +1,4 @@
1
1
  {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
2
- {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
2
  {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
3
  {% from '@bonniernews/dn-design-system-web/components/teaser-footer/teaser-footer.njk' import TeaserFooter %}
5
4
  {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
@@ -8,12 +7,10 @@
8
7
  {% set componentClassName = "ds-teaser" %}
9
8
  {% set classNamePrefix = componentClassName + "--" %}
10
9
 
11
- {% set hasQuoteBadge = params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
12
10
  {% set extraClasses = [
13
11
  "ds-teaser--standard",
14
12
  classNamePrefix + params.variant if params.variant,
15
13
  classNamePrefix + "compact" if params.isCompact,
16
- classNamePrefix + "quote-badge" if hasQuoteBadge,
17
14
  params.classNames if params.classNames
18
15
  ] | join(" ") %}
19
16
 
@@ -24,13 +21,6 @@
24
21
  attributes: params.attributes,
25
22
  classNames: extraClasses
26
23
  }) %}
27
-
28
- {% if params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
29
- {{ VipBadge({
30
- showText: false
31
- }) }}
32
- {% endif %}
33
-
34
24
  <div class="{{ componentClassName + '__content'}}">
35
25
  {% if params.mediaHtml %}
36
26
  {% set mediaClass = [
@@ -40,11 +30,6 @@
40
30
  ] | join(" ") %}
41
31
  <div class="{{ mediaClass }}">
42
32
  {{ params.mediaHtml }}
43
- {% if params.isLocked %}
44
- {{ VipBadge({
45
- showText: false
46
- }) }}
47
- {% endif %}
48
33
  </div>
49
34
  {% endif %}
50
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "29.0.1",
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",
File without changes
@@ -1,35 +0,0 @@
1
- - GitHub: [BonnierNews/dn-design-system/../web/src/components/vip-badge](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/vip-badge)
2
- - Storybook: [Subcomponents > Vip Badge](https://designsystem.dn.se/?path=/docs/section-subcomponents-vipbadge--docs)
3
- - Storybook (Latest): [Subcomponents > Vip Badge](https://designsystem-latest.dn.se/?path=/docs/section-subcomponents-vipbadge--docs)
4
-
5
- ----
6
-
7
- # VipBadge
8
-
9
- ## Parameters
10
-
11
- |parameter | type | required | options | default | description |
12
- |:--- | :--- | :--- | :--- | :--- | :--- |
13
- |showText | bool | no | | false | By default only icon is shown |
14
- |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
15
- |classNames | String | no | | | Ex. "my-special-class" |
16
- |forcePx | bool | no | true, false | false | Fixed pixel value is used for typography to prevent scaling based on html font-size |
17
-
18
- ## Minimum requirement example
19
-
20
- ### Nunjucks
21
-
22
- These are copy paste friendly examples to quickliy get started using a component.
23
-
24
- ```html
25
- {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
26
-
27
- {{ VipBadge({
28
- showText: true
29
- })}}
30
- ```
31
-
32
- ### SCSS
33
- ```scss
34
- @use "@bonniernews/dn-design-system-web/components/vip-badge/vip-badge" as *;
35
- ```
@@ -1,18 +0,0 @@
1
- {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
2
- {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
3
-
4
- {% macro VipBadge(params) %}
5
- {%- set componentClassName = "ds-vip-badge" %}
6
- {%- set classNamePrefix = componentClassName + "--" %}
7
- {%- set classes = [
8
- componentClassName,
9
- classNamePrefix + "text" if params.showText,
10
- "ds-force-px" if params.forcePx,
11
- params.classNames if params.classNames
12
- ] | join(" ") %}
13
- {%- set attributes = getAttributes(params.attributes) %}
14
- <div class="{{ classes }}" {{- attributes | safe }} aria-hidden="true">
15
- {{ IconUse({ icon: 'vip' | safe }) }}
16
- {{ "För dig som prenumererar" if params.showText else "" }}
17
- </div>
18
- {% endmacro %}
@@ -1,60 +0,0 @@
1
- @use "../../foundations/helpers/forward.helpers.scss" as *;
2
- @use "../icon-sprite/icon-sprite.scss";
3
-
4
- $ds-vip-badge__icon-size: 16px;
5
-
6
- .ds-vip-badge {
7
- display: none;
8
- align-items: center;
9
- box-sizing: content-box;
10
- border-radius: ds-px-to-rem(ds-border-radius(012)) 0 ds-px-to-rem(ds-border-radius(012))
11
- ds-px-to-rem(ds-border-radius(012));
12
- background-color: $ds-color-business;
13
- color: $ds-color-neutral-white;
14
- fill: $ds-color-neutral-white;
15
- padding: ds-spacing($ds-s-025, rem);
16
- @include ds-typography(
17
- $ds-typography-functional-meta-sm,
18
- $lineHeight: $ds-lineheight-lg,
19
- $letterSpacing: $ds-letterspacing-none
20
- );
21
-
22
- @at-root .ds-force-px#{&} {
23
- border-radius: ds-border-radius(012) 0 ds-border-radius(012) ds-border-radius(012);
24
- padding: ds-spacing($ds-s-025);
25
- @include ds-typography(
26
- $ds-typography-functional-meta-sm,
27
- $forcePx: true,
28
- $lineHeight: $ds-lineheight-lg,
29
- $letterSpacing: $ds-letterspacing-none
30
- );
31
- }
32
-
33
- // bang class indicating that the user has premium access
34
- .dn-premium & {
35
- display: inline-flex;
36
- }
37
-
38
- .ds-icon {
39
- height: ds-px-to-rem($ds-vip-badge__icon-size);
40
- width: ds-px-to-rem($ds-vip-badge__icon-size);
41
- @at-root .ds-force-px#{&} {
42
- height: $ds-vip-badge__icon-size;
43
- width: $ds-vip-badge__icon-size;
44
- }
45
- }
46
- }
47
-
48
- .ds-vip-badge--text {
49
- padding: ds-spacing($ds-s-025 $ds-s-050, rem);
50
- @at-root .ds-force-px#{&} {
51
- padding: ds-spacing($ds-s-025 $ds-s-050);
52
- }
53
-
54
- .ds-icon {
55
- margin-right: ds-spacing($ds-s-025, rem);
56
- @at-root .ds-force-px#{&} {
57
- margin-right: ds-spacing($ds-s-025);
58
- }
59
- }
60
- }