@bonniernews/dn-design-system-web 3.0.0-alpha.9 → 3.0.0-alpha.90
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 +720 -0
- package/assets/article-image/article-image.njk +11 -10
- package/assets/article-image/article-image.scss +1 -15
- package/assets/form-field/form-field.njk +2 -2
- package/assets/form-field/form-field.scss +2 -6
- package/assets/teaser/dot-or-grade.njk +7 -0
- package/assets/teaser/teaser.scss +96 -0
- package/components/article-body-image/README.md +2 -2
- package/components/article-body-image/article-body-image.njk +1 -5
- package/components/article-top-image/README.md +2 -2
- package/components/article-top-image/article-top-image.njk +1 -5
- package/components/article-top-image/article-top-image.scss +1 -1
- package/components/badge/badge.scss +1 -5
- package/components/buddy-menu/buddy-menu.scss +1 -8
- package/components/button/button.njk +38 -43
- package/components/button/button.scss +6 -1
- package/components/button-toggle/button-toggle.js +2 -0
- package/components/button-toggle/button-toggle.njk +36 -36
- package/components/button-toggle/button-toggle.scss +6 -1
- package/components/byline/byline.njk +2 -2
- package/components/byline/byline.scss +1 -3
- package/components/checkbox/checkbox.njk +3 -3
- package/components/checkbox/checkbox.scss +8 -9
- package/components/disclaimer/disclaimer.njk +2 -2
- package/components/disclaimer/disclaimer.scss +23 -10
- package/components/factbox/README.md +2 -2
- package/components/factbox/factbox.njk +12 -24
- package/components/factbox/factbox.scss +16 -51
- package/components/footer/footer.scss +2 -8
- package/components/icon-button/README.md +2 -1
- package/components/icon-button/icon-button.njk +4 -4
- package/components/icon-button/icon-button.scss +5 -2
- package/components/icon-button-toggle/icon-button-toggle.js +2 -0
- package/components/icon-button-toggle/icon-button-toggle.njk +28 -36
- package/components/icon-button-toggle/icon-button-toggle.scss +5 -2
- package/components/icon-sprite/README.md +51 -0
- package/components/icon-sprite/icon-sprite.njk +12 -0
- package/components/icon-sprite/icon-sprite.scss +12 -0
- package/components/icon-with-wrapper/README.md +9 -2
- package/components/icon-with-wrapper/icon-with-wrapper.njk +2 -2
- package/components/icon-with-wrapper/icon-with-wrapper.scss +2 -1
- package/components/image-caption/README.md +38 -0
- package/components/image-caption/image-caption.njk +36 -0
- package/components/image-caption/image-caption.scss +25 -0
- package/components/list-item/list-item.njk +5 -5
- package/components/list-item/list-item.scss +1 -3
- package/components/pictogram/README.md +39 -0
- package/components/pictogram/pictogram.njk +30 -0
- package/components/pictogram/pictogram.scss +54 -0
- package/components/quote/README.md +1 -2
- package/components/quote/quote.njk +6 -8
- package/components/quote/quote.scss +1 -14
- package/components/radio-button/radio-button.njk +3 -3
- package/components/radio-button/radio-button.scss +8 -10
- package/components/spinner/spinner.njk +19 -23
- package/components/spinner/spinner.scss +4 -1
- package/components/teaser-dot/README.md +34 -0
- package/components/teaser-dot/teaser-dot.njk +24 -0
- package/components/teaser-dot/teaser-dot.scss +39 -0
- package/components/teaser-image/README.md +40 -0
- package/components/teaser-image/teaser-image.njk +21 -0
- package/components/teaser-image/teaser-image.scss +21 -0
- package/components/teaser-large/README.md +52 -0
- package/components/teaser-large/teaser-large.njk +96 -0
- package/components/teaser-large/teaser-large.scss +139 -0
- package/components/teaser-onsite/README.md +45 -0
- package/components/teaser-onsite/teaser-onsite.njk +45 -0
- package/components/teaser-onsite/teaser-onsite.scss +33 -0
- package/components/teaser-package/README.md +42 -0
- package/components/teaser-package/teaser-package.njk +39 -0
- package/components/teaser-package/teaser-package.scss +114 -0
- package/components/teaser-right-now/README.md +37 -0
- package/components/teaser-right-now/teaser-right-now.njk +29 -0
- package/components/teaser-right-now/teaser-right-now.scss +57 -0
- package/components/teaser-slideshow/README.md +42 -0
- package/components/teaser-slideshow/teaser-slideshow.njk +38 -0
- package/components/teaser-slideshow/teaser-slideshow.scss +37 -0
- package/components/teaser-split/README-container.md +40 -0
- package/components/teaser-split/README.md +49 -0
- package/components/teaser-split/teaser-split.njk +93 -0
- package/components/teaser-split/teaser-split.scss +85 -0
- package/components/teaser-standard/README.md +50 -0
- package/components/teaser-standard/teaser-standard.njk +81 -0
- package/components/teaser-standard/teaser-standard.scss +38 -0
- package/components/teaser-tipsa/README.md +41 -0
- package/components/teaser-tipsa/teaser-tipsa.njk +31 -0
- package/components/teaser-tipsa/teaser-tipsa.scss +22 -0
- package/components/text-button/text-button.njk +34 -37
- package/components/text-button/text-button.scss +12 -10
- package/components/text-button-toggle/text-button-toggle.js +2 -0
- package/components/text-button-toggle/text-button-toggle.njk +30 -33
- package/components/text-button-toggle/text-button-toggle.scss +10 -10
- package/components/text-input/text-input.scss +3 -8
- package/components/video-caption/README.md +1 -1
- package/components/video-caption/video-caption.njk +12 -6
- package/components/vip-badge/README.md +35 -0
- package/components/vip-badge/vip-badge.njk +23 -0
- package/components/vip-badge/vip-badge.scss +54 -0
- package/foundations/colors.scss +31 -0
- package/foundations/helpers/README-links.md +1 -1
- package/foundations/helpers/colors.scss +2 -0
- package/foundations/helpers/hover.scss +14 -0
- package/foundations/helpers/links.scss +15 -7
- package/foundations/helpers/typography.scss +22 -2
- package/foundations/icons/grade-icon.njk +50 -11
- package/foundations/icons/icon.njk +172 -143
- package/foundations/icons/sprite.njk +1 -0
- package/foundations/icons/sprite.svg +1 -0
- package/foundations/icons/svg/download.svg +3 -0
- package/foundations/icons/svg/filter_list.svg +3 -0
- package/foundations/icons/svg/pause.svg +3 -0
- package/foundations/icons/svg/system_update.svg +3 -0
- package/foundations/icons/svg/vip.svg +3 -0
- package/foundations/typography/fontDefinitions.scss +82 -67
- package/foundations/variables/colorsCssVariables.scss +6 -0
- package/foundations/variables/colorsDnDarkTokens.scss +7 -1
- package/foundations/variables/colorsDnLightTokens.scss +8 -2
- package/foundations/variables/spacingLayout.scss +6 -1
- package/foundations/variables/spacingLayoutLargeScreen.scss +5 -0
- package/foundations/variables/spacingLayoutList.scss +5 -0
- package/foundations/variables/typographyTokensList.scss +5 -0
- package/foundations/variables/typographyTokensScreenExtraLarge.scss +571 -0
- package/foundations/variables/typographyTokensScreenLarge.scss +133 -100
- package/foundations/variables/typographyTokensScreenSmall.scss +147 -114
- package/package.json +2 -2
- package/tokens/colors-css-variables.json +6 -0
- package/tokens/spacing-layout-list.json +6 -1
- package/foundations/icons/icon-sprite.svg +0 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-large](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-large)
|
|
2
|
+
- Storybook (PROD): [TeaserLarge > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserlarge-web)
|
|
3
|
+
- Storybook (LATEST): [TeaserLarge > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserlarge-web)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-large
|
|
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
|
+
|grade | String | no | | | zero, one, two, three, four, five, none |
|
|
23
|
+
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
24
|
+
|bylineHtml | HTML String | no | | | Side image of the author |
|
|
25
|
+
|isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
|
|
26
|
+
|isLargeHeadline | bool | no | true, false | false | If the headline should be large. Only has an effect if `isItalicHeadline` is true. |
|
|
27
|
+
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
28
|
+
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
29
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
30
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
31
|
+
|~forcePx~ | | | | | Not supported |
|
|
32
|
+
|
|
33
|
+
## Minimum requirement example
|
|
34
|
+
|
|
35
|
+
### Nunjucks
|
|
36
|
+
|
|
37
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-large/teaser-large.njk' import TeaserLarge %}
|
|
41
|
+
|
|
42
|
+
{{ TeaserLarge({
|
|
43
|
+
title: "Upp på börsen",
|
|
44
|
+
text: "Det ser ganska normalt ut på Stockholmsbörsen.",
|
|
45
|
+
highlight: "Ekonominytt:"
|
|
46
|
+
})}}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### SCSS
|
|
50
|
+
```scss
|
|
51
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-large/teaser-large" as *;
|
|
52
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
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/assets/teaser/dot-or-grade.njk' import getDotOrGrade %}
|
|
4
|
+
|
|
5
|
+
{% macro TeaserLarge(params) %}
|
|
6
|
+
{% set componentClassName = "ds-teaser" %}
|
|
7
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
8
|
+
{% set additionalClasses = ["ds-teaser--large"] %}
|
|
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 not params.bylineHtml and params.isItalicHeadline %}
|
|
24
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + "quote-badge"), additionalClasses) %}
|
|
25
|
+
{% endif %}
|
|
26
|
+
|
|
27
|
+
{% if params.mediaHtml %}
|
|
28
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + 'top-img'), additionalClasses) %}
|
|
29
|
+
{% endif %}
|
|
30
|
+
|
|
31
|
+
{% if params.classNames %}
|
|
32
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
33
|
+
{% endif%}
|
|
34
|
+
|
|
35
|
+
{% if params.isItalicHeadline and params.isLargeHeadline and params.areaType !== "right" %}
|
|
36
|
+
{% set additionalClasses = (additionalClasses.push("ds-teaser--large-big-italic"), additionalClasses) %}
|
|
37
|
+
{% elif params.isItalicHeadline %}
|
|
38
|
+
{% set additionalClasses = (additionalClasses.push("ds-teaser--large-italic"), additionalClasses) %}
|
|
39
|
+
{% endif %}
|
|
40
|
+
|
|
41
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
42
|
+
|
|
43
|
+
<a href="{{ params.targetLink }}"
|
|
44
|
+
class="{{ classes }}"
|
|
45
|
+
{{- attributes | safe }}>
|
|
46
|
+
|
|
47
|
+
{% if params.mediaHtml %}
|
|
48
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
49
|
+
{{ params.mediaHtml }}
|
|
50
|
+
{% if params.isLocked %}
|
|
51
|
+
{{ VipBadge({
|
|
52
|
+
showText: true,
|
|
53
|
+
forcePx: true
|
|
54
|
+
}) }}
|
|
55
|
+
{% endif %}
|
|
56
|
+
</div>
|
|
57
|
+
{% elif params.isItalicHeadline and params.isLocked %}
|
|
58
|
+
{{ VipBadge({
|
|
59
|
+
showText: false,
|
|
60
|
+
forcePx: true
|
|
61
|
+
}) }}
|
|
62
|
+
{% endif %}
|
|
63
|
+
|
|
64
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
65
|
+
<div class="ds-teaser__content-inner">
|
|
66
|
+
{% if params.vignette %}
|
|
67
|
+
<div class="ds-teaser__vignette">{{ params.vignette }}</div>
|
|
68
|
+
{% endif %}
|
|
69
|
+
<h2 class="ds-teaser__title">
|
|
70
|
+
{% if params.highlight %}
|
|
71
|
+
<span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
|
|
72
|
+
{% endif %}
|
|
73
|
+
{{ params.title }}
|
|
74
|
+
</h2>
|
|
75
|
+
|
|
76
|
+
{% if params.text and params.areaType !== "right" %}
|
|
77
|
+
<p class="{{ componentClassName + '__text' }}">
|
|
78
|
+
{{ getDotOrGrade({ flashing: params.isFlashingDot, grade: params.grade }) }}
|
|
79
|
+
{% if params.sticker %}
|
|
80
|
+
<span class="ds-teaser__sticker">
|
|
81
|
+
{{ params.sticker }}
|
|
82
|
+
</span>
|
|
83
|
+
{% endif %}
|
|
84
|
+
{{ params.text }}
|
|
85
|
+
</p>
|
|
86
|
+
{% endif %}
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
{% if params.bylineHtml %}
|
|
90
|
+
<div class="{{ componentClassName + '__byline'}}">
|
|
91
|
+
{{ params.bylineHtml | safe }}
|
|
92
|
+
</div>
|
|
93
|
+
{% endif %}
|
|
94
|
+
</div>
|
|
95
|
+
</a>
|
|
96
|
+
{% endmacro %}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
+
|
|
4
|
+
.ds-teaser.ds-teaser--large {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
.ds-teaser__media {
|
|
10
|
+
video {
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ds-teaser__content {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
@include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
|
|
19
|
+
|
|
20
|
+
// Special case for large teaser, should be replaced with dynamic spacing layout token when available
|
|
21
|
+
@include ds-mq-only-breakpoint(mobile) {
|
|
22
|
+
padding-bottom: ds-spacing-component($ds-sc-x3);
|
|
23
|
+
}
|
|
24
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
25
|
+
padding-bottom: ds-spacing-component($ds-sc-x4);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-teaser__content-inner {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
flex: 1;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:focus-visible {
|
|
36
|
+
outline: none !important;
|
|
37
|
+
|
|
38
|
+
.ds-teaser__content {
|
|
39
|
+
@include ds-teaser-focus(-8px, false);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-teaser__title {
|
|
44
|
+
@include ds-typography($ds-typography-expressive-heading04bold);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@include ds-hover(true) {
|
|
48
|
+
.ds-teaser__title {
|
|
49
|
+
@include ds-underline(3px);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.ds-teaser--large-big-italic {
|
|
54
|
+
.ds-teaser__title {
|
|
55
|
+
@include ds-typography($ds-typography-expressive-heading04italicregular);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.ds-teaser--large-italic {
|
|
60
|
+
.ds-teaser__title {
|
|
61
|
+
@include ds-typography($ds-typography-expressive-heading03italicregular);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@include ds-hover(true) {
|
|
65
|
+
.ds-teaser__title {
|
|
66
|
+
@include ds-underline();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ds-teaser__byline {
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
position: relative;
|
|
74
|
+
margin-left: ds-spacing-component($ds-sc-x4);
|
|
75
|
+
|
|
76
|
+
// margin-bottom needs to be the negative value of padding-bottom on .ds-teaser__content
|
|
77
|
+
@include ds-mq-only-breakpoint(mobile) {
|
|
78
|
+
margin-bottom: ds-spacing-component($ds-sc-x3, "px", true);
|
|
79
|
+
}
|
|
80
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
81
|
+
margin-bottom: ds-spacing-component($ds-sc-x4, "px", true);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.picture {
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: 0;
|
|
87
|
+
right: 0;
|
|
88
|
+
bottom: 0;
|
|
89
|
+
width: 100%;
|
|
90
|
+
min-width: 96px;
|
|
91
|
+
margin: 0;
|
|
92
|
+
|
|
93
|
+
> .picture__img {
|
|
94
|
+
margin: 0;
|
|
95
|
+
top: unset;
|
|
96
|
+
max-height: unset;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
101
|
+
width: 96px;
|
|
102
|
+
min-height: 96px;
|
|
103
|
+
margin-left: ds-spacing-component($ds-sc-x2);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
107
|
+
width: 144px;
|
|
108
|
+
// En bylinebild bör va lika hög som en "grekisk byst" - man ska se lite skjortkrage!
|
|
109
|
+
min-height: 110px;
|
|
110
|
+
margin-left: ds-spacing-component($ds-sc-x4);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
115
|
+
&.ds-teaser--right {
|
|
116
|
+
.ds-teaser__title {
|
|
117
|
+
@include ds-typography($ds-typography-expressive-heading02bold);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.ds-teaser--large-italic .ds-teaser__title {
|
|
121
|
+
@include ds-typography(
|
|
122
|
+
$ds-typography-expressive-heading02italicregular
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
@include ds-hover(true) {
|
|
126
|
+
.ds-teaser__title {
|
|
127
|
+
@include ds-underline(2px, 1px);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ds-teaser__byline {
|
|
133
|
+
width: 96px;
|
|
134
|
+
min-height: 96px;
|
|
135
|
+
margin-left: ds-spacing-component($ds-sc-x2);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-onsite](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-onsite)
|
|
2
|
+
- Storybook (PROD): [TeaserOnSite > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaseronsite-web)
|
|
3
|
+
- Storybook (LATEST): [TeaserOnSite > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaseronsite-web)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-onsite
|
|
8
|
+
|
|
9
|
+
Also known as "På Plats-puffen".
|
|
10
|
+
|
|
11
|
+
In the CMS title will be set to a location like "Kiev, Ukraina" or "USA" and text is usually set to some author names like "Jan Banan och Kalle Kula"
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
|parameter | type | required | options | default | description |
|
|
16
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
17
|
+
|title | String | yes | | | Heading of the teaser |
|
|
18
|
+
|targetLink | String | yes | | | Target URL for the teaser |
|
|
19
|
+
|areaType | String | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
|
|
20
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
21
|
+
|text | String | no | | | Teaser subtext |
|
|
22
|
+
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
23
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
24
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
25
|
+
|~forcePx~ | | | | | Not supported |
|
|
26
|
+
|
|
27
|
+
## Minimum requirement example
|
|
28
|
+
|
|
29
|
+
### Nunjucks
|
|
30
|
+
|
|
31
|
+
These are copy paste friendly examples to quickly get started using a component.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-onsite/teaser-onsite.njk' import TeaserOnSite %}
|
|
35
|
+
|
|
36
|
+
{{ TeaserOnSite({
|
|
37
|
+
title: 'Kiev, Ukraina',
|
|
38
|
+
text: 'Henrik Brandão Jönsson och Eduardo Leal'
|
|
39
|
+
})}}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### SCSS
|
|
43
|
+
```scss
|
|
44
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-onsite/teaser-onsite";
|
|
45
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserOnSite(params) %}
|
|
4
|
+
{% set componentClassName = "ds-teaser" %}
|
|
5
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{% set additionalClasses = ["ds-teaser--onsite"] %}
|
|
7
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
8
|
+
|
|
9
|
+
{% if params.theme %}
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
11
|
+
{% endif %}
|
|
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
|
+
{% if params.mediaHtml %}
|
|
28
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
29
|
+
{{ params.mediaHtml }}
|
|
30
|
+
</div>
|
|
31
|
+
{% endif %}
|
|
32
|
+
|
|
33
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
34
|
+
<h2 class="ds-teaser__title">
|
|
35
|
+
PÅ PLATS | {{ params.title }}
|
|
36
|
+
</h2>
|
|
37
|
+
|
|
38
|
+
{% if params.text %}
|
|
39
|
+
<p class="{{ componentClassName + '__text'}}">
|
|
40
|
+
{{ params.text }}
|
|
41
|
+
</p>
|
|
42
|
+
{% endif %}
|
|
43
|
+
</div>
|
|
44
|
+
</a>
|
|
45
|
+
{% endmacro %}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
+
|
|
4
|
+
.ds-teaser.ds-teaser--onsite {
|
|
5
|
+
@include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
|
|
6
|
+
display: flex;
|
|
7
|
+
|
|
8
|
+
.ds-teaser__title {
|
|
9
|
+
color: $ds-theme-color;
|
|
10
|
+
@include ds-typography($ds-typography-detailarticle-label);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include ds-hover(true) {
|
|
14
|
+
.ds-teaser__title {
|
|
15
|
+
text-decoration: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-teaser__text {
|
|
19
|
+
@include ds-underline();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-teaser__text {
|
|
24
|
+
margin-top: 0;
|
|
25
|
+
@include ds-typography($ds-typography-functional-heading01bold);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ds-teaser__media {
|
|
29
|
+
margin-right: ds-spacing-component($ds-sc-x4);
|
|
30
|
+
width: 56px;
|
|
31
|
+
height: 56px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
|areaType | String | no | "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
|
+
|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
|
+
|
|
24
|
+
### Nunjucks
|
|
25
|
+
|
|
26
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-package/teaser-package.njk' import TeaserPackage %}
|
|
30
|
+
|
|
31
|
+
{{ TeaserPackage({
|
|
32
|
+
teasersHtml: "",
|
|
33
|
+
areaType: "bauta",
|
|
34
|
+
vignetteText: "Svensk politik",
|
|
35
|
+
vignetteTargetUrl: "/om/svensk-politik/"
|
|
36
|
+
})}}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### SCSS
|
|
40
|
+
```scss
|
|
41
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-package/teaser-package" as *;
|
|
42
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
{% from '@bonniernews/dn-design-system-web/components/icon-sprite/icon-sprite.njk' import IconUse %}
|
|
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
|
+
{{- attributes | safe }}>
|
|
28
|
+
<span>{{ params.vignetteText }}</span>
|
|
29
|
+
{# To keep the design as close to the old master design as possible, bautaXL does not have an arrow now. But we are hoping it'll make a comeback. #}
|
|
30
|
+
{% if params.areaType != "bautaxl" %}
|
|
31
|
+
{{ IconUse({ icon: "arrow_forward", attributes: {"aria-hidden": true} }) }}
|
|
32
|
+
{% endif %}
|
|
33
|
+
</a>
|
|
34
|
+
{% elif params.vignetteText %}
|
|
35
|
+
<div class="{{ componentClassName + '__vignette'}}">{{ params.vignetteText }}</div>
|
|
36
|
+
{% endif %}
|
|
37
|
+
{{ params.teasersHtml | safe }}
|
|
38
|
+
</div>
|
|
39
|
+
{% endmacro %}
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
> .ds-teaser:first-child:after {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&::after {
|
|
34
|
+
content: "";
|
|
35
|
+
position: absolute;
|
|
36
|
+
height: 100%;
|
|
37
|
+
width: 4px;
|
|
38
|
+
top: 0;
|
|
39
|
+
background-color: $ds-theme-color;
|
|
40
|
+
z-index: 5;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-teaser-package__vignette {
|
|
44
|
+
padding: ds-spacing-component($ds-sc-x3);
|
|
45
|
+
@include ds-spacing-layout($ds-sl-teaser-horizontal, padding-left);
|
|
46
|
+
@include ds-spacing-layout($ds-sl-teaser-horizontal, padding-right);
|
|
47
|
+
@include ds-typography($ds-typography-functional-body02bold);
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: space-between;
|
|
50
|
+
align-items: center;
|
|
51
|
+
background-color: $ds-color-component-secondary;
|
|
52
|
+
|
|
53
|
+
@include ds-hover(true) {
|
|
54
|
+
@include ds-underline(1px, 2px);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@include ds-teaser-focus(-8px);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
a.ds-teaser-package__vignette {
|
|
61
|
+
@include ds-link($ds-link-list);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ds-teaser-package__vignette,
|
|
65
|
+
a.ds-teaser-package__vignette {
|
|
66
|
+
color: $ds-color-text-primary;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.ds-teaser-package--bauta {
|
|
70
|
+
.ds-teaser-package__vignette {
|
|
71
|
+
color: $ds-color-static-white;
|
|
72
|
+
background-color: $ds-theme-color;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.ds-teaser-package--bautaxl {
|
|
77
|
+
&::after {
|
|
78
|
+
background-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ds-teaser-package__vignette {
|
|
82
|
+
color: $ds-color-static-yellow;
|
|
83
|
+
background-color: #2b2b2b; // @todo change to token when available
|
|
84
|
+
@include ds-typography($ds-typography-detailbaota-xl-label);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ds-teaser-package__vignette
|
|
88
|
+
+ .ds-teaser--large:not(.ds-teaser--large-italic):not(.ds-teaser--large-big-italic) {
|
|
89
|
+
.ds-teaser__title {
|
|
90
|
+
@include ds-typography($ds-typography-expressive-heading05bold);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include ds-mq-only-breakpoint(mobile) {
|
|
94
|
+
background-color: #2b2b2b; // @todo change to token when available
|
|
95
|
+
.ds-teaser__title,
|
|
96
|
+
.ds-teaser__text {
|
|
97
|
+
color: $ds-color-static-white;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
& + .ds-teaser::after,
|
|
101
|
+
& + .ds-split-container::after {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.ds-icon {
|
|
109
|
+
width: ds-px-to-rem(24px);
|
|
110
|
+
height: ds-px-to-rem(24px);
|
|
111
|
+
color: currentColor;
|
|
112
|
+
display: inline-flex;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-right-now](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-right-now)
|
|
2
|
+
- Storybook (PROD): [TeaserRightNow > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserrightnow-web--right-now)
|
|
3
|
+
- Storybook (LATEST): [TeaserRightNow > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserrightnow-web--right-now)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-right-now
|
|
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
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
16
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
17
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
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-right-now/teaser-right-now.njk' import TeaserRightNow %}
|
|
28
|
+
|
|
29
|
+
{{ TeaserRightNow({
|
|
30
|
+
title: "Tågtrafiken är avstängd mellan Malmö och Göteborg",
|
|
31
|
+
})}}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### SCSS
|
|
35
|
+
```scss
|
|
36
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-right-now/teaser-right-now" as *;
|
|
37
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserRightNow(params) %}
|
|
4
|
+
{%- set componentClassName = "ds-teaser" %}
|
|
5
|
+
{%- set classNamePrefix = componentClassName + "--" %}
|
|
6
|
+
{%- set additionalClasses = ["ds-teaser--right-now"] %}
|
|
7
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
8
|
+
|
|
9
|
+
{%- if params.classNames %}
|
|
10
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
11
|
+
{% endif%}
|
|
12
|
+
|
|
13
|
+
{%- if params.theme %}
|
|
14
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
15
|
+
{% endif %}
|
|
16
|
+
|
|
17
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
18
|
+
<a href="{{ params.targetLink }}"
|
|
19
|
+
class="{{ classes }}"
|
|
20
|
+
{{- attributes | safe }}>
|
|
21
|
+
|
|
22
|
+
<span class="ds-teaser__right-now-sticker">Just nu</span>
|
|
23
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
24
|
+
<h2 class="ds-teaser__title">
|
|
25
|
+
{{ params.title }}
|
|
26
|
+
</h2>
|
|
27
|
+
</div>
|
|
28
|
+
</a>
|
|
29
|
+
{% endmacro %}
|