@bonniernews/dn-design-system-web 3.0.0-alpha.7 → 3.0.0-alpha.71

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.
Files changed (121) hide show
  1. package/CHANGELOG.md +571 -0
  2. package/assets/article-image/article-image.njk +11 -10
  3. package/assets/article-image/article-image.scss +1 -15
  4. package/assets/form-field/form-field.njk +2 -2
  5. package/assets/form-field/form-field.scss +2 -6
  6. package/assets/teaser/teaser.scss +75 -0
  7. package/components/article-body-image/README.md +2 -2
  8. package/components/article-body-image/article-body-image.njk +1 -5
  9. package/components/article-top-image/README.md +2 -2
  10. package/components/article-top-image/article-top-image.njk +1 -5
  11. package/components/article-top-image/article-top-image.scss +1 -1
  12. package/components/badge/badge.scss +1 -5
  13. package/components/buddy-menu/buddy-menu.scss +1 -8
  14. package/components/button/button.njk +38 -43
  15. package/components/button/button.scss +6 -1
  16. package/components/button-toggle/button-toggle.js +2 -0
  17. package/components/button-toggle/button-toggle.njk +36 -36
  18. package/components/button-toggle/button-toggle.scss +6 -1
  19. package/components/byline/byline.njk +2 -2
  20. package/components/byline/byline.scss +1 -3
  21. package/components/checkbox/checkbox.njk +3 -3
  22. package/components/checkbox/checkbox.scss +8 -9
  23. package/components/disclaimer/disclaimer.njk +2 -2
  24. package/components/disclaimer/disclaimer.scss +25 -11
  25. package/components/factbox/README.md +2 -2
  26. package/components/factbox/factbox.njk +9 -11
  27. package/components/factbox/factbox.scss +6 -37
  28. package/components/footer/footer.scss +2 -8
  29. package/components/icon-button/README.md +2 -1
  30. package/components/icon-button/icon-button.njk +4 -4
  31. package/components/icon-button/icon-button.scss +5 -2
  32. package/components/icon-button-toggle/icon-button-toggle.js +2 -0
  33. package/components/icon-button-toggle/icon-button-toggle.njk +28 -36
  34. package/components/icon-button-toggle/icon-button-toggle.scss +5 -2
  35. package/components/icon-sprite/README.md +51 -0
  36. package/components/icon-sprite/icon-sprite.njk +12 -0
  37. package/components/icon-sprite/icon-sprite.scss +12 -0
  38. package/components/icon-with-wrapper/README.md +9 -2
  39. package/components/icon-with-wrapper/icon-with-wrapper.njk +2 -2
  40. package/components/icon-with-wrapper/icon-with-wrapper.scss +2 -1
  41. package/components/image-caption/README.md +38 -0
  42. package/components/image-caption/image-caption.njk +25 -0
  43. package/components/image-caption/image-caption.scss +15 -0
  44. package/components/list-item/list-item.njk +5 -5
  45. package/components/list-item/list-item.scss +1 -3
  46. package/components/pictogram/README.md +39 -0
  47. package/components/pictogram/pictogram.njk +30 -0
  48. package/components/pictogram/pictogram.scss +54 -0
  49. package/components/quote/README.md +1 -2
  50. package/components/quote/quote.njk +6 -8
  51. package/components/quote/quote.scss +1 -14
  52. package/components/radio-button/radio-button.njk +3 -3
  53. package/components/radio-button/radio-button.scss +8 -10
  54. package/components/spinner/spinner.njk +19 -23
  55. package/components/spinner/spinner.scss +4 -1
  56. package/components/teaser-dot/README.md +34 -0
  57. package/components/teaser-dot/teaser-dot.njk +24 -0
  58. package/components/teaser-dot/teaser-dot.scss +39 -0
  59. package/components/teaser-image/README.md +40 -0
  60. package/components/teaser-image/teaser-image.njk +21 -0
  61. package/components/teaser-image/teaser-image.scss +21 -0
  62. package/components/teaser-large/README.md +51 -0
  63. package/components/teaser-large/teaser-large.njk +93 -0
  64. package/components/teaser-large/teaser-large.scss +174 -0
  65. package/components/teaser-onsite/README.md +53 -0
  66. package/components/teaser-onsite/teaser-onsite.njk +45 -0
  67. package/components/teaser-onsite/teaser-onsite.scss +35 -0
  68. package/components/teaser-package/README.md +42 -0
  69. package/components/teaser-package/teaser-package.njk +36 -0
  70. package/components/teaser-package/teaser-package.scss +112 -0
  71. package/components/teaser-right-now/README.md +37 -0
  72. package/components/teaser-right-now/teaser-right-now.njk +28 -0
  73. package/components/teaser-right-now/teaser-right-now.scss +16 -0
  74. package/components/teaser-slideshow/README.md +42 -0
  75. package/components/teaser-slideshow/teaser-slideshow.njk +38 -0
  76. package/components/teaser-slideshow/teaser-slideshow.scss +35 -0
  77. package/components/teaser-split/README-container.md +40 -0
  78. package/components/teaser-split/README.md +48 -0
  79. package/components/teaser-split/teaser-split.njk +93 -0
  80. package/components/teaser-split/teaser-split.scss +77 -0
  81. package/components/teaser-standard/README.md +49 -0
  82. package/components/teaser-standard/teaser-standard.njk +81 -0
  83. package/components/teaser-standard/teaser-standard.scss +38 -0
  84. package/components/teaser-tipsa/README.md +41 -0
  85. package/components/teaser-tipsa/teaser-tipsa.njk +31 -0
  86. package/components/teaser-tipsa/teaser-tipsa.scss +23 -0
  87. package/components/text-button/text-button.njk +34 -37
  88. package/components/text-button/text-button.scss +12 -10
  89. package/components/text-button-toggle/text-button-toggle.js +2 -0
  90. package/components/text-button-toggle/text-button-toggle.njk +30 -33
  91. package/components/text-button-toggle/text-button-toggle.scss +10 -10
  92. package/components/text-input/text-input.scss +3 -8
  93. package/components/video-caption/README.md +1 -1
  94. package/components/video-caption/video-caption.njk +12 -6
  95. package/components/vip-badge/README.md +35 -0
  96. package/components/vip-badge/vip-badge.njk +23 -0
  97. package/components/vip-badge/vip-badge.scss +54 -0
  98. package/foundations/colors.scss +31 -0
  99. package/foundations/helpers/README-links.md +1 -1
  100. package/foundations/helpers/colors.scss +2 -0
  101. package/foundations/helpers/links.scss +14 -6
  102. package/foundations/icons/icon.njk +167 -143
  103. package/foundations/icons/sprite.njk +1 -0
  104. package/foundations/icons/sprite.svg +1 -0
  105. package/foundations/icons/svg/download.svg +3 -0
  106. package/foundations/icons/svg/filter_list.svg +3 -0
  107. package/foundations/icons/svg/pause.svg +3 -0
  108. package/foundations/icons/svg/vip.svg +3 -0
  109. package/foundations/typography/fontDefinitions.scss +82 -67
  110. package/foundations/variables/colorsCssVariables.scss +5 -0
  111. package/foundations/variables/colorsDnDarkTokens.scss +6 -1
  112. package/foundations/variables/colorsDnLightTokens.scss +7 -2
  113. package/foundations/variables/spacingLayout.scss +6 -1
  114. package/foundations/variables/spacingLayoutLargeScreen.scss +5 -0
  115. package/foundations/variables/spacingLayoutList.scss +5 -0
  116. package/foundations/variables/typographyTokensScreenLarge.scss +87 -87
  117. package/foundations/variables/typographyTokensScreenSmall.scss +114 -114
  118. package/package.json +2 -2
  119. package/tokens/colors-css-variables.json +5 -0
  120. package/tokens/spacing-layout-list.json +6 -1
  121. package/foundations/icons/icon-sprite.svg +0 -2
@@ -0,0 +1,35 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss" as *;
3
+
4
+ .ds-teaser.ds-teaser--slideshow {
5
+ background-color: $ds-color-background-primary;
6
+ overflow: hidden;
7
+ max-height: 230px;
8
+ box-sizing: border-box;
9
+
10
+ &.ds-teaser--right {
11
+ max-width: 300px;
12
+ }
13
+
14
+ .ds-teaser__content {
15
+ @include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
16
+ display: block;
17
+ color: $ds-color-text-primary;
18
+
19
+ .ds-teaser__title {
20
+ display: inline;
21
+ @include ds-typography($ds-typography-functional-heading01bold);
22
+ }
23
+
24
+ .ds-teaser__text {
25
+ display: inline;
26
+ @include ds-typography($ds-typography-functional-heading01regular);
27
+ }
28
+ }
29
+
30
+ @include ds-hover {
31
+ &:hover .ds-teaser__title {
32
+ text-decoration: none;
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,40 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-split](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-split)
2
+ - Storybook (PROD): [TeaserSplitContainer > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teasersplitcontainer-web)
3
+ - Storybook (LATEST): [TeaserSplitContainer > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teasersplitcontainer-web)
4
+
5
+ ----
6
+
7
+ # TeaserSplitContainer
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |teasersHtml | HTML String | yes | | | HTML teaser output |
14
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme is applied to all teasers in the container |
15
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
16
+ |classNames | String | no | | | Ex. "my-special-class" |
17
+ |areaType | string | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
18
+ |~forcePx~ | | | | | Not supported |
19
+
20
+ ## Minimum requirement example
21
+
22
+ ### Nunjucks
23
+
24
+ These are copy paste friendly examples to quickliy get started using a component.
25
+
26
+ ```html
27
+ {% from "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split.njk" import TeaserSplitContainer %}
28
+
29
+ {{ TeaserSplitContainer({
30
+ areaType: "bauta",
31
+ teasersHtml: "",
32
+ attributes: {},
33
+ classNames: ""
34
+ })}}
35
+ ```
36
+
37
+ ### SCSS
38
+ ```scss
39
+ @use "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split";
40
+ ```
@@ -0,0 +1,48 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-split](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-split)
2
+ - Storybook (PROD): [TeaserSplit > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teasersplit-web)
3
+ - Storybook (LATEST): [TeaserSplit > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teasersplit-web)
4
+
5
+ ----
6
+
7
+ # TeaserSplit
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
+ |~variant~ | String | no | "default" or "podd" | "default" | Not implemented |
16
+ |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
18
+ |text | String | no | | | Teaser subtext |
19
+ |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
+ |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
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
26
+ |classNames | String | no | | | Ex. "my-special-class" |
27
+ |~forcePx~ | | | | | Not supported |
28
+
29
+ ## Minimum requirement example
30
+
31
+ ### Nunjucks
32
+
33
+ These are copy paste friendly examples to quickliy get started using a component.
34
+
35
+ ```html
36
+ {% from "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split.njk" import TeaserSplit %}
37
+
38
+ {{ TeaserSplit({
39
+ title: "Sju miljoner i humanitärt stöd till Turkiet och Syrien",
40
+ targetLink: "#",
41
+ text: "Tält och temporära nödboenden samt ledningsresurser för att koordinera räddningsarbetet."
42
+ })}}
43
+ ```
44
+
45
+ ### SCSS
46
+ ```scss
47
+ @use "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split";
48
+ ```
@@ -0,0 +1,93 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
+ {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
+
5
+ {% macro TeaserSplit(params) %}
6
+ {% set componentClassName = "ds-teaser" %}
7
+ {% set classNamePrefix = componentClassName + "--" %}
8
+ {% set additionalClasses = ["ds-teaser--split"] %}
9
+ {% set attributes = getAttributes(params.attributes) %}
10
+
11
+ {% if params.variant %}
12
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
13
+ {% endif %}
14
+
15
+ {% if params.areaType == "bauta" or params.areaType == "bautaxl" %}
16
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
17
+ {% endif %}
18
+
19
+ {% if params.theme %}
20
+ {% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
21
+ {% endif %}
22
+
23
+ {% if params.classNames %}
24
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
25
+ {% endif%}
26
+
27
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
28
+
29
+ <a href="{{ params.targetLink }}"
30
+ class="{{ classes }}"
31
+ {{- attributes | safe }}>
32
+
33
+ {% if params.mediaHtml %}
34
+ <div class="{{ componentClassName + '__media'}}">
35
+ {{ params.mediaHtml }}
36
+ {% if params.isLocked %}
37
+ {{ VipBadge({
38
+ showText: false,
39
+ forcePx: true
40
+ }) }}
41
+ {% endif %}
42
+ </div>
43
+ {% endif %}
44
+
45
+ <div class="{{ componentClassName + '__content'}}">
46
+ {% if params.vignette %}
47
+ <div class="ds-teaser__vignette">{{ params.vignette }}</div>
48
+ {% endif %}
49
+
50
+ <h2 class="{{ componentClassName + '__title' }}">
51
+ {% if params.highlight %}
52
+ <span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
53
+ {% endif %}
54
+ {{ params.title | safe }}
55
+ </h2>
56
+
57
+ {% if params.text %}
58
+ <p class="{{ componentClassName + '__text'}}">
59
+ {{ TeaserDot({ flashing: params.isFlashingDot }) }}
60
+ {% if params.sticker %}
61
+ <span class="ds-teaser__sticker">
62
+ {{ params.sticker }}
63
+ </span>
64
+ {% endif %}
65
+ {{ params.text }}
66
+ </p>
67
+ {% endif %}
68
+ </div>
69
+ </a>
70
+ {% endmacro %}
71
+
72
+ {% macro TeaserSplitContainer(params) %}
73
+ {{ params.teasers | dump }}
74
+ {%- set componentClassName = "ds-split-container" %}
75
+ {%- set classNamePrefix = componentClassName + "--" %}
76
+ {%- set additionalClasses = [] %}
77
+ {%- set attributes = getAttributes(params.attributes) %}
78
+
79
+ {% if params.areaType == "bauta" or params.areaType == "bautaxl" %}
80
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
81
+ {% endif %}
82
+
83
+ {% if params.theme %}
84
+ {% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
85
+ {% endif %}
86
+
87
+ {%- if params.classNames %}
88
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
89
+ {% endif%}
90
+
91
+ {%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
92
+ <div class="{{ classes }}" {{- attributes | safe }}>{{ params.teasersHtml | safe }}</div>
93
+ {% endmacro %}
@@ -0,0 +1,77 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss" as *;
3
+
4
+ .ds-split-container {
5
+ @include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ position: relative;
9
+ box-sizing: border-box;
10
+
11
+ & + .ds-split-container {
12
+ &:before {
13
+ content: "";
14
+ height: ds-metrics-border-width(x1);
15
+ background-color: $ds-color-border-primary;
16
+ left: 0;
17
+ right: 0;
18
+ top: 0;
19
+ position: absolute;
20
+ @include ds-spacing-layout(0 $ds-sl-teaser-horizontal, margin);
21
+ }
22
+ }
23
+
24
+ .ds-teaser--split {
25
+ box-sizing: content-box;
26
+ display: block;
27
+ position: relative;
28
+ flex: 1;
29
+ padding-right: ds-spacing-component($ds-sc-x4);
30
+ &:last-child {
31
+ padding-right: 0;
32
+ }
33
+
34
+ @include ds-mq-largest-breakpoint(mobile) {
35
+ width: calc(50% - ds-spacing-component($ds-sc-x4) / 2);
36
+ flex: auto;
37
+ // if a teaser is both third and last child it has the row by itself and should be full width
38
+ &:nth-child(3):last-child {
39
+ flex: 1;
40
+ }
41
+ &:nth-child(2) {
42
+ padding-right: 0;
43
+ }
44
+ }
45
+
46
+ &:nth-child(3),
47
+ &:nth-child(4) {
48
+ @include ds-spacing-layout($ds-sl-teaser-vertical, margin-top);
49
+ @include ds-spacing-layout($ds-sl-teaser-vertical, padding-top);
50
+ border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
51
+
52
+ @include ds-mq-smallest-breakpoint(tablet) {
53
+ margin-top: 0;
54
+ padding-top: 0;
55
+ border-top: none;
56
+ }
57
+ }
58
+
59
+ .ds-teaser__title {
60
+ @include ds-typography($ds-typography-expressive-heading02bold);
61
+ }
62
+
63
+ .ds-teaser__media {
64
+ @include ds-mq-largest-breakpoint(mobile) {
65
+ margin-bottom: ds-spacing-component($ds-sc-x2);
66
+
67
+ .ds-teaser-image__byline {
68
+ display: none;
69
+ }
70
+ }
71
+
72
+ @include ds-mq-smallest-breakpoint(tablet) {
73
+ margin-bottom: ds-spacing-component($ds-sc-x3);
74
+ }
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,49 @@
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 (PROD): [TeaserStandard > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserstandard-web)
3
+ - Storybook (LATEST): [TeaserStandard > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserstandard-web)
4
+
5
+ ----
6
+
7
+ # teaser-standard
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
+ |variant | String | no | "default" or "podd" | "default" | |
16
+ |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
18
+ |text | String | no | | | Teaser subtext |
19
+ |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
+ |isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
25
+ |isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
26
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
27
+ |classNames | String | no | | | Ex. "my-special-class" |
28
+ |~forcePx~ | | | | | Not supported |
29
+
30
+ ## Minimum requirement example
31
+
32
+ ### Nunjucks
33
+
34
+ These are copy paste friendly examples to quickliy get started using a component.
35
+
36
+ ```html
37
+ {% from '@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard.njk' import TeaserStandard %}
38
+
39
+ {{ TeaserStandard({
40
+ title: "Upp på börsen",
41
+ text: "Det ser ganska normalt ut på Stockholmsbörsen.",
42
+ highlight: "Ekonominytt:"
43
+ })}}
44
+ ```
45
+
46
+ ### SCSS
47
+ ```scss
48
+ @use "@bonniernews/dn-design-system-web/components/teaser-standard/teaser-standard" as *;
49
+ ```
@@ -0,0 +1,81 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
+ {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
+
5
+ {% macro TeaserStandard(params) %}
6
+ {% set componentClassName = "ds-teaser" %}
7
+ {% set classNamePrefix = componentClassName + "--" %}
8
+ {% set additionalClasses = ["ds-teaser--standard"] %}
9
+ {% set attributes = getAttributes(params.attributes) %}
10
+
11
+ {% if params.variant %}
12
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
13
+ {% endif %}
14
+
15
+ {% if params.theme %}
16
+ {% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
17
+ {% endif %}
18
+
19
+ {% if params.areaType %}
20
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
21
+ {% endif %}
22
+
23
+ {% if params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
24
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "quote-badge"), additionalClasses) %}
25
+ {% endif %}
26
+
27
+ {% if params.classNames %}
28
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
29
+ {% endif%}
30
+
31
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
32
+
33
+ <a href="{{ params.targetLink }}"
34
+ class="{{ classes }}"
35
+ {{- attributes | safe }}>
36
+
37
+ {% if params.isLocked and not params.mediaHtml and params.isItalicHeadline %}
38
+ {{ VipBadge({
39
+ showText: false,
40
+ forcePx: true
41
+ }) }}
42
+ {% endif %}
43
+
44
+ <div class="{{ componentClassName + '__content'}}">
45
+ {% if params.vignette %}
46
+ <div class="ds-teaser__vignette">{{ params.vignette }}</div>
47
+ {% endif %}
48
+
49
+ <h2 class="{{ componentClassName + '__title'}} {{ componentClassName + '__title--italic' if params.isItalicHeadline}}">
50
+ {% if params.highlight %}
51
+ <span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
52
+ {% endif %}
53
+ {{ params.title | safe }}
54
+ </h2>
55
+
56
+ {% if params.text and params.areaType !== "right" %}
57
+ <p class="{{ componentClassName + '__text' }}">
58
+ {{ TeaserDot({ flashing: params.isFlashingDot }) }}
59
+ {% if params.sticker %}
60
+ <span class="ds-teaser__sticker">
61
+ {{ params.sticker }}
62
+ </span>
63
+ {% endif %}
64
+ {{ params.text }}
65
+ </p>
66
+ {% endif %}
67
+ </div>
68
+
69
+ {% if params.mediaHtml %}
70
+ <div class="{{ componentClassName + '__media'}}">
71
+ {{ params.mediaHtml }}
72
+ {% if params.isLocked %}
73
+ {{ VipBadge({
74
+ showText: false,
75
+ forcePx: true
76
+ }) }}
77
+ {% endif %}
78
+ </div>
79
+ {% endif %}
80
+ </a>
81
+ {% endmacro %}
@@ -0,0 +1,38 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss" as *;
3
+
4
+ .ds-teaser.ds-teaser--standard {
5
+ display: flex;
6
+
7
+ @include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
8
+
9
+ .ds-teaser__title {
10
+ @include ds-typography($ds-typography-expressive-heading03bold);
11
+
12
+ &--italic {
13
+ @include ds-typography($ds-typography-expressive-heading03italicregular);
14
+ }
15
+ }
16
+
17
+ .ds-teaser__media {
18
+ margin-left: ds-spacing-component($ds-sc-x4);
19
+
20
+ @include ds-mq-largest-breakpoint(mobile) {
21
+ min-width: 104px;
22
+ max-width: 104px;
23
+
24
+ .ds-teaser-image__byline {
25
+ display: none;
26
+ }
27
+ }
28
+
29
+ @include ds-mq-smallest-breakpoint(tablet) {
30
+ min-width: 196px;
31
+ max-width: 196px;
32
+ }
33
+
34
+ .teaser__video {
35
+ max-width: 100%;
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,41 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-tipsa](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-tipsa)
2
+ - Storybook (PROD): [TeaserTipsa > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teasertipsa-web)
3
+ - Storybook (LATEST): [TeaserTipsa > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teasertipsa-web)
4
+
5
+ ----
6
+
7
+ # teaser-tipsa
8
+
9
+ It's quite common to include a dot in the title string, like "• This is a title"
10
+
11
+ ## Parameters
12
+
13
+ |parameter | type | required | options | default | description |
14
+ |:--- | :--- | :--- | :--- | :--- | :--- |
15
+ |title | String | yes | | | Heading of the teaser |
16
+ |targetLink | String | yes | | | Target URL for the teaser |
17
+ |text | String | no | | | Teaser subtext |
18
+ |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
19
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
20
+ |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
21
+ |classNames | String | no | | | Ex. "my-special-class" |
22
+ |~forcePx~ | | | | | Not supported |
23
+
24
+ ## Minimum requirement example
25
+
26
+ ### Nunjucks
27
+
28
+ These are copy paste friendly examples to quickliy get started using a component.
29
+
30
+ ```html
31
+ {% from '@bonniernews/dn-design-system-web/components/teaser-tipsa/teaser-tipsa.njk' import TeaserTipsa %}
32
+
33
+ {{ TeaserTipsa({
34
+ title: "• Jessie Ware låter den fullödiga fullängdaren vänta på sig",
35
+ })}}
36
+ ```
37
+
38
+ ### SCSS
39
+ ```scss
40
+ @use "@bonniernews/dn-design-system-web/components/teaser-tipsa/teaser-tipsa" as *;
41
+ ```
@@ -0,0 +1,31 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+
3
+ {% macro TeaserTipsa(params) %}
4
+ {% set componentClassName = "ds-teaser" %}
5
+ {% set classNamePrefix = componentClassName + "--" %}
6
+ {% set additionalClasses = ["ds-teaser--tipsa"] %}
7
+ {% set attributes = getAttributes(params.attributes) %}
8
+
9
+ {% if params.classNames %}
10
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
11
+ {% endif%}
12
+
13
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
14
+
15
+ <a href="{{ params.targetLink }}"
16
+ class="{{ classes }}"
17
+ {{- attributes | safe }}>
18
+
19
+ <div class="{{ componentClassName + '__content'}}">
20
+ <h2 class="ds-teaser__title">
21
+ {{ params.title | safe }}
22
+ </h2>
23
+
24
+ {% if params.text %}
25
+ <p class="{{ componentClassName + '__text'}}">
26
+ {{ params.text | safe }}
27
+ </p>
28
+ {% endif %}
29
+ </div>
30
+ </a>
31
+ {% endmacro %}
@@ -0,0 +1,23 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../../assets/teaser/teaser.scss" as *;
3
+
4
+ .ds-teaser.ds-teaser--tipsa {
5
+ .ds-teaser__content {
6
+ @include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
7
+ }
8
+
9
+ .ds-teaser__title {
10
+ @include ds-typography($ds-typography-expressive-heading02bold);
11
+ }
12
+
13
+ @include ds-hover(true) {
14
+ .ds-teaser__title {
15
+ @include ds-underline(2px, 1px);
16
+ }
17
+ }
18
+
19
+ .ds-teaser__text {
20
+ margin-top: 0;
21
+ @include ds-typography($ds-typography-functional-body02regular);
22
+ }
23
+ }
@@ -1,65 +1,62 @@
1
- {% from '@bonniernews/dn-design-system-web/foundations/icons/icon.njk' import Icon %}
1
+ {% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
2
2
  {% from '@bonniernews/dn-design-system-web/components/spinner/spinner.njk' import Spinner %}
3
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
3
4
 
4
5
  {% macro TextButton(params) %}
5
- {% set componentClassName = "ds-text-btn" %}
6
- {% set classNamePrefix = componentClassName + "--" %}
7
- {% set variant = [] %}
8
- {% set text = params.text %}
9
- {% set attributes %}
10
- {% for attribute, value in params.attributes %}
11
- {{attribute}}="{{value}}"
12
- {% endfor %}
13
- {% endset %}
14
-
15
- {% if params.forcePx %}
16
- {% set variant = (variant.push("ds-force-px"), variant) %}
6
+ {%- set componentClassName = "ds-text-btn" %}
7
+ {%- set classNamePrefix = componentClassName + "--" %}
8
+ {%- set additionalClasses = [] %}
9
+ {%- set text = params.text %}
10
+ {%- set attributes = getAttributes(params.attributes) %}
11
+ {%- set ariaLabel = 'aria-label="' + text + '"' if not params.attributes["aria-label"] else "" %}
12
+
13
+ {%- if params.forcePx %}
14
+ {% set additionalClasses = (additionalClasses.push("ds-force-px"), additionalClasses) %}
17
15
  {% endif %}
18
16
 
19
- {% if params.fullWidth %}
20
- {% set variant = (variant.push(classNamePrefix + "full-width"), variant) %}
17
+ {%- if params.fullWidth %}
18
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "full-width"), additionalClasses) %}
21
19
  {% endif %}
22
20
 
23
- {% if params.condensed and not params.fullWidth %}
24
- {% set variant = (variant.push(classNamePrefix + "condensed"), variant) %}
21
+ {%- if params.condensed and not params.fullWidth %}
22
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "condensed"), additionalClasses) %}
25
23
  {% endif %}
26
24
 
27
- {% if params.mobile and params.mobile.fullWidth %}
28
- {% set variant = (variant.push(classNamePrefix + "mobile-full-width"), variant) %}
25
+ {%- if params.mobile and params.mobile.fullWidth %}
26
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "mobile-full-width"), additionalClasses) %}
29
27
  {% endif %}
30
28
 
31
- {% if params.iconName and params.iconPosition and params.iconPosition != "none" %}
32
- {% set variant = (variant.push(classNamePrefix + "icon" + "-" + params.iconPosition ), variant) %}
33
- {% set iconSvg = Icon({ icon: params.iconName }) %}
29
+ {%- if params.iconName and params.iconPosition and params.iconPosition != "none" %}
30
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + "icon" + "-" + params.iconPosition ), additionalClasses) %}
31
+ {% set iconSvg = IconUse({ icon: params.iconName }) %}
34
32
  {% endif %}
35
33
 
36
- {% set loadingHtml %}
34
+ {%- set loadingHtml %}
37
35
  {{ Spinner({ size: "small", variant: "primary", forcePx: params.forcePx }) }}
38
36
  {% endset %}
39
37
 
40
- {% if params.loading %}
41
- {% set variant = (variant.push("ds-loading"), variant) %}
38
+ {%- if params.loading %}
39
+ {% set additionalClasses = (additionalClasses.push("ds-loading"), additionalClasses) %}
42
40
  {% endif %}
43
41
 
44
- {% if params.classNames %}
45
- {% set variant = (variant.push(params.classNames), variant) %}
42
+ {%- if params.classNames %}
43
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
46
44
  {% endif%}
47
45
 
48
- {% set classes = componentClassName + " " + variant | join(" ") %}
49
-
50
- {% if params.href %}
51
- <a href="{{ params.href | default('#', true) }}" class="{{ classes }}" {{- attributes | safe }}>
52
- <div class="{{ componentClassName + '__inner'}}">
46
+ {%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
47
+ {%- if params.href %}
48
+ <a href="{{ params.href | default('#', true) }}" {{ ariaLabel | safe }} class="{{ classes }}" {{- attributes | safe }}>
49
+ <span class="{{ componentClassName + '__inner'}}" aria-hidden="true">
53
50
  <span class="ds-text-btn__text">{{ text }}</span>
54
51
  {{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
55
- </div>
52
+ </span>
56
53
  </a>
57
- {% else %}
58
- <button type="{{ params.type | default('button') }}" class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
59
- <div class="{{ componentClassName + '__inner'}}">
54
+ {%- else %}
55
+ <button type="{{ params.type | default('button') }}" {{ ariaLabel | safe }} class="{{ classes }}" {{ "disabled" if params.disabled }} {{- attributes | safe }}>
56
+ <span class="{{ componentClassName + '__inner' }}" aria-hidden="true">
60
57
  <span class="ds-text-btn__text">{{ text }}</span>
61
58
  {{- iconSvg | safe if iconSvg -}} {{ loadingHtml | safe }}
62
- </div>
59
+ </span>
63
60
  </button>
64
61
  {% endif %}
65
62
  {% endmacro %}