@bonniernews/dn-design-system-web 31.0.1-beta.2 → 31.0.1-beta.3

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.
@@ -1,10 +1,10 @@
1
- - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-standard](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-standard)
2
- - Storybook: [TeaserStandard](https://designsystem.dn.se/?path=/docs/section-teaserstandard--docs)
3
- - Storybook (Latest): [TeaserStandard](https://designsystem-latest.dn.se/?path=/docs/section-teaserstandard--docs)
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
4
 
5
5
  ----
6
6
 
7
- # teaser-standard
7
+ # teaser-text-on-image
8
8
 
9
9
  ## Parameters
10
10
 
@@ -12,20 +12,10 @@
12
12
  |:--- | :--- | :--- | :--- | :--- | :--- |
13
13
  |title | String | yes | | | Heading of the teaser |
14
14
  |targetLink | String | yes | | | Target URL for the teaser |
15
- |variant | String | no | "default" or "podcast" | "default" | |
16
- |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
15
  |theme | String | no | nyheter, kultur | (empty) | The theme-class to apply to the teaser |
18
16
  |text | String | no | | | Teaser subtext |
19
17
  |vignette | String | no | | | Top text in the teaser |
20
- |highlight | String | no | | | Text before the heading |
21
- |sticker | String | no | | | Red text before the text |
22
- |mediaHtml | HTML String | no | | | Main image or other media |
23
- |isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
24
- |isCompact | bool | no | true, false | false | If the headline should be compact |
25
- |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
26
- |publicationTime | string | no | | null | Publication time text. |
27
- |duration | string | no | | null | Duration of podcast. |
28
- |isSquareImage | boolean | no | | false | Flag so we can handle square teaser images |
18
+ |mediaHtml | HTML String | yes | | | Main image or other media |
29
19
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
30
20
  |classNames | String | no | | | Ex. "my-special-class" |
31
21
  |~forcePx~ | | | | | Not supported |
@@ -35,33 +25,17 @@ These are copy paste friendly examples to quickliy get started using a component
35
25
 
36
26
  ### Nunjucks
37
27
  ```html
38
- {% from '@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard.njk' import TeaserStandard %}
28
+ {% from '@bonniernews/dn-design-system-web/components/teaser-text-on-image/teaser-text-on-image.njk' import TeaserTextOnImage %}
39
29
 
40
- {{ TeaserStandard({
41
- title: "Upp börsen",
42
- text: "Det ser ganska normalt ut på Stockholmsbörsen.",
43
- highlight: "Ekonominytt:"
30
+ {{ TeaserTextOnImage({
31
+ title: 'Ludmila Engquist: "Det skulle kännas fel att dö utan att ha förklarat sig"',
32
+ targetLink: "https://www.dn.se/sport/ludmila-enguist-det-skulle-kannas-fel-att-do-utan-att-ha-forklarat-sig/",
33
+ text: "Nu träder Ludmila Engquist fram och berättar sanningen – innan det är för sent.",
34
+ mediaHtml: "text-on-image",
44
35
  })}}
45
36
  ```
46
37
 
47
38
  ### SCSS
48
39
  ```scss
49
- @use "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard" as *;
50
- ```
51
-
52
- ### Javascript
53
- This version is rarely used to render a teaser dynamically in the browser. For example, it is used to render reserv-teasers in failover. This version **ONLY** supports the `title`, `text`, `targetLink`, `classNames` and `attributes` parameters.
54
-
55
- ```javascript
56
- import { dsTeaserStandard } from "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard";
57
-
58
- // NB: javascript only supports a subset of all parameters
59
- const parameters = {
60
- title: "Upp på börsen",
61
- text: "Det ser ganska normalt ut på Stockholmsbörsen",
62
- targetLink: "https://www.dn.se/ekonomi/",
63
- attributes: { "data-test" : "test-value" }
64
- }
65
-
66
- const teaserStandardHtml = dsTeaserStandard(parameters);
40
+ @use "@bonniernews/dn-design-system-web/components/teaser-text-on-image/teaser-text-on-image" as *;
67
41
  ```
@@ -14,7 +14,6 @@
14
14
 
15
15
  {% call TeaserCard({
16
16
  targetLink: params.targetLink,
17
- areaType: params.areaType,
18
17
  theme: params.theme,
19
18
  attributes: params.attributes,
20
19
  classNames: extraClasses
@@ -27,6 +26,12 @@
27
26
  {% endif %}
28
27
 
29
28
  <div class="{{ componentClassName + '__text-content'}}">
29
+ {% if params.vignette %}
30
+ <p class="{{ componentClassName + '__vignette' }}">
31
+ {{ params.vignette }}
32
+ </p>
33
+ {% endif %}
34
+
30
35
  <h2 class="{{ componentClassName + '__title'}} {{ componentClassName + '__title--italic' if params.isItalicHeadline}}">
31
36
  {{ params.title }}
32
37
  </h2>
@@ -5,25 +5,12 @@
5
5
  overflow: hidden;
6
6
 
7
7
  .ds-teaser__vignette {
8
- margin-top: ds-spacing($ds-s-025);
8
+ color: $ds-color-neutral-white;
9
9
  }
10
10
 
11
- .ds-teaser__title,
12
- .ds-teaser__text {
13
- position: relative;
14
- color: $ds-color-surface-primary;
15
- margin-top: ds-spacing($ds-s-100);
16
- }
17
-
18
- .ds-teaser__title {
19
- @include ds-typography($ds-typography-detail-teaser-text-i-bild, $forcePx: true);
20
-
21
- &--italic {
22
- @include ds-typography($ds-typography-detail-medryckare);
23
- }
24
- }
25
11
  .ds-teaser__content {
26
12
  position: relative;
13
+ color: $ds-color-neutral-white;
27
14
 
28
15
  &:after {
29
16
  content: "";
@@ -37,6 +24,26 @@
37
24
  }
38
25
  }
39
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
+
40
47
  .ds-teaser-image__byline,
41
48
  .ds-teaser__text-content {
42
49
  z-index: 3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/dn-design-system-web",
3
- "version": "31.0.1-beta.2",
3
+ "version": "31.0.1-beta.3",
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",
@@ -1,53 +0,0 @@
1
- export {
2
- dsTeaserStandard,
3
- dsTeaserStandardStory
4
- };
5
-
6
- function dsTeaserStandard(params = {}) {
7
- const teaser = document.createElement("a");
8
- // NOTE: this should match output of teaser-standard.njk for a subset of the parameters
9
- teaser.innerHTML = `
10
- <div class="ds-teaser__content">
11
- <div class="ds-teaser__title"></div>
12
- <p class="ds-teaser__text">
13
- <span class="ds-teaser-dot"></span>
14
- </p>
15
- </div>`;
16
- teaser.classList.add("ds-teaser");
17
- teaser.classList.add("ds-teaser--standard");
18
-
19
- if (params.targetLink) {
20
- teaser.setAttribute("href", params.targetLink)
21
- }
22
-
23
- if (params.title) {
24
- const titleEl = teaser.getElementsByClassName("ds-teaser__title")[0];
25
- titleEl.textContent = params.title;
26
- }
27
-
28
- if (params.text) {
29
- const textEl = teaser.getElementsByClassName("ds-teaser__text")[0];
30
- textEl.appendChild(document.createTextNode(params.text))
31
- }
32
-
33
- if (params.classNames) {
34
- teaser.classList.add(params.classNames);
35
- }
36
-
37
- if (params.attributes) {
38
- for (const [key, value] of Object.entries(params.attributes)) {
39
- teaser.setAttribute(key, value);
40
- }
41
- }
42
-
43
- return teaser;
44
- }
45
-
46
- /** only use in storybook */
47
- function dsTeaserStandardStory() {
48
- const jsTeasers = Array.from(document.getElementsByClassName("js-ds-teaser-standard-story"));
49
- jsTeasers.forEach((teaserEl) => {
50
- const params = JSON.parse(teaserEl.getAttribute("data-params"));
51
- teaserEl.replaceWith(dsTeaserStandard(params));
52
- });
53
- }