@bonniernews/dn-design-system-web 3.0.0-alpha.42 → 3.0.0-alpha.43
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
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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.43](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.42...@bonniernews/dn-design-system-web@3.0.0-alpha.43) (2023-05-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **web:** teaser split ([#786](https://github.com/BonnierNews/dn-design-system/issues/786)) ([b142d17](https://github.com/BonnierNews/dn-design-system/commit/b142d1748977a4520ea12768bde7c6a16daf5056))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [3.0.0-alpha.42](https://github.com/BonnierNews/dn-design-system/compare/@bonniernews/dn-design-system-web@3.0.0-alpha.41...@bonniernews/dn-design-system-web@3.0.0-alpha.42) (2023-05-03)
|
|
7
16
|
|
|
8
17
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-split](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-split)
|
|
2
|
+
- Storybook (PROD): [TeaserSplitContainer > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teasersplitcontainer-web)
|
|
3
|
+
- Storybook (LATEST): [TeaserSplitContainer > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teasersplitcontainer-web)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# TeaserSplitContainer
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|teasersHtml | HTML String | yes | | | HTML teaser output |
|
|
14
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme is applied to all teasers in the container |
|
|
15
|
+
|attributes | Object | no | | | Ex. { target: "_blank", "data-test": "lorem ipsum" } |
|
|
16
|
+
|classNames | String | no | | | Ex. "my-special-class" |
|
|
17
|
+
|areaType | string | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
|
|
18
|
+
|~forcePx~ | | | | | Not supported |
|
|
19
|
+
|
|
20
|
+
## Minimum requirement example
|
|
21
|
+
|
|
22
|
+
### Nunjucks
|
|
23
|
+
|
|
24
|
+
These are copy paste friendly examples to quickliy get started using a component.
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
{% from "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split.njk" import TeaserSplitContainer %}
|
|
28
|
+
|
|
29
|
+
{{ TeaserSplitContainer({
|
|
30
|
+
areaType: "bauta",
|
|
31
|
+
teasersHtml: "",
|
|
32
|
+
attributes: {},
|
|
33
|
+
classNames: ""
|
|
34
|
+
})}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### SCSS
|
|
38
|
+
```scss
|
|
39
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split";
|
|
40
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
- GitHub: [BonnierNews/dn-design-system/../web/src/components/teaser-split](https://github.com/BonnierNews/dn-design-system/tree/main/web/src/components/teaser-split)
|
|
2
|
+
- Storybook (PROD): [TeaserSplit > Web](https://designsystem.dn.se/?path=/story/components-app-web-section-components-teasersplit-web)
|
|
3
|
+
- Storybook (LATEST): [TeaserSplit > Web](https://designsystem-latest.dn.se/?path=/story/components-app-web-section-components-teasersplit-web)
|
|
4
|
+
|
|
5
|
+
----
|
|
6
|
+
|
|
7
|
+
# TeaserSplit
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
|parameter | type | required | options | default | description |
|
|
12
|
+
|:--- | :--- | :--- | :--- | :--- | :--- |
|
|
13
|
+
|title | String | yes | | | Heading of the teaser |
|
|
14
|
+
|targetLink | String | yes | | | Target URL for the teaser |
|
|
15
|
+
|targetId | String | no | | | Target article ID |
|
|
16
|
+
|~variant~ | String | no | "default" or "podd" | "default" | Not implemented |
|
|
17
|
+
|areaType | string | no | "right" or "bauta" or "bautaxl" | | The area where the column is rendered |
|
|
18
|
+
|theme | String | no | nyheter, kultur, ekonomi, sport, sthlm | (empty) | The theme-class to apply to the teaser |
|
|
19
|
+
|text | String | no | | | Teaser subtext |
|
|
20
|
+
|vignette | String | no | | | Top text in the teaser |
|
|
21
|
+
|highlight | String | no | | | Text before the heading |
|
|
22
|
+
|sticker | String | no | | | Red text before the text |
|
|
23
|
+
|mediaHtml | HTML String | no | | | Main image or other media |
|
|
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-split/teaser-split.njk" import TeaserSplit %}
|
|
38
|
+
|
|
39
|
+
{{ TeaserSplit({
|
|
40
|
+
title: "Sju miljoner i humanitärt stöd till Turkiet och Syrien",
|
|
41
|
+
targetLink: "#",
|
|
42
|
+
targetId: "test.123",
|
|
43
|
+
text: "Tält och temporära nödboenden samt ledningsresurser för att koordinera räddningsarbetet."
|
|
44
|
+
})}}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### SCSS
|
|
48
|
+
```scss
|
|
49
|
+
@use "@bonniernews/dn-design-system-web/components/teaser-split/teaser-split";
|
|
50
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
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 TeaserSplit(params) %}
|
|
5
|
+
{% set componentClassName = "ds-teaser" %}
|
|
6
|
+
{% set classNamePrefix = componentClassName + "--" %}
|
|
7
|
+
{% set additionalClasses = ["ds-teaser--split"] %}
|
|
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.areaType == "bauta" or params.areaType == "bautaxl" %}
|
|
15
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
|
|
16
|
+
{% endif %}
|
|
17
|
+
|
|
18
|
+
{% if params.theme %}
|
|
19
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
{% if params.classNames %}
|
|
23
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
24
|
+
{% endif%}
|
|
25
|
+
|
|
26
|
+
{% set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
27
|
+
|
|
28
|
+
<a href="{{ params.targetLink }}"
|
|
29
|
+
class="{{ classes }}"
|
|
30
|
+
{% if params.targetId %} data-id="{{ params.targetId }}" {% endif %}
|
|
31
|
+
{{- attributes | safe }}>
|
|
32
|
+
|
|
33
|
+
{% if params.mediaHtml %}
|
|
34
|
+
<div class="{{ componentClassName + '__media'}}">
|
|
35
|
+
{{ params.mediaHtml }}
|
|
36
|
+
{% if params.isLocked %}
|
|
37
|
+
{{ VipBadge({
|
|
38
|
+
showText: false,
|
|
39
|
+
forcePx: true
|
|
40
|
+
}) }}
|
|
41
|
+
{% endif %}
|
|
42
|
+
</div>
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
<div class="{{ componentClassName + '__content'}}">
|
|
46
|
+
{% if params.vignette %}
|
|
47
|
+
<div class="ds-teaser__vignette">{{ params.vignette }}</div>
|
|
48
|
+
{% endif %}
|
|
49
|
+
|
|
50
|
+
<h2 class="{{ componentClassName + '__title' }}">
|
|
51
|
+
{% if params.highlight %}
|
|
52
|
+
<span class="{{ componentClassName + '__highlight'}}">{{ params.highlight }}</span>
|
|
53
|
+
{% endif %}
|
|
54
|
+
{{ params.title | safe }}
|
|
55
|
+
</h2>
|
|
56
|
+
|
|
57
|
+
{% if params.text %}
|
|
58
|
+
<p class="{{ componentClassName + '__text'}}">
|
|
59
|
+
{% if params.isFlashingDot %}
|
|
60
|
+
<span class="ds-sticker__flashing-dot"></span>
|
|
61
|
+
{% endif %}
|
|
62
|
+
{% if params.sticker %}
|
|
63
|
+
<span class="ds-sticker">
|
|
64
|
+
{{ params.sticker }}
|
|
65
|
+
</span>
|
|
66
|
+
{% endif %}
|
|
67
|
+
{{ params.text }}
|
|
68
|
+
</p>
|
|
69
|
+
{% endif %}
|
|
70
|
+
</div>
|
|
71
|
+
</a>
|
|
72
|
+
{% endmacro %}
|
|
73
|
+
|
|
74
|
+
{% macro TeaserSplitContainer(params) %}
|
|
75
|
+
{{ params.teasers | dump }}
|
|
76
|
+
{%- set componentClassName = "ds-split-container" %}
|
|
77
|
+
{%- set classNamePrefix = componentClassName + "--" %}
|
|
78
|
+
{%- set additionalClasses = [] %}
|
|
79
|
+
{%- set attributes = getAttributes(params.attributes) %}
|
|
80
|
+
|
|
81
|
+
{% if params.areaType == "bauta" or params.areaType == "bautaxl" %}
|
|
82
|
+
{% set additionalClasses = (additionalClasses.push(classNamePrefix + params.areaType), additionalClasses) %}
|
|
83
|
+
{% endif %}
|
|
84
|
+
|
|
85
|
+
{% if params.theme %}
|
|
86
|
+
{% set additionalClasses = (additionalClasses.push('ds-theme--' + params.theme), additionalClasses) %}
|
|
87
|
+
{% endif %}
|
|
88
|
+
|
|
89
|
+
{%- if params.classNames %}
|
|
90
|
+
{% set additionalClasses = (additionalClasses.push(params.classNames), additionalClasses) %}
|
|
91
|
+
{% endif%}
|
|
92
|
+
|
|
93
|
+
{%- set classes = componentClassName + " " + additionalClasses | join(" ") %}
|
|
94
|
+
<div class="{{ classes }}" {{- attributes | safe }}>{{ params.teasersHtml | safe }}</div>
|
|
95
|
+
{% endmacro %}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@use "../../foundations/helpers/forward.helpers.scss" as *;
|
|
2
|
+
@use "../../assets/teaser/teaser.scss" as *;
|
|
3
|
+
|
|
4
|
+
.ds-split-container {
|
|
5
|
+
@include ds-spacing-layout($ds-sl-teaser-vertical $ds-sl-teaser-horizontal);
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
position: relative;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
|
|
11
|
+
& + .ds-split-container {
|
|
12
|
+
&:before {
|
|
13
|
+
content: "";
|
|
14
|
+
height: ds-metrics-border-width(x1);
|
|
15
|
+
background-color: $ds-color-border-primary;
|
|
16
|
+
left: 0;
|
|
17
|
+
right: 0;
|
|
18
|
+
top: 0;
|
|
19
|
+
position: absolute;
|
|
20
|
+
@include ds-spacing-layout(0 $ds-sl-teaser-horizontal, margin);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ds-teaser--split {
|
|
25
|
+
box-sizing: content-box;
|
|
26
|
+
display: block;
|
|
27
|
+
position: relative;
|
|
28
|
+
flex: 1;
|
|
29
|
+
padding-right: ds-spacing-component($ds-sc-x4);
|
|
30
|
+
&:last-child {
|
|
31
|
+
padding-right: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
35
|
+
width: calc(50% - ds-spacing-component($ds-sc-x4) / 2);
|
|
36
|
+
flex: auto;
|
|
37
|
+
// if a teaser is both third and last child it has the row by itself and should be full width
|
|
38
|
+
&:nth-child(3):last-child {
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
&:nth-child(2) {
|
|
42
|
+
padding-right: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:nth-child(3),
|
|
47
|
+
&:nth-child(4) {
|
|
48
|
+
@include ds-spacing-layout($ds-sl-teaser-vertical, margin-top);
|
|
49
|
+
@include ds-spacing-layout($ds-sl-teaser-vertical, padding-top);
|
|
50
|
+
border-top: ds-metrics-border-width(x1) solid $ds-color-border-primary;
|
|
51
|
+
|
|
52
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
53
|
+
margin-top: 0;
|
|
54
|
+
padding-top: 0;
|
|
55
|
+
border-top: none;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ds-teaser__title {
|
|
60
|
+
@include ds-typography($ds-typography-expressive-heading02bold);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ds-teaser__media {
|
|
64
|
+
@include ds-mq-largest-breakpoint(mobile) {
|
|
65
|
+
margin-bottom: ds-spacing-component($ds-sc-x2);
|
|
66
|
+
|
|
67
|
+
.ds-teaser-image__byline {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@include ds-mq-smallest-breakpoint(tablet) {
|
|
73
|
+
margin-bottom: ds-spacing-component($ds-sc-x3);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
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.43",
|
|
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",
|