@bonniernews/dn-design-system-web 3.0.0-alpha.46 → 3.0.0-alpha.48

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.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)
7
+
8
+
9
+ ### Features
10
+
11
+ * **web:** teaser package ([#791](https://github.com/BonnierNews/dn-design-system/issues/791)) ([e3477df](https://github.com/BonnierNews/dn-design-system/commit/e3477df7f48657e9084bc7a4bea97a7ec1afa81f))
12
+
13
+
14
+
15
+ ## 3.0.0-alpha.47 (2023-05-08)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **web:** set standardteaser image width to 196px ([#798](https://github.com/BonnierNews/dn-design-system/issues/798)) ([5911856](https://github.com/BonnierNews/dn-design-system/commit/59118561f6166b2be2b68de068b7909117de2fda))
21
+
22
+
23
+
6
24
  ## [3.0.0-alpha.46](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.45...@bonniernews/dn-design-system-web@3.0.0-alpha.46) (2023-05-05)
7
25
 
8
26
 
@@ -19,6 +19,10 @@
19
19
  {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
20
20
  {% endif %}
21
21
 
22
+ {% if params.mediaHtml %}
23
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + 'top-img'), additionalClasses) %}
24
+ {% endif %}
25
+
22
26
  {% if params.classNames %}
23
27
  {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
24
28
  {% endif%}
@@ -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
+ }
@@ -27,8 +27,8 @@
27
27
  }
28
28
 
29
29
  @include ds-mq-smallest-breakpoint(tablet) {
30
- min-width: 224px;
31
- max-width: 224px;
30
+ min-width: 196px;
31
+ max-width: 196px;
32
32
  }
33
33
 
34
34
  .teaser__video {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "3.0.0-alpha.46",
3
+ "version": "3.0.0-alpha.48",
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",