@bonniernews/dn-design-system-web 3.0.0-alpha.98 → 4.0.0-alpha.1

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 (52) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/assets/article-image/article-image.njk +1 -1
  3. package/assets/article-image/article-image.scss +1 -1
  4. package/assets/teaser/teaser.scss +11 -1
  5. package/components/byline/README.md +3 -3
  6. package/components/byline/byline.njk +1 -1
  7. package/components/byline/byline.scss +18 -1
  8. package/components/image-caption/image-caption.njk +5 -1
  9. package/components/pictogram/pictogram.scss +4 -1
  10. package/components/teaser-large/teaser-large.njk +5 -3
  11. package/components/teaser-list-timeline/README.md +44 -0
  12. package/components/teaser-list-timeline/teaser-list-timeline.njk +62 -0
  13. package/components/teaser-list-timeline/teaser-list-timeline.scss +80 -0
  14. package/components/teaser-native/README.md +41 -0
  15. package/components/teaser-native/teaser-native.njk +59 -0
  16. package/components/teaser-native/teaser-native.scss +109 -0
  17. package/components/teaser-package/teaser-package.scss +3 -1
  18. package/components/teaser-split/teaser-split.njk +5 -3
  19. package/components/teaser-standard/teaser-standard.njk +17 -15
  20. package/components/teaser-standard/teaser-standard.scss +6 -8
  21. package/foundations/base.scss +3 -3
  22. package/foundations/colors.scss +22 -5
  23. package/foundations/helpers/colors.scss +1 -1
  24. package/foundations/helpers/forward.helpers.scss +0 -1
  25. package/foundations/helpers/opacity.scss +1 -1
  26. package/foundations/helpers/shadows.scss +6 -6
  27. package/foundations/helpers/spacing.scss +2 -2
  28. package/foundations/helpers/typography.scss +12 -10
  29. package/foundations/helpers/utilities.scss +1 -1
  30. package/foundations/icons/icon.njk +25 -0
  31. package/foundations/icons/sprite.njk +1 -1
  32. package/foundations/icons/sprite.svg +1 -1
  33. package/foundations/icons/svg/arrow_upward.svg +3 -0
  34. package/foundations/icons/svg/forward_30.svg +3 -0
  35. package/foundations/icons/svg/link.svg +3 -0
  36. package/foundations/icons/svg/refresh.svg +3 -0
  37. package/foundations/icons/svg/replay_30.svg +3 -0
  38. package/foundations/shadows.scss +5 -5
  39. package/foundations/typography/fontDefinitions.scss +56 -56
  40. package/foundations/variables/typographyTokensList.scss +1 -0
  41. package/foundations/variables/typographyTokensScreenExtraLarge.scss +150 -144
  42. package/foundations/variables/typographyTokensScreenLarge.scss +150 -144
  43. package/foundations/variables/typographyTokensScreenSmall.scss +61 -55
  44. package/package.json +11 -9
  45. package/tokens/colors-dark-mode.json +93 -0
  46. package/tokens/colors-light-mode.json +92 -0
  47. package/tokens/icon-list.json +79 -0
  48. package/tokens/typography-list.json +92 -0
  49. package/.stylelintignore +0 -1
  50. package/.stylelintrc.json +0 -17
  51. package/assets/teaser/dot-or-grade.njk +0 -7
  52. package/foundations/helpers/fontDefinitionsHelper.scss +0 -32
package/CHANGELOG.md CHANGED
@@ -3,6 +3,152 @@
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
+ ## 4.0.0-alpha.1 (2023-08-16)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * **web:** separera web storybook från app (#901)
12
+
13
+ ### Code Refactoring
14
+
15
+ * **web:** separera web storybook från app ([#901](https://github.com/BonnierNews/dn-design-system/issues/901)) ([2ceb1ea](https://github.com/BonnierNews/dn-design-system/commit/2ceb1ea721fb3831a830d4b014ce56b9516995df))
16
+
17
+
18
+
19
+ ## [4.0.0-alpha.0](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.111...@bonniernews/dn-design-system-web@4.0.0-alpha.0) (2023-08-16)
20
+
21
+
22
+ ### ⚠ BREAKING CHANGES
23
+
24
+ * **web:** move web storybook to its own folder and use storybook 7
25
+
26
+ ### Features
27
+
28
+ * **web:** move web storybook to its own folder and use storybook 7 ([0bcdd9a](https://github.com/BonnierNews/dn-design-system/commit/0bcdd9a4775a40f46bb2ef38fda4ec8ab8e7f0fc)), closes [#900](https://github.com/BonnierNews/dn-design-system/issues/900) [#923](https://github.com/BonnierNews/dn-design-system/issues/923) [#933](https://github.com/BonnierNews/dn-design-system/issues/933) [#928](https://github.com/BonnierNews/dn-design-system/issues/928) [#932](https://github.com/BonnierNews/dn-design-system/issues/932) [#935](https://github.com/BonnierNews/dn-design-system/issues/935) [#926](https://github.com/BonnierNews/dn-design-system/issues/926) [#936](https://github.com/BonnierNews/dn-design-system/issues/936) [#909](https://github.com/BonnierNews/dn-design-system/issues/909) [#937](https://github.com/BonnierNews/dn-design-system/issues/937)
29
+
30
+
31
+
32
+ ## 3.0.0-alpha.111 (2023-08-02)
33
+
34
+
35
+ ### Features
36
+
37
+ * **web:** implement `compact` variant of byline ([#917](https://github.com/BonnierNews/dn-design-system/issues/917)) ([05b3515](https://github.com/BonnierNews/dn-design-system/commit/05b3515ad25533fba8ecb0a62b95a5b577388fd7))
38
+
39
+
40
+
41
+ ## [3.0.0-alpha.110](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.109...@bonniernews/dn-design-system-web@3.0.0-alpha.110) (2023-07-31)
42
+
43
+
44
+ ### Features
45
+
46
+ * **web:** update how to set color in pictogram ([#914](https://github.com/BonnierNews/dn-design-system/issues/914)) ([e18ff38](https://github.com/BonnierNews/dn-design-system/commit/e18ff38b8016209a39ae02f2d58a1cabf9a41a62))
47
+
48
+
49
+
50
+ ## [3.0.0-alpha.109](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.108...@bonniernews/dn-design-system-web@3.0.0-alpha.109) (2023-07-04)
51
+
52
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
53
+
54
+
55
+
56
+
57
+
58
+ ## [3.0.0-alpha.108](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.107...@bonniernews/dn-design-system-web@3.0.0-alpha.108) (2023-07-04)
59
+
60
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
61
+
62
+
63
+
64
+
65
+
66
+ ## [3.0.0-alpha.107](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.106...@bonniernews/dn-design-system-web@3.0.0-alpha.107) (2023-07-03)
67
+
68
+
69
+ ### Features
70
+
71
+ * **web:** native teaser ([#897](https://github.com/BonnierNews/dn-design-system/issues/897)) ([72aa565](https://github.com/BonnierNews/dn-design-system/commit/72aa565578581c70f97d16fdd6a817e85a2b14ca))
72
+
73
+
74
+
75
+ ## 3.0.0-alpha.106 (2023-06-29)
76
+
77
+
78
+ ### ⚠ BREAKING CHANGES
79
+
80
+ * **foundations:** Refactor import of typography sets from Figma
81
+
82
+ ### Miscellaneous Chores
83
+
84
+ * **foundations:** skip variable typography sets ([#896](https://github.com/BonnierNews/dn-design-system/issues/896)) ([27e208d](https://github.com/BonnierNews/dn-design-system/commit/27e208d6ee1e00fbad23c581aebf0f9cf1e08377))
85
+
86
+
87
+
88
+ ## [3.0.0-alpha.105](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.104...@bonniernews/dn-design-system-web@3.0.0-alpha.105) (2023-06-21)
89
+
90
+
91
+ ### ⚠ BREAKING CHANGES
92
+
93
+ * **foundations:** new font versions required
94
+
95
+ ### Miscellaneous Chores
96
+
97
+ * **foundations:** update fonts ([#892](https://github.com/BonnierNews/dn-design-system/issues/892)) ([8f974fe](https://github.com/BonnierNews/dn-design-system/commit/8f974fe4e52ee26702885af1f1d4c29b5743cc73))
98
+
99
+
100
+
101
+ ## [3.0.0-alpha.104](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.103...@bonniernews/dn-design-system-web@3.0.0-alpha.104) (2023-06-20)
102
+
103
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
104
+
105
+
106
+
107
+
108
+
109
+ ## [3.0.0-alpha.103](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.102...@bonniernews/dn-design-system-web@3.0.0-alpha.103) (2023-06-20)
110
+
111
+
112
+ ### Bug Fixes
113
+
114
+ * **web:** use correct param for flashing dot ([#890](https://github.com/BonnierNews/dn-design-system/issues/890)) ([52e5d3f](https://github.com/BonnierNews/dn-design-system/commit/52e5d3f1b2878831d0bccbc570a04e052d61bbd0))
115
+
116
+
117
+
118
+ ## 3.0.0-alpha.102 (2023-06-19)
119
+
120
+
121
+ ### Bug Fixes
122
+
123
+ * **web:** float fixes for standard teasers ([#889](https://github.com/BonnierNews/dn-design-system/issues/889)) ([a14c41f](https://github.com/BonnierNews/dn-design-system/commit/a14c41f5f16484442757883b8baa784c4c11d7fa))
124
+
125
+
126
+
127
+ ## [3.0.0-alpha.101](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.100...@bonniernews/dn-design-system-web@3.0.0-alpha.101) (2023-06-15)
128
+
129
+
130
+ ### Bug Fixes
131
+
132
+ * **web:** theme colors should work in darkmode ([#886](https://github.com/BonnierNews/dn-design-system/issues/886)) ([eb8fe1b](https://github.com/BonnierNews/dn-design-system/commit/eb8fe1b3259d6da8e519c0fb19d589e4c3ac505d))
133
+
134
+
135
+
136
+ ## [3.0.0-alpha.100](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.99...@bonniernews/dn-design-system-web@3.0.0-alpha.100) (2023-06-14)
137
+
138
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
139
+
140
+
141
+
142
+
143
+
144
+ ## [3.0.0-alpha.99](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.98...@bonniernews/dn-design-system-web@3.0.0-alpha.99) (2023-06-14)
145
+
146
+ **Note:** Version bump only for package @bonniernews/dn-design-system-web
147
+
148
+
149
+
150
+
151
+
6
152
  ## 3.0.0-alpha.98 (2023-06-13)
7
153
 
8
154
  **Note:** Version bump only for package @bonniernews/dn-design-system-web
@@ -12,7 +12,7 @@
12
12
 
13
13
  <figure class="{{ classes }}" {{- params.attributes | safe }}>
14
14
  {% if params.fullWidth %}
15
- <div class="ds-full-width-element">
15
+ <div class="ds-full-width-element article-full-width-element">
16
16
  {{ params.imageHtml | safe }}
17
17
  </div>
18
18
  {% else %}
@@ -1,5 +1,5 @@
1
1
  @use "../../foundations/helpers/forward.helpers.scss" as *;
2
- @use "../../components/image-caption/image-caption.scss" as *;
2
+ @use "../../components/image-caption/image-caption.scss" as *;
3
3
 
4
4
  .ds-article-image {
5
5
  margin: 0;
@@ -4,6 +4,13 @@
4
4
  @use "../../components/teaser-image/teaser-image.scss";
5
5
  @use "../../components/teaser-dot/teaser-dot.scss";
6
6
 
7
+ // used in standard and native teaser
8
+ $ds-teaser-standard-image-width-mobile: 104px;
9
+ $ds-teaser-standard-image-width-tablet: 156px;
10
+ $ds-teaser-standard-image-width-desktop: 196px;
11
+
12
+ $grade-size: ds-px-to-rem(34px);
13
+
7
14
  .ds-teaser {
8
15
  display: block;
9
16
  background-color: $ds-color-background-primary;
@@ -49,10 +56,13 @@
49
56
  @include ds-mq-smallest-breakpoint(tablet) {
50
57
  margin-top: ds-spacing-component($ds-sc-x3);
51
58
  }
59
+
60
+ &.ds-teaser__text--with-grade {
61
+ min-height: calc($grade-size + ds-spacing-component($ds-sc-x1, "rem"));
62
+ }
52
63
  }
53
64
 
54
65
  .ds-icon.ds-icon--grade {
55
- $grade-size: ds-px-to-rem(34px);
56
66
  color: $ds-color-icon-primary;
57
67
  border-radius: 50%;
58
68
  float: left;
@@ -12,12 +12,12 @@ The byline is a list item and should be wrapped in a list.
12
12
 
13
13
  |parameter | type | required | options | default | description |
14
14
  |:--- | :--- | :--- | :--- | :--- | :--- |
15
- |variant | String | yes | follow, link | | |
15
+ |variant | String | yes | follow, link, compact | | |
16
16
  |authorName | String | yes | | | |
17
17
  |bylineImage | HTML | no | | | Html image from bang. The component only makes the image round. Scaling is up to the user. Should be 44px for non retina screens. |
18
- |role | String | no | | | Only used in variant link |
18
+ |role | String | no | | | Used in variant link and compact |
19
19
  |email | String | no | | | email will be displayed instead of role for variant follow |
20
- |authorPageUrl | String | no | | | The whole item (varant link), or the title and subtitle (variant follow) will link to this url |
20
+ |authorPageUrl | String | no | | | The whole item (varant link and compact), or the title and subtitle (variant follow) will link to this url |
21
21
  |followable | Boolean | no | true, false | true | If true the toggle button to follow will be shown when using variant follow. |
22
22
  |attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
23
23
  |elementAttributes | Object | no | | | Sets attributes on actual toggle element and not byline list item. Same structure as attributes above, for accessability reasons it's important to send in "aria-label": "Följ " + byline.name |
@@ -60,7 +60,7 @@
60
60
  {% set classNamePrefix = componentClassName + "--" %}
61
61
  {% set variant = [] %}
62
62
  {% set attributes = getAttributes(params.attributes) %}
63
- {% set visualVariant = "icon" if (params.variant == 'link' or params.followable != true) and params.authorPageUrl else "button" %}
63
+ {% set visualVariant = "icon" if (params.variant == 'link' or params.variant == 'compact' or params.followable != true) and params.authorPageUrl else "button" %}
64
64
 
65
65
  {% if params.forcePx %}
66
66
  {% set variant = (variant.push("ds-force-px"), variant) %}
@@ -4,6 +4,7 @@
4
4
 
5
5
  $ds-byline__icon-size: 24px;
6
6
  $ds-byline__image-size: 44px;
7
+ $ds-byline__image-size--compact: 36px;
7
8
 
8
9
  .ds-byline__outer {
9
10
  list-style: none;
@@ -127,7 +128,7 @@ $ds-byline__image-size: 44px;
127
128
  }
128
129
 
129
130
  .ds-byline__btn-toggle {
130
- min-height: 44px;
131
+ min-height: $ds-byline__icon-size;
131
132
  min-width: 48px;
132
133
  margin-left: ds-spacing-component($ds-sc-x4);
133
134
  }
@@ -142,6 +143,22 @@ $ds-byline__image-size: 44px;
142
143
  }
143
144
  }
144
145
 
146
+ &.ds-byline--compact {
147
+ .ds-byline__titles {
148
+ .ds-byline__subtitle {
149
+ line-height: ds-spacing-component($ds-sc-x4);
150
+ }
151
+ }
152
+ .ds-byline__image {
153
+ height: $ds-byline__image-size--compact;
154
+ width: $ds-byline__image-size--compact;
155
+ }
156
+
157
+ .ds-byline__btn-toggle {
158
+ min-height: $ds-byline__image-size--compact;
159
+ }
160
+ }
161
+
145
162
  &:active:not(.ds-byline--noninteractive) .ds-byline__inner::before {
146
163
  background-color: $ds-color-component-primary-overlay-02;
147
164
  }
@@ -1,6 +1,10 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+
1
3
  {% macro ImageCaption(params) %}
2
4
  {% set macroClassName = "ds-image-caption" %}
3
5
  {% set additionalClasses = [] %}
6
+ {% set attributes = getAttributes(params.attributes) %}
7
+
4
8
 
5
9
  {% if params.classNames %}
6
10
  {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
@@ -12,7 +16,7 @@
12
16
 
13
17
  {% set classes = macroClassName + " " + additionalClasses | join(" ") %}
14
18
 
15
- <figcaption class="{{ classes }}" {{- params.attributes | safe }}>
19
+ <figcaption class="{{ classes }}" {{- attributes | safe }}>
16
20
  {% if params.caption %}
17
21
  <span aria-hidden="true">{{ params.caption | safe }}</span>
18
22
  {% endif %}
@@ -20,7 +20,6 @@ $ds-pictogram__icon-size--large: 40px;
20
20
  }
21
21
 
22
22
  .ds-icon {
23
- fill: $ds-color-static-black;
24
23
  display: flex;
25
24
  height: ds-px-to-rem($ds-pictogram__icon-size);
26
25
  width: ds-px-to-rem($ds-pictogram__icon-size);
@@ -28,6 +27,10 @@ $ds-pictogram__icon-size--large: 40px;
28
27
  height: $ds-pictogram__icon-size;
29
28
  width: $ds-pictogram__icon-size;
30
29
  }
30
+
31
+ > svg {
32
+ fill: $ds-color-static-black;
33
+ }
31
34
  }
32
35
 
33
36
  &.ds-pictogram--business {
@@ -1,6 +1,7 @@
1
1
  {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
2
  {% from '@bonniernews/dn-design-system-web/components/vip-badge/vip-badge.njk' import VipBadge %}
3
- {% from '@bonniernews/dn-design-system-web/assets/teaser/dot-or-grade.njk' import getDotOrGrade %}
3
+ {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
4
+ {% from '@bonniernews/dn-design-system-web/foundations/icons/grade-icon.njk' import GetGrade %}
4
5
 
5
6
  {% macro TeaserLarge(params) %}
6
7
  {% set componentClassName = "ds-teaser" %}
@@ -74,8 +75,9 @@
74
75
  </h2>
75
76
 
76
77
  {% if params.text and params.areaType !== "right" %}
77
- <p class="{{ componentClassName + '__text' }}">
78
- {{ getDotOrGrade({ flashing: params.isFlashingDot, grade: params.grade }) }}
78
+ {% set gradeHtml = GetGrade({ grade: params.grade, type: "single" }) | trim if params.grade else "" %}
79
+ <p class="{{ componentClassName + '__text' }} {{ componentClassName + '__text--with-grade' if gradeHtml.length }}">
80
+ {{ gradeHtml if gradeHtml.length else TeaserDot({ flashing: params.isFlashingDot }) }}
79
81
  {% if params.sticker %}
80
82
  <span class="ds-teaser__sticker">
81
83
  {{ params.sticker }}
@@ -0,0 +1,44 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-list-timeline](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-list-timeline)
2
+ - Storybook (PROD): [TeaserListTimeline > Web](https://designsystem.dn.se/?path=/story/section-teaserlisttimeline--teaser-list-timeline)
3
+ - Storybook (LATEST): [TeaserListTimeline > Web](https://designsystem-latest.dn.se/?path=/story/section-teaserlisttimeline--teaser-list-timeline)
4
+
5
+ ----
6
+
7
+ # teaser-list-timeline
8
+
9
+ ## Parameters
10
+
11
+ |parameter | type | required | options | default | description |
12
+ |:--- | :--- | :--- | :--- | :--- | :--- |
13
+ |listTitle | String | yes | | | List title |
14
+ |listLink | Object | no | | | Ex. { text: "Alla nyheter", url: "#" } |
15
+ |flexible | bool | no | true, false | false | |
16
+ |teasers | Array | yes | | | Array with teaser objects. Ex. [ { title: 'Malmö var det enda rimliga valet för Eurovision', targetLink: '#', highlight: 'Hanna Fahl:', publicationTime: 'I GÅR 12:28', sectionName: 'Kultur', attributes: { "data-test": "list-item-test-data" } } ] |
17
+ |~areaType~ | String | no | "right" or "bauta" or "bautaxl" | | Not implemented |
18
+ |theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to _all_ teasers in the list |
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-list-timeline/teaser-list-timeline.njk' import TeaserListTimeline %}
31
+
32
+ {{ TeaserListTimeline({
33
+ listTitle: "Senaste nytt",
34
+ listLink: { text: "Alla nyheter", url: "#"},
35
+ flexible: true,
36
+ theme: "ekonomi",
37
+ teasers: [ { title: 'Malmö var det enda rimliga valet för Eurovision', targetLink: '#', highlight: 'Hanna Fahl:', publicationTime: 'I GÅR 12:28', sectionName: 'Kultur', attributes: { "data-test": "list-item-test-data" } } ]
38
+ })}}
39
+ ```
40
+
41
+ ### SCSS
42
+ ```scss
43
+ @use "@bonniernews/dn-design-system-web/components/teaser-list-timeline/teaser-list-timeline" as *;
44
+ ```
@@ -0,0 +1,62 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/button/button.njk' import Button %}
3
+
4
+ {% macro TeaserListTimeline(params) %}
5
+ {% set componentClassName = "ds-teaser-list-timeline" %}
6
+ {% set classNamePrefix = componentClassName + "--" %}
7
+ {% set additionalClasses = [] %}
8
+ {% set attributes = getAttributes(params.attributes) %}
9
+ {% set showButton = params.listLink and params.listLink.text and params.listLink.url %}
10
+
11
+ {% if params.theme %}
12
+ {% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
13
+ {% endif %}
14
+
15
+ {% if params.classNames %}
16
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
17
+ {% endif%}
18
+
19
+ {% if params.flexible %}
20
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + 'flexible'), additionalClasses) %}
21
+ {% endif%}
22
+
23
+ {% if showButton %}
24
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + 'linked'), additionalClasses) %}
25
+ {% endif%}
26
+
27
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
28
+
29
+ <div class="{{ classes }}" {{- attributes | safe }}>
30
+ <h2 class="ds-teaser-list-timeline__vignette">{{ params.listTitle }}</h2>
31
+ <div class="{{ componentClassName + '__content'}}">
32
+ {% for teaser in params.teasers %}
33
+ {{ TeaserListTimelineItem(teaser) }}
34
+ {% endfor %}
35
+ </div>
36
+ {% if showButton %}
37
+ <div class="ds-teaser-list-timeline__link">
38
+ {{ Button({
39
+ text: params.listLink.text,
40
+ href: params.listLink.url,
41
+ variant: 'secondaryFilled',
42
+ fullWidth: true,
43
+ forcePx: false
44
+ })}}
45
+ </div>
46
+ {% endif %}
47
+ </div>
48
+ {% endmacro %}
49
+
50
+ {% macro TeaserListTimelineItem(teaser) %}
51
+ {% set attributes = getAttributes(teaser.attributes) %}
52
+
53
+ <a href="{{teaser.targetLink}}" class="ds-teaser-list-timeline__item" {{- attributes | safe }}>
54
+ <span class="ds-teaser-list-timeline__item-dot"></span>
55
+ <h3 class="ds-teaser-list-timeline__item-title">{{ teaser.highlight }} {{ teaser.title }}</h3>
56
+ {% if teaser.publicationTime or teaser.sectionName %}
57
+ <div class="ds-teaser-list-timeline__item-notes">
58
+ <span>{{ teaser.publicationTime }}<span>{{ " • " if teaser.publicationTime and teaser.sectionName }}<span>{{ teaser.sectionName }}</span>
59
+ </div>
60
+ {% endif %}
61
+ </a>
62
+ {% endmacro %}
@@ -0,0 +1,80 @@
1
+ @use "../../foundations/helpers/forward.helpers.scss" as *;
2
+ @use "../button/button.scss" as *;
3
+
4
+ $ds-teaser-list-timeline-dot-size: ds-px-to-rem(10px);
5
+
6
+ .ds-teaser-list-timeline {
7
+ background-color: $ds-color-surface-background;
8
+
9
+ .ds-teaser-list-timeline__vignette {
10
+ @include ds-typography($ds-typography-functional-body02bold);
11
+ color: $ds-color-text-primary;
12
+ padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4, rem);
13
+ margin: 0;
14
+ }
15
+
16
+ .ds-teaser-list-timeline__link {
17
+ border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
18
+ padding: ds-spacing-component($ds-sc-x4, rem);
19
+ }
20
+
21
+ .ds-teaser-list-timeline__item {
22
+ padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4, rem);
23
+ display: block;
24
+ text-decoration: none;
25
+ border-bottom: ds-metrics-border-width(x1) solid $ds-color-border-primary;
26
+ position: relative;
27
+
28
+ &:last-child {
29
+ border: none;
30
+ }
31
+
32
+ .ds-teaser-list-timeline__item-dot {
33
+ position: absolute;
34
+
35
+ &::before {
36
+ content: "";
37
+ position: absolute;
38
+ top: ds-px-to-rem(6px);
39
+ display: inline-flex;
40
+ box-sizing: border-box;
41
+ background-color: $ds-theme-color;
42
+ border-radius: 50%;
43
+ height: $ds-teaser-list-timeline-dot-size;
44
+ width: $ds-teaser-list-timeline-dot-size;
45
+ }
46
+ }
47
+
48
+ .ds-teaser-list-timeline__item-title,
49
+ .ds-teaser-list-timeline__item-notes {
50
+ margin: 0 0 0 (ds-spacing-component($ds-sc-x2, rem) + $ds-teaser-list-timeline-dot-size);
51
+ }
52
+
53
+ .ds-teaser-list-timeline__item-title {
54
+ @include ds-typography($ds-typography-expressive-heading01bold);
55
+ color: $ds-color-text-primary;
56
+ word-break: break-word;
57
+
58
+ @include ds-hover(true) {
59
+ @include ds-underline(2px, 1px);
60
+ }
61
+ }
62
+
63
+ .ds-teaser-list-timeline__item-notes {
64
+ @include ds-typography($ds-typography-functional-meta02regular);
65
+ color: $ds-color-text-primary-02;
66
+ margin-top: ds-spacing-component($ds-sc-x2, rem);
67
+ }
68
+ }
69
+
70
+ &.ds-teaser-list-timeline--flexible {
71
+ display: flex;
72
+ flex: 1 0 300px;
73
+ flex-direction: column;
74
+ overflow: hidden;
75
+
76
+ .ds-teaser-list-timeline__content {
77
+ overflow-y: auto;
78
+ }
79
+ }
80
+ }
@@ -0,0 +1,41 @@
1
+ - GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-native](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-native)
2
+ - Storybook (PROD): [TeaserNative > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teasernative-web--native)
3
+ - Storybook (LATEST): [TeaserNative > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teasernative-web--native)
4
+
5
+ ----
6
+
7
+ # teaser-native
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
+ |nativeVariant | String | no | "standard" or "large" or "right" | "standard" | |
16
+ |areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
17
+ |text | String | no | | | Teaser subtext |
18
+ |vignette | String | no | | | Top text in the teaser |
19
+ |mediaHtml | HTML String | no | | | Main image or other media |
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
+ These are copy paste friendly examples to quickly get started using a component.
26
+
27
+ ### Nunjucks
28
+ ```html
29
+ {% from '@bonniernews/dn-design-system-web/components/teaser-native/teaser-native.njk' import TeaserNative %}
30
+
31
+ {{ TeaserNative({
32
+ title: "Fossilfri vätgas – en nyckel till minskade koldioxidutsläpp",
33
+ text: "Det blir en viktig konkurrensfördel att kunna leverera produkter som inte skadar klimatet",
34
+ vignette: "Innehåll från Vattenfall"
35
+ })}}
36
+ ```
37
+
38
+ ### SCSS
39
+ ```scss
40
+ @use "@bonniernews/dn-design-system-web/components/teaser-native/teaser-native";
41
+ ```
@@ -0,0 +1,59 @@
1
+ {% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
2
+ {% from '@bonniernews/dn-design-system-web/components/teaser-dot/teaser-dot.njk' import TeaserDot %}
3
+ {% from '@bonniernews/dn-design-system-web/foundations/icons/grade-icon.njk' import GetGrade %}
4
+
5
+ {% macro TeaserNative(params) %}
6
+ {% set componentClassName = "ds-teaser" %}
7
+ {% set classNamePrefix = componentClassName + "--" %}
8
+ {% set additionalClasses = ["ds-teaser--native"] %}
9
+ {% set attributes = getAttributes(params.attributes) %}
10
+ {% set nativeVariant = params.nativeVariant if params.nativeVariant else "standard" %}
11
+ {% set additionalClasses = (additionalClasses.push('ds-teaser--native-' + nativeVariant), additionalClasses) %}
12
+
13
+ {% if params.areaType %}
14
+ {% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
15
+ {% endif %}
16
+
17
+ {% if params.classNames %}
18
+ {% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
19
+ {% endif%}
20
+
21
+ {% set classes = componentClassName + " " + additionalClasses | join(" ") %}
22
+
23
+ <a href="{{ params.targetLink }}"
24
+ class="{{ classes }}"
25
+ {{- attributes | safe }}>
26
+
27
+ <div class="{{ componentClassName + '__ad-bar'}}"><span>ANNONS</span></div>
28
+ {% if params.mediaHtml and nativeVariant !== "standard" %}
29
+ <div class="{{ componentClassName + '__media'}}">
30
+ {{ params.mediaHtml }}
31
+ </div>
32
+ {% endif %}
33
+
34
+ <div class="{{ componentClassName + '__inner'}}">
35
+ <div class="{{ componentClassName + '__content'}}">
36
+ {% if params.mediaHtml and nativeVariant == "standard" %}
37
+ <div class="{{ componentClassName + '__media'}}">
38
+ {{ params.mediaHtml }}
39
+ </div>
40
+ {% endif %}
41
+
42
+ {% if params.vignette %}
43
+ <div class="ds-teaser__vignette">{{ params.vignette }}</div>
44
+ {% endif %}
45
+
46
+ <h2 class="{{ componentClassName + '__title'}}">
47
+ {{ params.title }}
48
+ </h2>
49
+
50
+ {% if params.text and nativeVariant !== "right" %}
51
+ <p class="{{ componentClassName + '__text' }}">
52
+ {{ TeaserDot() }}
53
+ {{ params.text }}
54
+ </p>
55
+ {% endif %}
56
+ </div>
57
+ </div>
58
+ </a>
59
+ {% endmacro %}