@bonniernews/dn-design-system-web 3.0.0-alpha.47 → 3.0.0-alpha.49

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
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.0-alpha.49](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.48...@bonniernews/dn-design-system-web@3.0.0-alpha.49) (2023-05-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **web:** always show vip badge on quote teasers ([#800](https://github.com/BonnierNews/dn-design-system/issues/800)) ([5e8d4e8](https://github.com/BonnierNews/dn-design-system/commit/5e8d4e8b5ffa3f5167beed0b0017c8f52141d875))
12
+
13
+
14
+
15
+ ## [3.0.0-alpha.48](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.47...@bonniernews/dn-design-system-web@3.0.0-alpha.48) (2023-05-08)
16
+
17
+
18
+ ### Features
19
+
20
+ * **web:** teaser package ([#791](https://github.com/BonnierNews/dn-design-system/issues/791)) ([e3477df](https://github.com/BonnierNews/dn-design-system/commit/e3477df7f48657e9084bc7a4bea97a7ec1afa81f))
21
+
22
+
23
+
6
24
  ## 3.0.0-alpha.47 (2023-05-08)
7
25
 
8
26
 
@@ -8,6 +8,7 @@
8
8
  display: block;
9
9
  background-color: $ds-color-background-primary;
10
10
  text-decoration: none;
11
+ position: relative;
11
12
 
12
13
  .ds-teaser__content {
13
14
  display: flex;
@@ -41,12 +42,18 @@
41
42
  .ds-teaser__media {
42
43
  width: 100%;
43
44
  position: relative;
45
+ }
46
+
47
+ .ds-vip-badge {
48
+ position: absolute;
49
+ top: 0;
50
+ right: 0;
51
+ z-index: 5;
52
+ }
44
53
 
45
- .ds-vip-badge {
46
- position: absolute;
47
- top: 0;
48
- right: 0;
49
- z-index: 5;
54
+ &.ds-teaser--quote-badge {
55
+ .ds-teaser__title {
56
+ padding-right: ds-spacing-component($ds-sc-x3);
50
57
  }
51
58
  }
52
59
 
@@ -19,6 +19,14 @@
19
19
  {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
20
20
  {% endif %}
21
21
 
22
+ {% if params.isLocked and not params.mediaHtml and not params.bylineHtml and params.isItalicHeadline %}
23
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "quote-badge"), additionalClasses) %}
24
+ {% endif %}
25
+
26
+ {% if params.mediaHtml %}
27
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + 'top-img'), additionalClasses) %}
28
+ {% endif %}
29
+
22
30
  {% if params.classNames %}
23
31
  {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
24
32
  {% endif%}
@@ -46,6 +54,11 @@
46
54
  }) }}
47
55
  {% endif %}
48
56
  </div>
57
+ {% elif params.isItalicHeadline and params.isLocked %}
58
+ {{ VipBadge({
59
+ showText: false,
60
+ forcePx: true
61
+ }) }}
49
62
  {% endif %}
50
63
 
51
64
  <div class="{{ componentClassName + '__content'}}">
@@ -0,0 +1,44 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-package](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-package)
2
+ - Storybook (PROD): [TeaserPackage > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserpackage-web)
3
+ - Storybook (LATEST): [TeaserPackage > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserpackage-web)
4
+
5
+ ----
6
+
7
+ # teaser-package
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |teasersHtml | HTML String | yes | | | HTML teaser output |
14
+ |vignetteText | String | yes | | | Heading of the teaser |
15
+ |vignetteTargetUrl | String | no | | | Target URL for the teaser |
16
+ |vignetteTargetId | String | no | | | Target article ID |
17
+ |areaType | string | no | "bauta" or "bautaxl" | | The area where the column is rendered |
18
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
19
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
20
+ |classNames | String | no | | | Ex. "my-special-class" |
21
+ |~forcePx~ | | | | | Not supported |
22
+
23
+ ## Minimum requirement example
24
+
25
+ ### Nunjucks
26
+
27
+ These are copy paste friendly examples to quickliy get started using a component.
28
+
29
+ ```html
30
+ {% from '@bonniernews/dn-design-system-web/components/teaser-package/teaser-package.njk' import TeaserPackage %}
31
+
32
+ {{ TeaserPackage({
33
+ teasersHtml: "",
34
+ areaType: "bauta",
35
+ vignetteText: "Svensk politik",
36
+ vignetteTargetId: "dn.tag.svensk-politik",
37
+ vignetteTargetUrl: "/om/svensk-politik/"
38
+ })}}
39
+ ```
40
+
41
+ ### SCSS
42
+ ```scss
43
+ @use "@bonniernews/dn-design-system-web/components/teaser-package/teaser-package" as *;
44
+ ```
@@ -0,0 +1,37 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
3
+
4
+ {% macro TeaserPackage(params) %}
5
+ {%- set componentClassName = "ds-teaser-package" %}
6
+ {%- set classNamePrefix = componentClassName + "--" %}
7
+ {%- set additionalClasses = [] %}
8
+ {%- set attributes = getAttributes(params.attributes) %}
9
+
10
+ {%- if params.areaType %}
11
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
12
+ {% endif %}
13
+
14
+ {%- if params.theme %}
15
+ {% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
16
+ {% endif %}
17
+
18
+ {%- if params.classNames %}
19
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
20
+ {% endif%}
21
+
22
+ {%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
23
+ <div class="{{ classes }}">
24
+ {%- if params.vignetteTargetUrl %}
25
+ <a href="{{ params.vignetteTargetUrl }}"
26
+ class="{{ componentClassName + '__vignette'}}"
27
+ {% if params.vignetteTargetId %} data-id="{{ params.vignetteTargetId }}" {% endif %}
28
+ {{- attributes | safe }}>
29
+ <span>{{ params.vignetteText }}</span>
30
+ {{ Icon({ icon: "arrow_forward", attributes: {"aria-hidden": true} }) }}
31
+ </a>
32
+ {% else %}
33
+ <div class="{{ componentClassName + '__vignette'}}">{{ params.vignetteText }}</div>
34
+ {% endif %}
35
+ {{ params.teasersHtml | safe }}
36
+ </div>
37
+ {% endmacro %}
@@ -0,0 +1,104 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss";
3
+
4
+ .ds-teaser-package {
5
+ position: relative;
6
+ background-color: $ds-color-background-primary;
7
+
8
+ & > .ds-teaser {
9
+ position: relative;
10
+ }
11
+
12
+ > .ds-teaser::after,
13
+ > .ds-teaser + .ds-split-container::after {
14
+ content: "";
15
+ height: ds-metrics-border-width(x1);
16
+ background-color: $ds-color-border-primary;
17
+ position: absolute;
18
+ display: block;
19
+ top: 0;
20
+ left: 0;
21
+ right: 0;
22
+ @include ds-spacing-layout(0 $ds-sl-teaser-horizontal, margin);
23
+ box-sizing: border-box;
24
+ z-index: 5;
25
+ }
26
+
27
+ .ds-teaser-package__vignette + .ds-teaser::after,
28
+ .ds-teaser--top-img::after {
29
+ display: none;
30
+ }
31
+
32
+ .ds-teaser--onsite {
33
+ background-position-y: 1px;
34
+ }
35
+
36
+ &::after {
37
+ content: "";
38
+ position: absolute;
39
+ height: 100%;
40
+ width: 4px;
41
+ top: 0;
42
+ background-color: $ds-theme-color;
43
+ z-index: 5;
44
+ }
45
+
46
+ .ds-teaser-package__vignette {
47
+ padding: ds-spacing-component($ds-sc-x3);
48
+ @include ds-spacing-layout($ds-sl-teaser-horizontal, padding-left);
49
+ @include ds-spacing-layout($ds-sl-teaser-horizontal, padding-right);
50
+ @include ds-typography($ds-typography-functional-body02bold);
51
+ display: flex;
52
+ justify-content: space-between;
53
+ color: $ds-color-text-primary;
54
+ background-color: $ds-color-component-secondary;
55
+ }
56
+
57
+ a.ds-teaser-package__vignette {
58
+ @include ds-link($ds-link-list);
59
+ display: flex;
60
+ align-items: center;
61
+ }
62
+
63
+ &.ds-teaser-package--bauta {
64
+ .ds-teaser-package__vignette {
65
+ color: $ds-color-static-white;
66
+ background-color: $ds-theme-color;
67
+ }
68
+ }
69
+
70
+ &.ds-teaser-package--bautaxl {
71
+ &::after {
72
+ background-color: transparent;
73
+ }
74
+
75
+ .ds-teaser-package__vignette {
76
+ color: $ds-color-static-white;
77
+ background-color: #2b2b2b; // @todo change to token when available
78
+ }
79
+
80
+ .ds-teaser-package__vignette
81
+ + .ds-teaser--large:not(.ds-teaser--large-italic):not(.ds-teaser--large-big-italic) {
82
+ @include ds-mq-smallest-breakpoint(desktop) {
83
+ .ds-teaser__title {
84
+ font-size: 80px; // special case, will not have a token
85
+ line-height: 88px;
86
+ }
87
+ }
88
+ @include ds-mq-only-breakpoint(mobile) {
89
+ background-color: #2b2b2b; // @todo change to token when available
90
+ .ds-teaser__title,
91
+ .ds-teaser__text {
92
+ color: $ds-color-static-white;
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ .ds-icon {
99
+ width: ds-px-to-rem(24px);
100
+ height: ds-px-to-rem(24px);
101
+ color: currentColor;
102
+ display: inline-flex;
103
+ }
104
+ }
@@ -19,6 +19,10 @@
19
19
  {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
20
20
  {% endif %}
21
21
 
22
+ {% if params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
23
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "quote-badge"), additionalClasses) %}
24
+ {% endif %}
25
+
22
26
  {% if params.classNames %}
23
27
  {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
24
28
  {% endif%}
@@ -30,6 +34,13 @@
30
34
  {% if params.targetId %} data-id="{{ params.targetId }}" {% endif %}
31
35
  {{- attributes | safe }}>
32
36
 
37
+ {% if params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
38
+ {{ VipBadge({
39
+ showText: false,
40
+ forcePx: true
41
+ }) }}
42
+ {% endif %}
43
+
33
44
  <div class="{{ componentClassName + '__content'}}">
34
45
  {% if params.vignette %}
35
46
  <div class="ds-teaser__vignette">{{ params.vignette }}</div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "3.0.0-alpha.47",
3
+ "version": "3.0.0-alpha.49",
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",