@bonniernews/dn-design-system-web 31.0.1 → 31.1.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
+ ## [31.1.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.0.1...@bonniernews/dn-design-system-web@31.1.0) (2025-03-13)
8
+
9
+
10
+ ### Features
11
+
12
+ * **web:** text on image teaser ([#1656](https://github.com/BonnierNews/dn-design-system/issues/1656)) ([bf0325c](https://github.com/BonnierNews/dn-design-system/commit/bf0325c0b8044580030fdbe41eabee26476d5f5f))
13
+
14
+
15
+ ### Maintenance
16
+
17
+ * **deps:** bump @babel/helpers from 7.24.0 to 7.26.10 in /web ([#1661](https://github.com/BonnierNews/dn-design-system/issues/1661)) ([183c4bf](https://github.com/BonnierNews/dn-design-system/commit/183c4bf793c4143916b30ecf0a3903f1b56e5fa4))
18
+ * **deps:** bump @babel/runtime from 7.24.1 to 7.26.10 in /web ([#1660](https://github.com/BonnierNews/dn-design-system/issues/1660)) ([b76f457](https://github.com/BonnierNews/dn-design-system/commit/b76f4575ece3ffaf92cbe4b03297820f4b3add8f))
19
+ * **deps:** bump sass from 1.83.4 to 1.85.1 ([#1633](https://github.com/BonnierNews/dn-design-system/issues/1633)) ([8c8098b](https://github.com/BonnierNews/dn-design-system/commit/8c8098b99168cd8d3b11765719619654baf821cb))
20
+ * prerelease packages ([e111703](https://github.com/BonnierNews/dn-design-system/commit/e1117039ea9d1bcd6bcaf5225f8f3a8a93a7bc0f))
21
+
7
22
  ## [31.0.1](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@31.0.0...@bonniernews/dn-design-system-web@31.0.1) (2025-03-12)
8
23
 
9
24
 
File without changes
@@ -0,0 +1,40 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-text-on-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-text-on-image)
2
+ - Storybook: [TeaserTextOnImage](https://designsystem.dn.se/?path=/docs/section-teasertextonimage--docs)
3
+ - Storybook (Latest): [TeaserTextOnImage](https://designsystem-latest.dn.se/?path=/docs/section-teasertextonimage--docs)
4
+
5
+ ----
6
+
7
+ # teaser-text-on-image
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |title | String | yes | | | Heading of the teaser |
14
+ |targetLink | String | yes | | | Target URL for the teaser |
15
+ |text | String | no | | | Teaser subtext |
16
+ |vignette | String | no | | | Top text in the teaser |
17
+ |mediaHtml | HTML String | yes | | | Main image |
18
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
19
+ |classNames | String | no | | | Ex. "my-special-class" |
20
+ |~forcePx~ | | | | | Not supported |
21
+
22
+ ## Minimum requirement example
23
+ These are copy paste friendly examples to quickliy get started using a component.
24
+
25
+ ### Nunjucks
26
+ ```html
27
+ {% from '@bonniernews/dn-design-system-web/components/teaser-text-on-image/teaser-text-on-image.njk' import TeaserTextOnImage %}
28
+
29
+ {{ TeaserTextOnImage({
30
+ title: 'Ludmila Engquist: "Det skulle kännas fel att dö utan att ha förklarat sig"',
31
+ targetLink: "https://www.dn.se/sport/ludmila-enguist-det-skulle-kannas-fel-att-do-utan-att-ha-forklarat-sig/",
32
+ text: "Nu träder Ludmila Engquist fram och berättar sanningen – innan det är för sent.",
33
+ mediaHtml: "text-on-image",
34
+ })}}
35
+ ```
36
+
37
+ ### SCSS
38
+ ```scss
39
+ @use "@bonniernews/dn-design-system-web/components/teaser-text-on-image/teaser-text-on-image" as *;
40
+ ```
@@ -0,0 +1,41 @@
1
+ {% from '@bonniernews/dn-design-system-web/components/teaser-card/teaser-card.njk' import TeaserCard %}
2
+
3
+ {% macro TeaserTextOnImage(params) %}
4
+ {% set componentClassName = "ds-teaser" %}
5
+ {% set classNamePrefix = componentClassName + "--" %}
6
+
7
+ {% set extraClasses = [
8
+ "ds-teaser--text-on-image",
9
+ params.classNames if params.classNames
10
+ ] | join(" ") %}
11
+
12
+ {% call TeaserCard({
13
+ targetLink: params.targetLink,
14
+ attributes: params.attributes,
15
+ classNames: extraClasses
16
+ }) %}
17
+ <div class="{{ componentClassName + '__content'}}">
18
+ <div class="{{ componentClassName + '__media' }}">
19
+ {{ params.mediaHtml }}
20
+ </div>
21
+
22
+ <div class="{{ componentClassName + '__text-content'}}">
23
+ {% if params.vignette %}
24
+ <p class="{{ componentClassName + '__vignette' }}">
25
+ {{ params.vignette }}
26
+ </p>
27
+ {% endif %}
28
+
29
+ <h2 class="{{ componentClassName + '__title'}} {{ componentClassName + '__title--italic' if params.isItalicHeadline}}">
30
+ {{ params.title }}
31
+ </h2>
32
+
33
+ {% if params.text %}
34
+ <p class="{{ componentClassName + '__text' }}">
35
+ {{ params.text }}
36
+ </p>
37
+ {% endif %}
38
+ </div>
39
+ </div>
40
+ {% endcall %}
41
+ {% endmacro %}
@@ -0,0 +1,73 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss" as *;
3
+
4
+ .ds-teaser.ds-teaser--text-on-image {
5
+ overflow: hidden;
6
+
7
+ .ds-teaser__vignette {
8
+ color: $ds-color-neutral-white;
9
+ }
10
+
11
+ .ds-teaser__content {
12
+ position: relative;
13
+ color: $ds-color-neutral-white;
14
+
15
+ &:after {
16
+ content: "";
17
+ position: absolute;
18
+ top: 0;
19
+ left: 0;
20
+ width: 100%;
21
+ height: 100%;
22
+ background: linear-gradient(var(--ds-color-gradients-overlay-end), var(--ds-color-gradients-overlay-start));
23
+ z-index: 2;
24
+ }
25
+ }
26
+
27
+ .ds-teaser__title,
28
+ .ds-teaser__text {
29
+ position: relative;
30
+ color: $ds-color-neutral-white;
31
+ }
32
+
33
+ .ds-teaser__text {
34
+ margin-top: ds-spacing($ds-s-100);
35
+ }
36
+
37
+ .ds-teaser__title {
38
+ margin-top: ds-spacing($ds-s-050);
39
+
40
+ @include ds-typography($ds-typography-detail-teaser-text-i-bild, $forcePx: true);
41
+
42
+ &--italic {
43
+ @include ds-typography($ds-typography-detail-medryckare);
44
+ }
45
+ }
46
+
47
+ .ds-teaser-image__byline,
48
+ .ds-teaser__text-content {
49
+ z-index: 3;
50
+ }
51
+
52
+ .ds-teaser__text-content {
53
+ position: absolute;
54
+ bottom: ds-spacing($ds-s-100);
55
+ left: ds-spacing($ds-s-100);
56
+ max-width: 90%;
57
+
58
+ @include ds-mq-only-breakpoint(desktop) {
59
+ max-width: 75%;
60
+ }
61
+ }
62
+
63
+ .ds-teaser__media {
64
+ .picture {
65
+ width: 100%;
66
+ height: 100%;
67
+ }
68
+
69
+ .ds-teaser-image__byline {
70
+ @include ds-typography($ds-typography-functional-meta-sm, $forcePx: true, $lineHeight: $ds-lineheight-lg);
71
+ }
72
+ }
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "31.0.1",
3
+ "version": "31.1.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",