@bonniernews/dn-design-system-web 3.0.0-alpha.34 → 3.0.0-alpha.36
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 +17 -0
- package/assets/teaser/sticker.scss +31 -0
- package/assets/teaser/teaser.scss +60 -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 +22 -0
- package/components/teaser-large/README.md +51 -0
- package/components/teaser-large/teaser-large.njk +78 -0
- package/components/teaser-large/teaser-large.scss +122 -0
- package/components/teaser-standard/README.md +49 -0
- package/components/teaser-standard/teaser-standard.njk +70 -0
- package/components/teaser-standard/teaser-standard.scss +44 -0
- package/components/vip-badge/README.md +2 -2
- package/foundations/variables/colorsDnLightTokens.scss +1 -1
- package/foundations/variables/spacingLayout.scss +2 -1
- package/foundations/variables/spacingLayoutLargeScreen.scss +1 -0
- package/foundations/variables/spacingLayoutList.scss +1 -0
- package/package.json +1 -1
- package/tokens/spacing-layout-list.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
## [3.0.0-alpha.36](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.35...@bonniernews/dn-design-system-web@3.0.0-alpha.36) (2023-04-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bonniernews/dn-design-system-web
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 3.0.0-alpha.35 (2023-04-27)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **web:** large and standard teasers ([#763](https://github.com/BonnierNews/dn-design-system/issues/763)) ([0713caa](https://github.com/BonnierNews/dn-design-system/commit/0713caa3c451419e21b185496d8d77726c972bfd))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [3.0.0-alpha.34](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.33...@bonniernews/dn-design-system-web@3.0.0-alpha.34) (2023-04-26)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-sticker {
|
|
4
|
+
display: inline;
|
|
5
|
+
color: $ds-theme-color;
|
|
6
|
+
@include ds-typography($ds-typography-detailarticle-label);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ds-sticker__flashing-dot {
|
|
10
|
+
border-radius: 50%;
|
|
11
|
+
background-color: $ds-theme-color;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
width: ds-px-to-rem(10px);
|
|
14
|
+
height: ds-px-to-rem(10px);
|
|
15
|
+
margin-right: ds-px-to-rem(1px);
|
|
16
|
+
animation: pulse 1.25s ease-in-out infinite;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes pulse {
|
|
20
|
+
0% {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
50% {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
100% {
|
|
29
|
+
opacity: 0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../foundations/icons/icon.scss";
|
|
3
|
+
@use "../../components/vip-badge/vip-badge.scss";
|
|
4
|
+
@use "../../components/teaser-image/teaser-image.scss";
|
|
5
|
+
@use "./sticker.scss";
|
|
6
|
+
|
|
7
|
+
.ds-teaser {
|
|
8
|
+
display: block;
|
|
9
|
+
background-color: $ds-color-background-primary;
|
|
10
|
+
text-decoration: none;
|
|
11
|
+
|
|
12
|
+
.ds-teaser__content {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex: 1;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ds-teaser__vignette {
|
|
19
|
+
display: block;
|
|
20
|
+
@include ds-typography($ds-typography-detailarticle-label);
|
|
21
|
+
color: $ds-theme-color;
|
|
22
|
+
margin-bottom: ds-spacing-component($ds-sc-x1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-teaser__title {
|
|
26
|
+
color: $ds-color-text-primary;
|
|
27
|
+
margin: 0;
|
|
28
|
+
word-break: break-word;
|
|
29
|
+
|
|
30
|
+
.ds-teaser__highlight {
|
|
31
|
+
color: $ds-theme-color;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ds-teaser__text {
|
|
36
|
+
@include ds-typography($ds-typography-detailmedryckare);
|
|
37
|
+
color: $ds-color-text-primary;
|
|
38
|
+
margin: ds-spacing-component($ds-sc-x2 0 0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ds-teaser__media {
|
|
42
|
+
width: 100%;
|
|
43
|
+
position: relative;
|
|
44
|
+
|
|
45
|
+
.ds-vip-badge {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 0;
|
|
48
|
+
right: 0;
|
|
49
|
+
z-index: 100;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@include ds-hover {
|
|
54
|
+
&:hover {
|
|
55
|
+
.ds-teaser__title {
|
|
56
|
+
text-decoration: $ds-text-decoration-link-underline;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-image](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-image)
|
|
2
|
+
- Storybook (PROD): [TeaserImage > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teaserimage-web--teaser-image)
|
|
3
|
+
- Storybook (LATEST): [TeaserImage > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teaserimage-web--teaser-image)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# teaser-image
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|imageHtml | HTML String | yes | | | The img element or equivalent |
|
|
14
|
+
|byline | String | no | | | Media credit text |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
17
|
+
|~forcePx~ | | | | | Always applied |
|
|
18
|
+
|
|
19
|
+
## Minimum requirement example
|
|
20
|
+
|
|
21
|
+
### Nunjucks
|
|
22
|
+
|
|
23
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-image/teaser-image.njk' import TeaserImage %}
|
|
27
|
+
|
|
28
|
+
{{ TeaserImage({
|
|
29
|
+
imageHtml: "<img src='??'>",
|
|
30
|
+
byline: "Foto: Paul Hansen"
|
|
31
|
+
})}}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### SCSS
|
|
35
|
+
```scss
|
|
36
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-image/teaser-image" as *;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This scss is already included in `teaser.scss`.
|
|
40
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{% from '@bonniernews/dn-design-system-web/njk-helpers/attributes.njk' import getAttributes %}
|
|
2
|
+
|
|
3
|
+
{% macro TeaserImage(params) %}
|
|
4
|
+
{% set macroClassName = "ds-teaser-image" %}
|
|
5
|
+
{% set additionalClasses = [] %}
|
|
6
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
7
|
+
|
|
8
|
+
{% if params.classNames %}
|
|
9
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
10
|
+
{% endif %}
|
|
11
|
+
|
|
12
|
+
{% set classes = macroClassName + " " + additionalClasses | join(" ") %}
|
|
13
|
+
|
|
14
|
+
<figure class="{{ classes }}" {{- attributes | safe }}>
|
|
15
|
+
{{ params.imageHtml | safe }}
|
|
16
|
+
|
|
17
|
+
{% if params.byline %}
|
|
18
|
+
<figcaption class={{ macroClassName + "__byline" }}>{{ params.byline }}</figcaption>
|
|
19
|
+
{% endif %}
|
|
20
|
+
</figure>
|
|
21
|
+
{% endmacro %}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
|
|
3
|
+
.ds-teaser-image {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: 100%;
|
|
6
|
+
margin: 0;
|
|
7
|
+
|
|
8
|
+
.ds-teaser-image__byline {
|
|
9
|
+
position: absolute;
|
|
10
|
+
bottom: ds-spacing-component($ds-sc-x2);
|
|
11
|
+
right: ds-spacing-component($ds-sc-x2);
|
|
12
|
+
padding: ds-spacing-component($ds-sc-x1 $ds-sc-x2);
|
|
13
|
+
margin-left: ds-spacing-component($ds-sc-x2);
|
|
14
|
+
|
|
15
|
+
@include ds-typography($ds-typography-functional-meta01regular, true);
|
|
16
|
+
color: $ds-color-static-white;
|
|
17
|
+
|
|
18
|
+
background-color: $ds-color-static-transparent-black;
|
|
19
|
+
border-radius: ds-metrics-border-radius(x2);
|
|
20
|
+
z-index: 150;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
|targetId | String | no | | | Target article ID |
|
|
16
|
+
|variant | String | no | "default" or "podd" | "default" | |
|
|
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
|
+
|bylineHtml | HTML String | no | | | Side image of the author |
|
|
24
|
+
|isItalicHeadline | bool | no | true, false | false | If the headline should be italic |
|
|
25
|
+
|isLargeHeadline | bool | no | true, false | false | If the headline should be large. Only has an effect if `isItalicHeadline` is true. |
|
|
26
|
+
|isFlashingDot | bool | no | true, false | false | If there should be a flashing ball before the text |
|
|
27
|
+
|isLocked | bool | no | true, false | false | If the paywall indicator should be shown. It is only shown if the teaser has an image. |
|
|
28
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
29
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
30
|
+
|~forcePx~ | | | | | Not supported |
|
|
31
|
+
|
|
32
|
+
## Minimum requirement example
|
|
33
|
+
|
|
34
|
+
### Nunjucks
|
|
35
|
+
|
|
36
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
{% from '@bonniernews/dn-design-system-web/components/teaser-large/teaser-large.njk' import TeaserLarge %}
|
|
40
|
+
|
|
41
|
+
{{ TeaserLarge({
|
|
42
|
+
title: "Upp på börsen",
|
|
43
|
+
text: "Det ser ganska normalt ut på Stockholmsbörsen.",
|
|
44
|
+
highlight: "Ekonominytt:"
|
|
45
|
+
})}}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### SCSS
|
|
49
|
+
```scss
|
|
50
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-large/teaser-large" as *;
|
|
51
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
|
|
4
|
+
{% macro TeaserLarge(params) %}
|
|
5
|
+
{% set componentClassName = "ds-teaser" %}
|
|
6
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
7
|
+
{% set additionalClasses = ["ds-teaser--large"] %}
|
|
8
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
9
|
+
|
|
10
|
+
{% if params.variant %}
|
|
11
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), 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
|
+
{% if params.isItalicHeadline and params.isLargeHeadline %}
|
|
23
|
+
{% set additionalClasses = (additionalClasses.push("ds-teaser--large-big-italic"), additionalClasses) %}
|
|
24
|
+
{% elif params.isItalicHeadline %}
|
|
25
|
+
{% set additionalClasses = (additionalClasses.push("ds-teaser--large-italic"), additionalClasses) %}
|
|
26
|
+
{% endif %}
|
|
27
|
+
|
|
28
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
29
|
+
|
|
30
|
+
<a href="{{ params.targetLink }}"
|
|
31
|
+
class="{{ classes }}"
|
|
32
|
+
{% if targetId %} data-id="{{ params.targetId }}" {% endif %}
|
|
33
|
+
{{- attributes | safe }}>
|
|
34
|
+
|
|
35
|
+
{% if params.mediaHtml %}
|
|
36
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
37
|
+
{{ params.mediaHtml }}
|
|
38
|
+
{% if params.isLocked %}
|
|
39
|
+
{{ VipBadge({
|
|
40
|
+
showText: true,
|
|
41
|
+
forcePx: true
|
|
42
|
+
}) }}
|
|
43
|
+
{% endif %}
|
|
44
|
+
</div>
|
|
45
|
+
{% endif %}
|
|
46
|
+
|
|
47
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
48
|
+
{% if params.vignette %}
|
|
49
|
+
<div class="ds-teaser__vignette">{{ params.vignette }}</div>
|
|
50
|
+
{% endif %}
|
|
51
|
+
<h2 class="ds-teaser__title">
|
|
52
|
+
{% if params.highlight %}
|
|
53
|
+
<span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
|
|
54
|
+
{% endif %}
|
|
55
|
+
{{ params.title | safe }}
|
|
56
|
+
</h2>
|
|
57
|
+
|
|
58
|
+
{% if params.text %}
|
|
59
|
+
<p class="{{ componentClassName + '__text'}}">
|
|
60
|
+
{% if params.isFlashingDot %}
|
|
61
|
+
<span class="ds-sticker__flashing-dot"></span>
|
|
62
|
+
{% endif %}
|
|
63
|
+
{% if params.sticker %}
|
|
64
|
+
<span class="ds-sticker">
|
|
65
|
+
{{ params.sticker }}
|
|
66
|
+
</span>
|
|
67
|
+
{% endif %}
|
|
68
|
+
{{ params.text | safe }}
|
|
69
|
+
</p>
|
|
70
|
+
{% endif %}
|
|
71
|
+
{% if params.bylineHtml %}
|
|
72
|
+
<div class="{{ componentClassName + '__byline'}}">
|
|
73
|
+
{{ params.bylineHtml | safe }}
|
|
74
|
+
</div>
|
|
75
|
+
{% endif %}
|
|
76
|
+
</div>
|
|
77
|
+
</a>
|
|
78
|
+
{% endmacro %}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
+
|
|
4
|
+
.ds-teaser.ds-teaser--large {
|
|
5
|
+
display: block;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
.ds-teaser__media {
|
|
9
|
+
video {
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ds-teaser__content {
|
|
15
|
+
flex: 1;
|
|
16
|
+
display: grid;
|
|
17
|
+
grid-auto-rows: auto;
|
|
18
|
+
grid-template-columns: 1fr auto;
|
|
19
|
+
|
|
20
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
21
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
25
|
+
padding: ds-spacing-component($ds-sc-x4);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ds-teaser__vignette {
|
|
30
|
+
grid-column: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ds-teaser__title {
|
|
34
|
+
grid-row: 1;
|
|
35
|
+
grid-column: 1 / span 1;
|
|
36
|
+
@include ds-typography($ds-typography-expressive-heading04bold);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ds-teaser__vignette + .ds-teaser__title {
|
|
40
|
+
grid-row: 2;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ds-teaser__text {
|
|
44
|
+
grid-row: 3;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.ds-teaser--large-big-italic {
|
|
48
|
+
.ds-teaser__title {
|
|
49
|
+
@include ds-typography($ds-typography-expressive-heading04italicregular);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
53
|
+
.ds-teaser__title {
|
|
54
|
+
grid-column-end: span 2;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ds-teaser__byline {
|
|
58
|
+
grid-row: 3;
|
|
59
|
+
margin-top: ds-spacing-component($ds-sc-x2);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
64
|
+
.ds-teaser__title {
|
|
65
|
+
grid-column-end: span 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&.ds-teaser--large-italic {
|
|
71
|
+
.ds-teaser__title {
|
|
72
|
+
@include ds-typography($ds-typography-expressive-heading03italicregular);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ds-teaser__byline {
|
|
77
|
+
grid-column: 2;
|
|
78
|
+
grid-row: 1 / span 3;
|
|
79
|
+
|
|
80
|
+
position: relative;
|
|
81
|
+
margin-left: ds-spacing-component($ds-sc-x4);
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
|
|
84
|
+
.picture {
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: 0;
|
|
87
|
+
right: 0;
|
|
88
|
+
|
|
89
|
+
@include ds-mq-only-breakpoint(mobile) {
|
|
90
|
+
bottom: -#{ds-spacing-component($ds-sc-x3)};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
94
|
+
bottom: -#{ds-spacing-component($ds-sc-x4)};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
width: 100%;
|
|
98
|
+
min-width: 104px;
|
|
99
|
+
margin: 0;
|
|
100
|
+
|
|
101
|
+
> .picture__img {
|
|
102
|
+
margin: 0;
|
|
103
|
+
top: unset;
|
|
104
|
+
max-height: unset;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
109
|
+
width: 104px;
|
|
110
|
+
min-height: 85px;
|
|
111
|
+
margin-left: ds-spacing-component($ds-sc-x2);
|
|
112
|
+
margin-bottom: -#{ds-spacing-component($ds-sc-x3)};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
116
|
+
width: 168px;
|
|
117
|
+
// En bylinebild bör va lika hög som en "grekisk byst" - man ska se lite skjortkrage!
|
|
118
|
+
min-height: 110px;
|
|
119
|
+
margin-bottom: -#{ds-spacing-component($ds-sc-x4)};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -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
|
+
|targetId | String | no | | | Target article ID |
|
|
16
|
+
|variant | String | no | "default" or "podd" | "default" | |
|
|
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,70 @@
|
|
|
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
|
+
|
|
4
|
+
{% macro TeaserStandard(params) %}
|
|
5
|
+
{% set componentClassName = "ds-teaser" %}
|
|
6
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
7
|
+
{% set additionalClasses = ["ds-teaser--standard"] %}
|
|
8
|
+
{% set attributes = getAttributes(params.attributes) %}
|
|
9
|
+
|
|
10
|
+
{% if params.variant %}
|
|
11
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.variant), additionalClasses) %}
|
|
12
|
+
{% else %}
|
|
13
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + "standard"), additionalClasses) %}
|
|
14
|
+
{% endif %}
|
|
15
|
+
|
|
16
|
+
{% if params.theme %}
|
|
17
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
18
|
+
{% endif %}
|
|
19
|
+
|
|
20
|
+
{% if params.classNames %}
|
|
21
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
22
|
+
{% endif%}
|
|
23
|
+
|
|
24
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
25
|
+
|
|
26
|
+
<a href="{{ params.targetLink }}"
|
|
27
|
+
class="{{ classes }}"
|
|
28
|
+
{% if params.targetId %} data-id="{{ params.targetId }}" {% endif %}
|
|
29
|
+
{{- attributes | safe }}>
|
|
30
|
+
|
|
31
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
32
|
+
{% if params.vignette %}
|
|
33
|
+
<div class="ds-teaser__vignette">{{ params.vignette }}</div>
|
|
34
|
+
{% endif %}
|
|
35
|
+
|
|
36
|
+
<h2 class="{{ componentClassName + '__title'}} {{ componentClassName + '__title--italic' if params.isItalicHeadline}}">
|
|
37
|
+
{% if params.highlight %}
|
|
38
|
+
<span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
|
|
39
|
+
{% endif %}
|
|
40
|
+
{{ params.title | safe }}
|
|
41
|
+
</h2>
|
|
42
|
+
|
|
43
|
+
{% if params.text %}
|
|
44
|
+
<p class="{{ componentClassName + '__text'}}">
|
|
45
|
+
{% if params.isFlashingDot %}
|
|
46
|
+
<span class="ds-sticker__flashing-dot"></span>
|
|
47
|
+
{% endif %}
|
|
48
|
+
{% if params.sticker %}
|
|
49
|
+
<span class="ds-sticker">
|
|
50
|
+
{{ params.sticker }}
|
|
51
|
+
</span>
|
|
52
|
+
{% endif %}
|
|
53
|
+
{{ params.text }}
|
|
54
|
+
</p>
|
|
55
|
+
{% endif %}
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
{% if params.mediaHtml %}
|
|
59
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
60
|
+
{{ params.mediaHtml }}
|
|
61
|
+
{% if params.isLocked %}
|
|
62
|
+
{{ VipBadge({
|
|
63
|
+
showText: false,
|
|
64
|
+
forcePx: true
|
|
65
|
+
}) }}
|
|
66
|
+
{% endif %}
|
|
67
|
+
</div>
|
|
68
|
+
{% endif %}
|
|
69
|
+
</a>
|
|
70
|
+
{% endmacro %}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
+
|
|
4
|
+
.ds-teaser--standard {
|
|
5
|
+
display: flex;
|
|
6
|
+
|
|
7
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
8
|
+
padding: ds-spacing-component($ds-sc-x3 $ds-sc-x4);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
12
|
+
padding: ds-spacing-component($ds-sc-x4);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ds-teaser__title {
|
|
16
|
+
@include ds-typography($ds-typography-expressive-heading03bold);
|
|
17
|
+
|
|
18
|
+
&--italic {
|
|
19
|
+
@include ds-typography($ds-typography-expressive-heading03italicregular);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ds-teaser__media {
|
|
24
|
+
margin-left: ds-spacing-component($ds-sc-x4);
|
|
25
|
+
|
|
26
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
27
|
+
min-width: 104px;
|
|
28
|
+
max-width: 104px;
|
|
29
|
+
|
|
30
|
+
.ds-teaser-image__byline {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
36
|
+
min-width: 224px;
|
|
37
|
+
max-width: 224px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.teaser__video {
|
|
41
|
+
max-width: 100%;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
- GitHub: [BonnierNews/dn-design-system/../web/src/components/vip-badge](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/vip-badge)
|
|
2
|
-
- Storybook: [VipBadge > Web > Vip Badge](https://designsystem.dn.se/?path=/story/components-app-web-vipbadge-web
|
|
3
|
-
- Storybook: [VipBadge > Web > Vip Badge With Text](https://designsystem.dn.se/?path=/story/components-app-web-vipbadge-web
|
|
2
|
+
- Storybook (PROD): [VipBadge > Web > Vip Badge](https://designsystem.dn.se/?path=/story/components-app-web-section-components-vipbadge-web)
|
|
3
|
+
- Storybook (LATEST): [VipBadge > Web > Vip Badge With Text](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-vipbadge-web)
|
|
4
4
|
|
|
5
5
|
----
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ $ds-hex-text-brand: #DA000D;
|
|
|
11
11
|
$ds-hex-text-body-link: #4373CE;
|
|
12
12
|
$ds-hex-text-body-link-visited: #4373CE;
|
|
13
13
|
$ds-hex-icon-primary: #050505;
|
|
14
|
-
$ds-hex-icon-primary-02: #
|
|
14
|
+
$ds-hex-icon-primary-02: #666666;
|
|
15
15
|
$ds-hex-icon-secondary: #ffffff;
|
|
16
16
|
$ds-hex-icon-critical: #DA000D;
|
|
17
17
|
$ds-hex-icon-disabled: #666666;
|
|
@@ -7,3 +7,4 @@ $ds-sl-gap-vertical-medium: gap-vertical-medium;
|
|
|
7
7
|
$ds-sl-gap-vertical-static-large: gap-vertical-static-large;
|
|
8
8
|
$ds-sl-gap-horizontal-static-small: gap-horizontal-static-small;
|
|
9
9
|
$ds-sl-gap-vertical-static-small: gap-vertical-static-small;
|
|
10
|
+
$ds-sl-page-top-xsmall: page-top-xsmall;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonniernews/dn-design-system-web",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.36",
|
|
4
4
|
"description": "DN design system for web.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"homepage": "https://github.com/BonnierNews/dn-design-system/tree/main/web/src#readme",
|
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
"gap-vertical-medium": "gap-vertical-medium",
|
|
8
8
|
"gap-vertical-static-large": "gap-vertical-static-large",
|
|
9
9
|
"gap-horizontal-static-small": "gap-horizontal-static-small",
|
|
10
|
-
"gap-vertical-static-small": "gap-vertical-static-small"
|
|
10
|
+
"gap-vertical-static-small": "gap-vertical-static-small",
|
|
11
|
+
"page-top-xsmall": "page-top-xsmall"
|
|
11
12
|
}
|